結果
| 問題 | No.3631 Collatz conjecture |
| コンテスト | |
| ユーザー |
あいすあうと
|
| 提出日時 | 2026-08-22 14:48:08 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 488µs | |
| コード長 | 236 bytes |
| 記録 | |
| コンパイル時間 | 2,449 ms |
| コンパイル使用メモリ | 333,260 KB |
| 実行使用メモリ | 9,388 KB |
| 最終ジャッジ日時 | 2026-08-22 14:48:14 |
| 合計ジャッジ時間 | 5,080 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 53 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
long long cnt=0;
while(cnt<100000000){
if(n%2==0)n/=2;
else n=n*3+1;
cnt++;
if(n==1){
cout<<cnt<<endl;
return 0;
}
}
cout<<"infinity"<<endl;
}
あいすあうと