結果
| 問題 |
No.887 Collatz
|
| ユーザー |
stone_725
|
| 提出日時 | 2019-12-01 08:39:46 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 305 bytes |
| コンパイル時間 | 765 ms |
| コンパイル使用メモリ | 129,064 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-30 15:41:38 |
| 合計ジャッジ時間 | 1,727 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 6 WA * 22 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n, nmax;
cin >> n;
nmax = n;
int i = 0;
while(n != 1){
if(n % 2){
n = 3 * n + 1;
}else{
n /= 2;
}
i++;
}
cout << i << "\n" << nmax << "\n";
}
stone_725