結果
| 問題 | No.141 魔法少女コバ |
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2015-02-01 23:49:32 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 345 bytes |
| 記録 | |
| コンパイル時間 | 194 ms |
| コンパイル使用メモリ | 53,612 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-03-07 20:47:36 |
| 合計ジャッジ時間 | 1,585 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 92 WA * 1 |
ソースコード
#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