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