結果
問題 |
No.887 Collatz
|
ユーザー |
|
提出日時 | 2019-09-20 21:33:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 687 bytes |
コンパイル時間 | 693 ms |
コンパイル使用メモリ | 89,000 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-14 16:37:18 |
合計ジャッジ時間 | 1,679 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 1 |
ソースコード
#include <iostream> #include <cstdio> #include <cstdlib> #include <string> #include <cstring> #include <cstdint> #include <vector> #include <algorithm> #include <cmath> #include<iomanip> #include <unordered_map> #include <map> using namespace std; static const long long MOD = 1000000007LL; typedef long long ll; unordered_map <string,int> ump; int main() { int n0; cin>>n0; int n=n0; if(n0==1) {cout<<0<<endl; n=4;} else { int cnt=0; while(n0!=1) { if(n0%2==0) n0/=2; else n0=n0*3+1; if(n<n0) n=n0; cnt++; } cout<<cnt<<endl; } cout<<n<<endl; return 0; }