結果
問題 |
No.887 Collatz
|
ユーザー |
![]() |
提出日時 | 2020-02-06 12:04:40 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 454 bytes |
コンパイル時間 | 991 ms |
コンパイル使用メモリ | 108,640 KB |
実行使用メモリ | 25,928 KB |
最終ジャッジ日時 | 2024-09-25 06:41:55 |
合計ジャッジ時間 | 2,777 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 1 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; using System.Collections.Generic; static class NagataKanaIsAGenius { public static void Main() { int n=int.Parse(Console.ReadLine()); int counter=0,max=n; while(true){ counter++; if(n%2==1)n=3*n+1; else n/=2; max=Math.Max(max,n); if(n==1)break; } Console.WriteLine(counter); Console.WriteLine(max); } }