문제 링크입니다: www.acmicpc.net/problem/21354
21354번: Äpplen och päron
En rad med två heltal $A,P$ ($0 \le A,P \le 1000)$, antalet äpplen Axel har lyckats sälja, och antalet päron Petra har lyckats sälja.
www.acmicpc.net
간단한 구현 문제였습니다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
const int APPLE_PRIZE = 7; | |
const int PEAR_PRIZE = 13; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int A, P; | |
cin >> A >> P; | |
int apple = A * APPLE_PRIZE; | |
int pear = P * PEAR_PRIZE; | |
if (apple > pear) | |
{ | |
cout << "Axel\n"; | |
} | |
else if (apple == pear) | |
{ | |
cout << "lika\n"; | |
} | |
else | |
{ | |
cout << "Petra\n"; | |
} | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 2783번 삼각 김밥 (0) | 2021.04.25 |
---|---|
백준 21355번 Personnummer (0) | 2021.04.25 |
백준 21591번 Laptop Sticker (0) | 2021.04.25 |
백준 2765번 자전거 속도 (0) | 2021.04.25 |
백준 2754번 학점계산 (0) | 2021.04.25 |