結果
| 問題 | 
                            No.887 Collatz
                             | 
                    
| コンテスト | |
| ユーザー | 
                             bluemegane
                         | 
                    
| 提出日時 | 2021-04-18 10:52:00 | 
| 言語 | C#(csc)  (csc 3.9.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 638 bytes | 
| コンパイル時間 | 712 ms | 
| コンパイル使用メモリ | 103,296 KB | 
| 実行使用メモリ | 17,792 KB | 
| 最終ジャッジ日時 | 2024-07-04 04:25:32 | 
| 合計ジャッジ時間 | 2,204 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 26 WA * 2 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using static System.Math;
using System;
public class Hello
{
    static void Main()
    {
        var n0 = int.Parse(Console.ReadLine().Trim());
        getAns(n0);
    }
    static void getAns (int n0)
    {
        var p = 0;
        var nmax = n0;
        var i1 = 1000;
        while ( p++ < 400)
        {
            if (n0 % 2 == 0)
            {
                n0 /= 2;
                if (n0 == 1) i1 = Min(i1, p);
            }
            else
            {
                n0 = 3 * n0 + 1;
                nmax = Max(nmax, n0);
            }
        }
        Console.WriteLine(i1);
        Console.WriteLine(nmax);
    }
}
            
            
            
        
            
bluemegane