結果

問題 No.207 世界のなんとか
ユーザー p_nixp_nix
提出日時 2018-01-23 19:49:21
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 5,000 ms
コード長 1,001 bytes
コンパイル時間 2,153 ms
コンパイル使用メモリ 107,260 KB
実行使用メモリ 23,876 KB
最終ジャッジ日時 2023-08-26 23:52:42
合計ジャッジ時間 4,259 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
23,876 KB
testcase_01 AC 62 ms
21,928 KB
testcase_02 AC 62 ms
21,748 KB
testcase_03 AC 62 ms
21,852 KB
testcase_04 AC 63 ms
21,768 KB
testcase_05 AC 64 ms
23,796 KB
testcase_06 AC 62 ms
19,876 KB
testcase_07 AC 62 ms
21,832 KB
testcase_08 AC 62 ms
21,752 KB
testcase_09 AC 62 ms
21,808 KB
testcase_10 AC 62 ms
21,908 KB
testcase_11 AC 62 ms
21,832 KB
testcase_12 AC 62 ms
21,812 KB
testcase_13 AC 62 ms
23,748 KB
testcase_14 AC 63 ms
21,860 KB
testcase_15 AC 63 ms
19,884 KB
testcase_16 AC 63 ms
21,776 KB
testcase_17 AC 62 ms
21,856 KB
testcase_18 AC 60 ms
21,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