문제 링크입니다: www.acmicpc.net/problem/15128
15128번: Congruent Numbers
Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. Each test case will consist of a single line with four integers p1, q1, p2 and q2 (1 ≤ p1,q1,p2,q2 ≤ 100,000) where p1/q1 and p2/q2 are
www.acmicpc.net
삼각형의 넓이가 정수라는 것은 결국 (p1 * p2)≡(q1 * q2 * 2) 결과가 0을 의미합니다.
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; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
long long p1, q1, p2, q2; | |
cin >> p1 >> q1 >> p2 >> q2; | |
bool isAreaInteger = (p1 * p2 % (q1 * q2 * 2) == 0); | |
cout << isAreaInteger << "\n"; | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 15474번 鉛筆 (0) | 2021.03.22 |
---|---|
백준 15236번 Dominos (0) | 2021.03.21 |
백준 15080번 Every Second Counts (0) | 2021.03.19 |
백준 15059번 Hard choice (0) | 2021.03.19 |
백준 15051번 Máquina de café (0) | 2021.03.19 |