結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー mbanmban
提出日時 2017-01-02 05:56:11
言語 C#(csc)
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,235 bytes
コンパイル時間 4,699 ms
コンパイル使用メモリ 101,180 KB
実行使用メモリ 40,352 KB
平均クエリ数 3.10
最終ジャッジ日時 2023-09-23 12:29:37
合計ジャッジ時間 8,181 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 88 ms
37,172 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 89 ms
38,648 KB
testcase_06 AC 92 ms
36,420 KB
testcase_07 AC 86 ms
36,616 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 90 ms
36,504 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
            N -= R;
            int Q = N % (K + 1);
            if (Q == 0)
            {
                T += K;
                Console.WriteLine(T);
            }
            else
            {
                T += Q - 1;
                Console.WriteLine(T);
            }
        }
    }
}

0