結果

問題 No.593 4進FizzBuzz
ユーザー NoNo
提出日時 2018-01-21 02:46:26
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 526 ms / 2,000 ms
コード長 997 bytes
コンパイル時間 2,076 ms
コンパイル使用メモリ 99,704 KB
実行使用メモリ 36,420 KB
最終ジャッジ日時 2023-08-26 16:34:48
合計ジャッジ時間 16,026 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
20,772 KB
testcase_01 AC 52 ms
20,728 KB
testcase_02 AC 49 ms
20,632 KB
testcase_03 AC 49 ms
20,872 KB
testcase_04 AC 49 ms
22,740 KB
testcase_05 AC 48 ms
20,692 KB
testcase_06 AC 47 ms
20,636 KB
testcase_07 AC 49 ms
22,972 KB
testcase_08 AC 47 ms
22,868 KB
testcase_09 AC 47 ms
20,684 KB
testcase_10 AC 48 ms
20,916 KB
testcase_11 AC 49 ms
20,868 KB
testcase_12 AC 49 ms
20,696 KB
testcase_13 AC 47 ms
20,720 KB
testcase_14 AC 49 ms
20,796 KB
testcase_15 AC 47 ms
22,812 KB
testcase_16 AC 501 ms
32,436 KB
testcase_17 AC 500 ms
32,452 KB
testcase_18 AC 500 ms
32,444 KB
testcase_19 AC 499 ms
32,392 KB
testcase_20 AC 504 ms
34,504 KB
testcase_21 AC 507 ms
32,380 KB
testcase_22 AC 505 ms
34,364 KB
testcase_23 AC 508 ms
32,376 KB
testcase_24 AC 507 ms
32,452 KB
testcase_25 AC 500 ms
34,456 KB
testcase_26 AC 500 ms
32,452 KB
testcase_27 AC 526 ms
32,340 KB
testcase_28 AC 500 ms
34,312 KB
testcase_29 AC 507 ms
34,400 KB
testcase_30 AC 486 ms
36,420 KB
testcase_31 AC 485 ms
32,352 KB
testcase_32 AC 479 ms
34,412 KB
testcase_33 AC 503 ms
32,536 KB
testcase_34 AC 509 ms
34,404 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 y
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            int a = 0;
            int b = 0;
            int c = 0;

            bool f = true;
            foreach (var s in n)
            {
                a += int.Parse(Convert.ToString(s));
                if (f)
                {
                    b += int.Parse(Convert.ToString(s));
                    f = false;
                }
                else
                {
                    c += int.Parse(Convert.ToString(s));
                    f = true;
                }
            }

            string ans = "";
            if (a % 3 == 0)
            {
                ans += "Fizz";
            }
            if ((b - c) % 5 == 0)
            {
                ans += "Buzz";
            }
            if (ans.Length == 0)
            {
                ans = n;
            }
            Console.WriteLine(ans);
        }
    }
}
0