結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー mbanmban
提出日時 2017-01-02 05:57:15
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 1,219 bytes
コンパイル時間 2,650 ms
コンパイル使用メモリ 97,852 KB
実行使用メモリ 39,020 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-24 00:49:15
合計ジャッジ時間 7,033 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
36,540 KB
testcase_01 AC 84 ms
36,888 KB
testcase_02 AC 84 ms
36,336 KB
testcase_03 AC 87 ms
39,020 KB
testcase_04 AC 88 ms
38,404 KB
testcase_05 AC 84 ms
34,780 KB
testcase_06 AC 86 ms
38,456 KB
testcase_07 AC 86 ms
37,000 KB
testcase_08 AC 85 ms
38,200 KB
testcase_09 AC 85 ms
38,664 KB
testcase_10 AC 84 ms
36,320 KB
testcase_11 AC 85 ms
36,472 KB
testcase_12 AC 87 ms
36,356 KB
testcase_13 AC 89 ms
36,588 KB
testcase_14 AC 85 ms
38,796 KB
testcase_15 AC 87 ms
38,996 KB
testcase_16 AC 84 ms
36,632 KB
testcase_17 AC 85 ms
36,296 KB
testcase_18 AC 84 ms
36,880 KB
testcase_19 AC 86 ms
34,924 KB
testcase_20 AC 86 ms
38,436 KB
testcase_21 AC 85 ms
36,732 KB
testcase_22 AC 84 ms
36,448 KB
testcase_23 AC 86 ms
36,380 KB
testcase_24 AC 83 ms
38,708 KB
testcase_25 AC 84 ms
38,208 KB
testcase_26 AC 85 ms
36,800 KB
testcase_27 AC 85 ms
36,668 KB
testcase_28 AC 89 ms
36,940 KB
testcase_29 AC 88 ms
38,820 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;


class Magatro
{
    static void Main()
    {
        int N, K;
        string[] S = Console.ReadLine().Split(' ');
        N = int.Parse(S[0]);
        K = int.Parse(S[1]);
        int T = 0;
        if (N % (K + 1) == 1)
        {
            Console.WriteLine(0);
        }
        else
        {
            int Q = N % (K + 1);
            if (Q == 0)
            {
                Console.WriteLine(K);
                T += K;
            }
            else
            {
                Console.WriteLine(Q - 1);
                T += Q - 1;
            }
        }
        while (true)
        {
            int R = int.Parse(Console.ReadLine());
            if (R >= N)
            {
                return;
            }
            T = R;
            int Q = (N-T) % (K + 1);
            if (Q == 0)
            {
                T += K;
                Console.WriteLine(T);
            }
            else
            {
                T += Q - 1;
                Console.WriteLine(T);
            }
        }
    }
}

0