結果
| 問題 | No.3631 Collatz conjecture |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-05-20 22:12:01 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 271 bytes |
| 記録 | |
| コンパイル時間 | 1,860 ms |
| コンパイル使用メモリ | 331,856 KB |
| 実行使用メモリ | 18,964 KB |
| 最終ジャッジ日時 | 2026-08-21 20:50:43 |
| 合計ジャッジ時間 | 8,882 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 1 -- * 1 |
| other | -- * 53 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int Collatz(int n){
if(n % 2 == 0){
return n / 2;
}else{
return n * 3 + 1;
}
}
int main(){
int n;
cin >> n;
int ans = 1;
Collatz(n);
while(n != 1){
Collatz(n);
++ans;
}
cout << ans << "\n";
return 0;
}