結果
問題 | No.141 魔法少女コバ |
ユーザー |
![]() |
提出日時 | 2015-02-22 00:04:31 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 334 bytes |
コンパイル時間 | 248 ms |
コンパイル使用メモリ | 34,012 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 21:48:47 |
合計ジャッジ時間 | 2,364 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 93 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d %d", &M, &N); | ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>#include <algorithm>int main(){int M, N;scanf("%d %d", &M, &N);int g = std::__gcd(M, N);M = M / g;N = N / g;int t = 0;while(M % N > 0){t += 1 + M / N;int nm = N, nn = M % N;M = nm; N = nn;}t += M / N - 1;printf("%d\n", t);}