結果
| 問題 |
No.141 魔法少女コバ
|
| コンテスト | |
| ユーザー |
yaoshimax
|
| 提出日時 | 2015-04-30 19:12:35 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 274 bytes |
| コンパイル時間 | 102 ms |
| コンパイル使用メモリ | 6,784 KB |
| 実行使用メモリ | 12,544 KB |
| 最終ジャッジ日時 | 2024-07-05 17:14:26 |
| 合計ジャッジ時間 | 33,181 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 87 WA * 1 TLE * 5 |
ソースコード
def gcd(a,b):
if b<a:
return gcd(b,a)
if b%a==0:
return a
return gcd(b%a,a)
M,N=map(int,raw_input().split())
ans=0
while N!=M and N!=1:
if M>N:
M-=N
else:
M,N=N,M
d=gcd(M,N)
M/=d
N/=d
ans+=1
print ans+M-1
yaoshimax