문제 : 두 수 비교하기(1330번)(Bronze V)
문제 링크 : https://www.acmicpc.net/problem/1330
출처 : Baekjoon Online Judge
조건문 기초에서 if문 등에 대해 간단히 알 수 있습니다.
바로 정답 소스 코드를 공유하도록 하겠습니다.
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int a, b;
cin >> a >> b;
if(a > b) cout << ">";
else if(a < b) cout << "<";
else cout << "==";
return 0;
}
참고로 조건문 혹은 반복문에서 실행할 코드가 단 한 줄이면 {} 생략 가능합니다.
Python의 경우 아래와 같이 작성하면 됩니다.
import sys
input = sys.stdin.readline
A, B = map(int, input().split())
if A > B :
print(">")
elif A < B :
print("<")
else :
print("==")
'(구) solved ac class 문제들 > class 1' 카테고리의 다른 글
| [class 1]백준 검증수(2475번) (C++/Python) (0) | 2026.02.05 |
|---|---|
| [class 1]백준 별 찍기 - 1(2438번) (C++/Python) (0) | 2026.02.04 |
| [class 1]백준 A/B(1008번) 풀이 (C++/Python) (0) | 2026.01.30 |
| [class 1]백준 A-B(1001번) 풀이 (C++/Python) (0) | 2026.01.28 |
| [class 1]백준 A+B(1000번) 풀이 (C++/Python) (0) | 2026.01.28 |