結果
| 問題 | No.141 魔法少女コバ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-13 15:56:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 379 ms / 5,000 ms |
| コード長 | 422 bytes |
| コンパイル時間 | 703 ms |
| コンパイル使用メモリ | 67,408 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-17 04:53:47 |
| 合計ジャッジ時間 | 4,567 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 93 |
ソースコード
#include <iostream>
#include <math.h>
int func(int a,int b){
while(1){
int r=a%b;
if(r==0)return b;
a=b;
b=r;
}
}
int main(){
int a,b;
std::cin>>a>>b;
if(a==b){
std::cout<<0<<std::endl;
return 0;
}
int m=func(a,b);
a/=m;
b/=m;
int count=0;
while(1){
if(a>b){
a-=b;
}else{
int tmp=a;
a=b;
b=tmp;
}
count++;
if(a==b){
break;
}
}
std::cout<<count<<std::endl;
return 0;
}