結果

問題 No.112 ややこしい鶴亀算
ユーザー AdamantiteAdamantite
提出日時 2023-06-28 20:30:57
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 1,008 bytes
コンパイル時間 15,204 ms
コンパイル使用メモリ 144,280 KB
実行使用メモリ 163,444 KB
最終ジャッジ日時 2023-09-19 00:58:05
合計ジャッジ時間 18,499 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
28,128 KB
testcase_01 AC 51 ms
27,948 KB
testcase_02 AC 52 ms
28,020 KB
testcase_03 AC 50 ms
27,912 KB
testcase_04 AC 50 ms
27,996 KB
testcase_05 AC 50 ms
28,052 KB
testcase_06 AC 50 ms
28,040 KB
testcase_07 AC 50 ms
28,208 KB
testcase_08 AC 51 ms
27,984 KB
testcase_09 AC 50 ms
30,104 KB
testcase_10 AC 50 ms
28,088 KB
testcase_11 AC 49 ms
27,944 KB
testcase_12 AC 50 ms
27,948 KB
testcase_13 AC 52 ms
30,324 KB
testcase_14 AC 50 ms
29,880 KB
testcase_15 AC 50 ms
27,948 KB
testcase_16 AC 50 ms
28,004 KB
testcase_17 AC 50 ms
28,020 KB
testcase_18 AC 50 ms
28,092 KB
testcase_19 AC 50 ms
29,904 KB
testcase_20 AC 50 ms
28,128 KB
testcase_21 AC 51 ms
28,120 KB
testcase_22 AC 50 ms
30,036 KB
testcase_23 AC 50 ms
28,168 KB
testcase_24 AC 50 ms
163,444 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 143 ms).
.NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f
Copyright (C) Microsoft Corporation.All rights reserved.

  プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください
  main -> /home/judge/data/code/bin/Release/net6.0/main.dll
  main -> /home/judge/data/code/bin/Release/net6.0/publish/

ソースコード

diff #

using System;

namespace No112_ComplicatedTsurukameCalculation
{
    internal class Program
    {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            int[] array = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));
            int total = array[0];
            bool flg = true;
            for(int i = 1; i < n; i++) {
                if(array[i] != total) {
                    if(array[i] < total) {
                        total += 2;
                    } else {
                        total += 4;
                    }
                    flg = false;
                    break;
                }
            }
            if(flg) {
                if(total == 2 * (n - 1)) {
                    total += 2;
                } else {
                    total += 4;
                }
            }
            int diff = (total - 2 * n) / 2;
            Console.WriteLine(string.Format("{0} {1}", n - diff, diff));
        }
    }
}
0