結果
| 問題 | No.442 和と積 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-06 17:08:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 286 bytes |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 22,912 KB |
| 実行使用メモリ | 15,040 KB |
| 最終ジャッジ日時 | 2024-06-30 10:16:05 |
| 合計ジャッジ時間 | 4,474 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%lld %lld", &A, &B);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<cstdio>
int main(void) {
long long int A, B, X, Y;
scanf("%lld %lld", &A, &B);
X = A + B;
Y = A * B;
while (X%Y != 0 && Y % X != 0) {
if (X > Y) { X = X % Y; }
else { Y = Y % X; }
}
if (X > Y) {
printf("%lld",Y );
}
else { printf("%lld", X); }
return 0;
}