結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー sekiya9311sekiya9311
提出日時 2017-10-01 21:53:46
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 2,600 bytes
コンパイル時間 2,848 ms
コンパイル使用メモリ 105,168 KB
実行使用メモリ 39,212 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-24 01:33:34
合計ジャッジ時間 6,152 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
37,172 KB
testcase_01 AC 88 ms
36,988 KB
testcase_02 AC 93 ms
38,764 KB
testcase_03 AC 89 ms
38,576 KB
testcase_04 AC 85 ms
38,660 KB
testcase_05 AC 90 ms
39,092 KB
testcase_06 AC 87 ms
34,916 KB
testcase_07 AC 89 ms
38,492 KB
testcase_08 AC 86 ms
37,072 KB
testcase_09 AC 88 ms
37,060 KB
testcase_10 AC 86 ms
34,888 KB
testcase_11 AC 86 ms
38,800 KB
testcase_12 AC 86 ms
38,788 KB
testcase_13 AC 87 ms
39,160 KB
testcase_14 AC 87 ms
38,648 KB
testcase_15 AC 88 ms
36,768 KB
testcase_16 AC 86 ms
39,212 KB
testcase_17 AC 85 ms
36,536 KB
testcase_18 AC 92 ms
38,540 KB
testcase_19 AC 85 ms
36,668 KB
testcase_20 AC 84 ms
39,000 KB
testcase_21 AC 87 ms
38,968 KB
testcase_22 AC 83 ms
36,804 KB
testcase_23 AC 86 ms
35,084 KB
testcase_24 AC 85 ms
36,892 KB
testcase_25 AC 88 ms
38,656 KB
testcase_26 AC 89 ms
36,404 KB
testcase_27 AC 88 ms
36,820 KB
testcase_28 AC 85 ms
36,616 KB
testcase_29 AC 88 ms
37,020 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.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProgrammingContest
{
    class MainClass
    {
        Scanner sc;
        static void Main(string[] args)
        {
            new MainClass().Solve();
        }

        const bool DEBUG = false;   // TODO: must check!!
        void Solve()
        {
            if (DEBUG)
            {
                string backPath = "..";
                char dirSep = System.IO.Path.DirectorySeparatorChar;
                string inFilePath = backPath + dirSep + backPath + dirSep + "in.txt";
                sc = new Scanner(new System.IO.StreamReader(inFilePath));
            }
            else
            {
                sc = new Scanner();
            }
            int n = sc.NextInt;
            int k = sc.NextInt;
            int getVal;
            int nowVal = (n - 1) % (k + 1);
            Console.WriteLine(nowVal);
            while ((getVal = sc.NextInt) < n)
            {
                nowVal += k + 1;
                Console.WriteLine(nowVal);
                Console.Out.Flush();
            }
        }
    }

    class Scanner
    {
        Queue<String> buffer;
        char[] sep;
        System.IO.TextReader reader;
        public Scanner(System.IO.TextReader reader = null)
        {
            this.buffer = new Queue<string>();
            this.sep = new char[] { ' ' };
            this.reader = (reader ?? Console.In);
        }
        private void CheckBuffer()
        {
            if (this.buffer.Count == 0)
            {
                String[] sreArray = this.reader.ReadLine().Split(this.sep);
                foreach (String elStr in sreArray)
                {
                    this.buffer.Enqueue(elStr);
                }
            }
        }

        public String Next
        {
            get
            {
                this.CheckBuffer();
                return this.buffer.Dequeue();
            }
        }

        public int NextInt
        {
            get
            {
                return int.Parse(this.Next);
            }
        }
        public double NextDouble
        {
            get
            {
                return double.Parse(this.Next);
            }
        }

        public long NextLong
        {
            get
            {
                return long.Parse(this.Next);
            }
        }
        public bool IsEmpty
        {
            get
            {
                this.CheckBuffer();
                return this.buffer.Count == 0;
            }
        }
    }
}
0