結果
| 問題 |
No.887 Collatz
|
| コンテスト | |
| ユーザー |
syunsuke
|
| 提出日時 | 2019-09-22 14:59:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 435 bytes |
| コンパイル時間 | 408 ms |
| コンパイル使用メモリ | 54,268 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 03:36:21 |
| 合計ジャッジ時間 | 1,263 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include <iostream>
using namespace std;
int main(void){
// Your code here!
long long int N,M;
cin>>N;
int ans;
ans=0;
M=N;
for(int i=0;i<10000000;i++){
if(N==1){
cout<<i<<endl;
cout<<M<<endl;
return 0;
}
if(N%2==0){
N/=2;
}else{
N=(N*3+1);
if(N>M){
M=N;
}
}
}
}
syunsuke