結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー kmtrc130
提出日時 2019-03-15 13:07:35
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 29 ms / 1,000 ms
コード長 810 bytes
コンパイル時間 874 ms
コンパイル使用メモリ 105,472 KB
実行使用メモリ 19,072 KB
最終ジャッジ日時 2024-06-28 18:58:17
合計ジャッジ時間 2,677 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

class Program
{
    public void Solve()
    {
        List<int> a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        int count = 0;
        foreach (var N in a)
        {
            if (N % 15 == 0)
            {
                count += "FizzBuzz".Count();
            }
            else if (N % 3 == 0)
            {
                count += "Fizz".Count();
            }
            else if (N % 5 == 0)
            {
                count += "Buzz".Count();
            }
            else
            {
                count += N.ToString().Count();
            }
        }
        Console.WriteLine(count);
    }

    static void Main()
    {
        var solver = new Program();
        solver.Solve();
    }
}
0