結果
問題 |
No.442 和と積
|
ユーザー |
![]() |
提出日時 | 2017-04-05 17:30:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 502 bytes |
コンパイル時間 | 184 ms |
コンパイル使用メモリ | 30,592 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-08 10:52:11 |
合計ジャッジ時間 | 829 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 7 |
ソースコード
#include <stdio.h> int main(void) { unsigned long long A,B,surplus = 1,left,right,most_anser; scanf("%llu %llu",&A,&B); // printf("%llu %llu\n",A, B); if(A+B < A*B){ right = A+B; left = A; }else{ right = A; left = A+B; } // printf("%llu %llu\n",left, right); while(surplus != 0){ surplus = left % right; //最大公約数を保存 most_anser = right; left = right; right = surplus; // printf("%llu %llu\n",left, right); } printf("%llu\n",most_anser); return 0; }