結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー mbanmban
提出日時 2017-01-02 05:56:11
言語 C#(csc)
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,235 bytes
コンパイル時間 998 ms
コンパイル使用メモリ 107,996 KB
実行使用メモリ 44,636 KB
平均クエリ数 3.10
最終ジャッジ日時 2024-07-16 12:06:43
合計ジャッジ時間 5,752 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
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