結果
| 問題 |
No.1339 循環小数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-21 12:45:07 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 240 bytes |
| コンパイル時間 | 169 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 359,388 KB |
| 最終ジャッジ日時 | 2024-12-24 12:08:46 |
| 合計ジャッジ時間 | 53,311 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 20 TLE * 16 |
コンパイルメッセージ
Syntax OK
ソースコード
def solve
n = gets.to_s.to_i
x = 1
i = 0
cnt = {}
while cnt[x].nil?
cnt[x] = i
x = (x * 10) % n
if x.zero?
return 1
end
i += 1
end
return i - cnt[x]
end
t = gets.to_s.to_i
t.times do
puts solve
end