結果
問題 | No.887 Collatz |
ユーザー | bal4u |
提出日時 | 2019-09-20 21:29:57 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 323 bytes |
コンパイル時間 | 1,516 ms |
コンパイル使用メモリ | 28,032 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 16:26:08 |
合計ジャッジ時間 | 2,008 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
// yukicoder 887 Collatz // 2019.9.20 bal4u #include <stdio.h> typedef long long ll; int main() { ll n0, nmax; int i1; scanf("%lld", &n0); i1 = 0, nmax = n0; while (n0 > 1) { if (n0 & 1) { n0 = 3*n0 + 1; if (n0 > nmax) nmax = n0; } else n0 >>= 1; i1++; } printf("%d\n%lld\n", i1, nmax); return 0; }