結果
問題 | No.887 Collatz |
ユーザー |
![]() |
提出日時 | 2020-06-17 16:20:13 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 268 bytes |
コンパイル時間 | 2,803 ms |
コンパイル使用メモリ | 65,464 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-03 12:17:00 |
合計ジャッジ時間 | 3,643 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(2, 8) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(1, 17) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
import strutils,sequtilsimport mathproc input():string=stdin.readLinelet n0=input().parseIntvarn=n0n_max=ncnt=0while n!=1:if n mod 2==0:n=n div 2else:n=3*n+1n_max=max(n,n_max)cnt.incecho cntecho n_max