結果
| 問題 |
No.887 Collatz
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2019-06-21 01:35:21 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 317 bytes |
| コンパイル時間 | 1,862 ms |
| コンパイル使用メモリ | 165,648 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 06:55:25 |
| 合計ジャッジ時間 | 2,897 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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