結果
| 問題 | 
                            No.887 Collatz
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-10-14 17:49:18 | 
| 言語 | C#(csc)  (csc 3.9.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,352 bytes | 
| コンパイル時間 | 939 ms | 
| コンパイル使用メモリ | 109,828 KB | 
| 実行使用メモリ | 28,476 KB | 
| 最終ジャッジ日時 | 2024-12-24 05:56:05 | 
| 合計ジャッジ時間 | 3,021 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace yukicoder
{
    public class IO
    {
        public static string ReadStr() => Console.ReadLine();
        public static string[] ReadStrArr() => ReadStr().Split(' ');
        public static int ReadInt() => int.Parse(ReadStr());
        public static int[] ReadIntArr() => Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        public static double ReadDouble() => double.Parse(ReadStr());
        public static double[] ReadDoubleArr() => Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);
        public static long ReadLong() => long.Parse(ReadStr());
        public static long[] ReadLongArr() => Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        public static void Cout<T>(T value) => Console.WriteLine(value);
    }
    class Program
    {
        static void Main(string[] args)
        {
            int init = IO.ReadInt();
            var data = new long[400];
            data[0] = init;
            for (var i = 1; i < 400; i++)
            {
                data[i] = (data[i-1] % 2 == 0) ? data[i-1] / 2 : 3 * (data[i - 1]) + 1;
            }
            IO.Cout(Array.IndexOf(data, 1));
            IO.Cout(data.Max());
            return;
        }
    }
}