結果
| 問題 |
No.141 魔法少女コバ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-11 01:12:36 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 90 ms / 5,000 ms |
| コード長 | 344 bytes |
| コンパイル時間 | 51 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-09-24 23:34:24 |
| 合計ジャッジ時間 | 10,978 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 93 |
コンパイルメッセージ
Syntax OK
ソースコード
m,n = gets.split.map(&:to_i)
GCD = m.gcd(n)
m /= GCD
n /= GCD
@x,@y = m,n
def swap
tmp = @x
@x = @y
@y = tmp
end
ans = 0
while @x != 1 || @y != 1
if @x < @y
swap()
ans += 1
else
ans += @x / @y
@x %= @y
if @y == 1
ans -= 1
@x += 1
end
end
end
p ans