結果
| 問題 | 
                            No.887 Collatz
                             | 
                    
| コンテスト | |
| ユーザー | 
                             michonz4
                         | 
                    
| 提出日時 | 2019-12-06 09:46:05 | 
| 言語 | C  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 243 bytes | 
| コンパイル時間 | 215 ms | 
| コンパイル使用メモリ | 28,928 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-23 05:02:20 | 
| 合計ジャッジ時間 | 1,174 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 28 | 
ソースコード
#include <stdio.h>
int main(void) {
  int n;
  scanf("%d", &n);
  int i=0, max=n;
  while (n>1) {
    if (n%2==0) {
      n/=2;
    } else {
      n=3*n+1;
    }
    if (n>max) max=n;
    i++;
  }
  printf("%d\n%d\n", i, max);
  return 0;
}
            
            
            
        
            
michonz4