結果
問題 | No.887 Collatz |
ユーザー |
|
提出日時 | 2019-09-21 10:35:06 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 321 bytes |
コンパイル時間 | 499 ms |
コンパイル使用メモリ | 29,440 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-17 11:12:26 |
合計ジャッジ時間 | 2,000 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <stdio.h> int main(void) { int n; int max=0; int count=0; scanf("%d",&n); max=n; while(n>1){ if(max<n) max=n; if(n%2==0){ n/=2; }else{ n=3*n+1; } count++; } printf("%d\n%d\n",count,max); }