結果

問題 No.593 4進FizzBuzz
ユーザー バカらっくバカらっく
提出日時 2017-11-10 23:34:06
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 2,098 bytes
コンパイル時間 1,174 ms
コンパイル使用メモリ 109,568 KB
実行使用メモリ 64,580 KB
最終ジャッジ日時 2024-05-03 14:42:12
合計ジャッジ時間 5,430 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
24,448 KB
testcase_01 AC 25 ms
18,944 KB
testcase_02 AC 25 ms
18,688 KB
testcase_03 AC 25 ms
18,816 KB
testcase_04 AC 28 ms
18,944 KB
testcase_05 AC 26 ms
18,560 KB
testcase_06 AC 26 ms
18,816 KB
testcase_07 AC 26 ms
18,816 KB
testcase_08 AC 28 ms
18,688 KB
testcase_09 AC 27 ms
18,944 KB
testcase_10 AC 25 ms
18,944 KB
testcase_11 AC 26 ms
18,816 KB
testcase_12 AC 26 ms
18,560 KB
testcase_13 AC 25 ms
18,688 KB
testcase_14 AC 25 ms
18,560 KB
testcase_15 AC 26 ms
18,816 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        String inpt = Reader.ReadLine();

        int[] list = inpt.Select(a => int.Parse(a.ToString())).ToArray();

        string ans = "";
        if(list.Sum() % 3 == 0) {
            ans = "Fizz";
        }
        if(CanBuzz(inpt)) {
            ans += "Buzz";
        }
        if(ans.Length == 0) {
            ans = inpt.ToString();
        }

        Console.WriteLine(ans);
        
    }

    private bool CanBuzz(string input) {
        if(input.Length == 1 && input[0] == '0') {
            return true;
        }
        string tmp = input;
        while(tmp.Length > 11) {
            long num = long.Parse(tmp.Substring(0, 11));
            num = num % 11;
            tmp = num + tmp.Substring(11);
        }
        if(tmp.Length == 0) {
            return true;
        }
        return long.Parse(tmp) % 11 == 0;
    }

    private int ToDec(int num) {
        int ans = 0;
        if(num == 0) {
            return 0;
        }
        int[] tmp = num.ToString().Select(a => int.Parse(a.ToString())).Reverse().ToArray();
        ans += tmp[0];
        int mul = 4;
        for (int i = 1; i < tmp.Length; i++) {
            ans += mul * tmp[i];
            mul = mul * 4;
        }
        return ans;


    }





    public class Reader
    {
        private static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"

55

";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}
0