結果
| 問題 |
No.887 Collatz
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2019-06-14 03:30:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 268 bytes |
| コンパイル時間 | 1,836 ms |
| コンパイル使用メモリ | 157,284 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-06 17:10:01 |
| 合計ジャッジ時間 | 2,936 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, i1 = 0, nmax = 1;
cin >> n;
while (n > 1) {
if (n > nmax) nmax = n;
if (n % 2 == 0) {
n /= 2;
} else {
n = 3 * n + 1;
}
i1++;
}
cout << i1 << endl << nmax << endl;
}
trineutron