結果

問題 No.1114 足し算盆に返らず
ユーザー Lily89164763Lily89164763
提出日時 2020-07-17 21:41:55
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 2,255 bytes
コンパイル時間 2,793 ms
コンパイル使用メモリ 103,480 KB
実行使用メモリ 23,840 KB
最終ジャッジ日時 2023-08-20 00:17:05
合計ジャッジ時間 10,545 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
21,944 KB
testcase_01 AC 73 ms
21,784 KB
testcase_02 AC 73 ms
21,900 KB
testcase_03 AC 71 ms
19,660 KB
testcase_04 AC 73 ms
21,676 KB
testcase_05 AC 67 ms
21,032 KB
testcase_06 AC 72 ms
19,880 KB
testcase_07 AC 72 ms
23,736 KB
testcase_08 AC 68 ms
23,044 KB
testcase_09 AC 66 ms
23,040 KB
testcase_10 AC 67 ms
21,116 KB
testcase_11 AC 59 ms
22,736 KB
testcase_12 AC 68 ms
21,440 KB
testcase_13 AC 74 ms
23,840 KB
testcase_14 AC 61 ms
22,780 KB
testcase_15 AC 64 ms
20,884 KB
testcase_16 AC 68 ms
20,972 KB
testcase_17 AC 69 ms
23,508 KB
testcase_18 AC 63 ms
18,644 KB
testcase_19 AC 64 ms
21,072 KB
testcase_20 AC 74 ms
21,888 KB
testcase_21 AC 65 ms
20,948 KB
testcase_22 AC 55 ms
22,768 KB
testcase_23 AC 55 ms
22,636 KB
testcase_24 AC 58 ms
20,784 KB
testcase_25 AC 57 ms
20,632 KB
testcase_26 AC 57 ms
22,628 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 CompLib.Util;

public class Program
{
    private int N;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();

        if (N <= 2)
        {
            Console.WriteLine(1);
            return;
        }

        var ans = new List<int>();
        for (int i = 1; i <= N; i += 2)
        {
            ans.Add(i);
        }

        ans.Sort();
        Console.WriteLine(string.Join(" ", ans));
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}
0