結果
問題 |
No.887 Collatz
|
ユーザー |
![]() |
提出日時 | 2019-09-20 21:23:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 375 bytes |
コンパイル時間 | 1,517 ms |
コンパイル使用メモリ | 165,640 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 16:09:10 |
合計ジャッジ時間 | 2,425 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 1 |
ソースコード
#include<bits/stdc++.h> #define int long long using namespace std; signed main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin>>N; int Max=N; for(int i=1;;i++){ if(N%2==0) N/=2; else N=3*N+1; Max=max(Max,N); if(N==1){ cout<<i<<endl; cout<<Max<<endl; return 0; } } }