結果
| 問題 | No.887 Collatz |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-21 15:23:27 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 303µs | |
| コード長 | 381 bytes |
| 記録 | |
| コンパイル時間 | 887 ms |
| コンパイル使用メモリ | 179,848 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-30 14:17:35 |
| 合計ジャッジ時間 | 2,583 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
int n = 0;
cin >> n;
int count = 0;
int max = n;
while(n != 1){
if(n % 2 == 0){
n /= 2;
count++;
}else{
n = 3*n + 1;
count++;
}
if(max<n){
max = n;
}
}
cout << count << endl;
cout << max;
}