結果
| 問題 | No.593 4進FizzBuzz | 
| コンテスト | |
| ユーザー |  No | 
| 提出日時 | 2018-01-21 02:46:26 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 550 ms / 2,000 ms | 
| コード長 | 997 bytes | 
| コンパイル時間 | 789 ms | 
| コンパイル使用メモリ | 103,808 KB | 
| 実行使用メモリ | 28,928 KB | 
| 最終ジャッジ日時 | 2024-12-25 15:29:04 | 
| 合計ジャッジ時間 | 12,858 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 31 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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);
        }
    }
}
            
            
            
        