結果
| 問題 |
No.141 魔法少女コバ
|
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2015-02-01 23:49:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 345 bytes |
| コンパイル時間 | 224 ms |
| コンパイル使用メモリ | 34,560 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 05:36:09 |
| 合計ジャッジ時間 | 1,931 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 92 WA * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | int n,m;scanf("%d%d",&n,&m);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
//namaega184
int main(){
int n,m;scanf("%d%d",&n,&m);
int x=n,y=m,a=y%x;
while(a){y=x;x=a;a=y%x;}n/=x,m/=x;
int ans=0;
while(n+m>2){
if(n<m){ans++;swap(n,m);}
ans+=n/m;
if(n%m)n%=m;else n=1;
}
printf("%d\n",ans-1);
return 0;
}
184