結果
問題 |
No.887 Collatz
|
ユーザー |
|
提出日時 | 2022-06-03 16:57:36 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 219 bytes |
コンパイル時間 | 914 ms |
コンパイル使用メモリ | 85,112 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 02:20:41 |
合計ジャッジ時間 | 1,919 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 1 |
ソースコード
#include<iostream> #include<algorithm> using namespace std; int main(){ int n; cin>>n; for(int mx=n,i=1;;i++){ n=n%2?3*n+1:n/2; mx=max(mx,n); if(n==1){ cout<<i<<endl; cout<<mx<<endl; return 0; } } }