結果
| 問題 | No.887 Collatz |
| コンテスト | |
| ユーザー |
MarcusAureliusAntoninus
|
| 提出日時 | 2019-09-20 21:51:34 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 307 bytes |
| 記録 | |
| コンパイル時間 | 1,120 ms |
| コンパイル使用メモリ | 208,988 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-07 22:11:19 |
| 合計ジャッジ時間 | 2,320 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 4 WA * 24 |
ソースコード
#include <bits/stdc++.h>
int main()
{
int64_t n;
scanf("%lld", &n);
int i1{-1};
int64_t n_max{n};
for (int i{}; i <= 400; i++)
{
if (i1 < 0 && n == 1) i1 = i;
if (n & 1) n = 3 * n + 1;
else n /= 2;
if (i <= i1)
n_max = std::max(n, n_max);
}
printf("%d\n%lld\n", i1, n_max);
return 0;
}
MarcusAureliusAntoninus