結果

問題 No.207 世界のなんとか
ユーザー p_nixp_nix
提出日時 2018-01-23 19:47:30
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,002 bytes
コンパイル時間 2,774 ms
コンパイル使用メモリ 103,608 KB
実行使用メモリ 23,948 KB
最終ジャッジ日時 2023-08-26 23:52:37
合計ジャッジ時間 4,409 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,816 KB
testcase_01 AC 62 ms
21,908 KB
testcase_02 AC 63 ms
21,856 KB
testcase_03 AC 62 ms
21,844 KB
testcase_04 AC 62 ms
19,792 KB
testcase_05 AC 64 ms
21,856 KB
testcase_06 AC 62 ms
23,732 KB
testcase_07 AC 62 ms
21,712 KB
testcase_08 AC 62 ms
21,848 KB
testcase_09 AC 62 ms
23,816 KB
testcase_10 AC 63 ms
21,708 KB
testcase_11 AC 63 ms
21,736 KB
testcase_12 AC 66 ms
23,924 KB
testcase_13 AC 63 ms
21,800 KB
testcase_14 AC 63 ms
21,756 KB
testcase_15 AC 62 ms
21,812 KB
testcase_16 AC 62 ms
23,948 KB
testcase_17 WA -
testcase_18 AC 59 ms
23,828 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;

namespace prob207
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            if ((a[1]-a[0])<=0 || (a[1]-a[0]>100))
            {
                Environment.Exit(0);
            }
            for (long i = a[0]; i < a[1]+1; i++)
            {
                Check(i);
            }
        }

        private static void Check(long i)
        {
            long c = i;
            List<int> b = new List<int>();
            while (i>0)
            {
                b.Add((int)(i % 10));
                i = i / 10;
            }
            // 3の倍数かの判定
            if (b.Sum() % 3 == 0)
            {
                Console.WriteLine(c);
            }
            // 3のつく数か
            else if (b.Contains(3))
            {
                Console.WriteLine(c);
            }
        }
    }
}
0