結果
| 問題 |
No.887 Collatz
|
| コンテスト | |
| ユーザー |
aeronex806
|
| 提出日時 | 2019-09-24 02:38:43 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 215 bytes |
| コンパイル時間 | 191 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-19 04:51:48 |
| 合計ジャッジ時間 | 1,790 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
n0=int(input())
nmax=n0
n=n0
cnt=0
while n!=1:
if n==1:
break
elif n%2==0:
n/=2
cnt+=1
elif n%2==1:
n=3*n+1
cnt+=1
nmax=max(nmax,n)
print(cnt)
print(int(nmax))
aeronex806