[algorithm] 백준 9498번 시험 성적

2025. 10. 12. 10:37·algorithm/기초 코드
반응형

 

 

풀이 : if 문을 사용하면 되는 간단한 문제로 c++은 파이썬과 달리 90 < a < 100 과 같이 연산자가 결합된 형태로는

          사용이 불가능하기때문에 && 연산자를 이용하여 따로따로 써주어야 함을 주의해야한다.

 

코드

#include <iostream>
using namespace std;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int a;
    cin >> a;

    if (90 <= a && a <= 100) cout << 'A';
    else if (80 <= a && a <= 89) cout << 'B';
    else if (70 <= a && a <= 79) cout << 'C';
    else if (60 <= a && a <= 69) cout << 'D';
    else cout << 'F';

    
    return 0;
}

 

반응형

'algorithm > 기초 코드' 카테고리의 다른 글

[algorithm] 백준 2753번 윤년  (0) 2025.10.12
[algorithm] 백준 2752번 세수정렬  (0) 2025.10.12
[algorithm] 백준 10869번 사칙연산  (0) 2025.10.10
[algorithm] 백준 10171번 고양이  (0) 2025.10.10
[algorithm] 백준 2557번 Hello World  (0) 2025.10.10
'algorithm/기초 코드' 카테고리의 다른 글
  • [algorithm] 백준 2753번 윤년
  • [algorithm] 백준 2752번 세수정렬
  • [algorithm] 백준 10869번 사칙연산
  • [algorithm] 백준 10171번 고양이
20puddle
20puddle
20puddle 님의 블로그 입니다.
  • 20puddle
    20puddle 님의 블로그
    20puddle
  • 전체
    오늘
    어제
    • 분류 전체보기 (100)
      • Spring boot (5)
      • git & github (5)
      • algorithm (47)
        • theory (3)
        • 배열 (7)
        • 연결 리스트 (3)
        • 스택 (5)
        • 큐 (3)
        • 덱 (2)
        • 기초 코드 (19)
        • BFS (5)
      • AI (43)
        • Machine Learning (35)
        • Deep Learning (8)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    Spring Boot
    ML
    Aimers
    list
    백준
    그레디언트 클리핑
    DL
    주성분변환
    게시판
    딥러닝
    알고리즘
    Java
    오프라인 학습
    홀드아웃 검증
    AI
    git
    github
    머신러닝
    연결리스트
    인공지능
  • 최근 댓글

  • 최근 글

  • 반응형
  • hELLO· Designed By정상우.v4.10.3
20puddle
[algorithm] 백준 9498번 시험 성적
상단으로

티스토리툴바