結果

問題 No.207 世界のなんとか
ユーザー ooh_20ooh_20
提出日時 2017-05-08 11:54:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 1,220 bytes
コンパイル時間 4,235 ms
コンパイル使用メモリ 104,700 KB
実行使用メモリ 22,820 KB
最終ジャッジ日時 2023-10-12 18:48:10
合計ジャッジ時間 4,238 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
18,668 KB
testcase_01 AC 56 ms
20,708 KB
testcase_02 AC 58 ms
22,680 KB
testcase_03 AC 57 ms
20,728 KB
testcase_04 AC 57 ms
22,796 KB
testcase_05 AC 57 ms
22,752 KB
testcase_06 AC 57 ms
20,624 KB
testcase_07 AC 57 ms
22,748 KB
testcase_08 AC 58 ms
20,764 KB
testcase_09 AC 57 ms
20,788 KB
testcase_10 AC 57 ms
22,704 KB
testcase_11 AC 58 ms
20,820 KB
testcase_12 AC 58 ms
18,772 KB
testcase_13 AC 58 ms
22,696 KB
testcase_14 AC 58 ms
22,820 KB
testcase_15 AC 57 ms
20,952 KB
testcase_16 AC 58 ms
22,680 KB
testcase_17 AC 57 ms
22,732 KB
testcase_18 AC 56 ms
22,800 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace Lecture5
{
    class Program
    {
        bool isThreeMul(int value)
        {
            return value % 3 == 0;
        }

        bool isThree(int value)
        {
            string number = value.ToString();

            for (int i = 0; i < number.Length; i++)
            {
                if (number[i] == '3')
                {
                    return true;
                }
            }

            return false;
        }

        bool check(int value)
        {
            Program program = new Program();

            if (program.isThreeMul(value) || program.isThree(value))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        static void Main(string[] args)
        {
            Program program = new Program();
            string[] row = Console.ReadLine().Split();
            int A = int.Parse(row[0]);
            int B = int.Parse(row[1]);

            for (int number = A; number <= B; number++)
            {
                if (program.check(number))
                {
                    Console.WriteLine(number);
                }
            }
        }
    }
}
0