結果
問題 |
No.637 X: Yet Another FizzBuzz Problem
|
ユーザー |
![]() |
提出日時 | 2018-01-31 07:44:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 1,000 ms |
コード長 | 1,511 bytes |
コンパイル時間 | 809 ms |
コンパイル使用メモリ | 108,032 KB |
実行使用メモリ | 19,072 KB |
最終ジャッジ日時 | 2024-06-28 18:52:30 |
合計ジャッジ時間 | 2,420 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.
ソースコード
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; using System.IO; using System.Diagnostics; class Scanner { private readonly char Separator = ' '; private int Index = 0; private string[] Line = new string[0]; public string Next() { if (Index >= Line.Length) { Line = Console.ReadLine().Split(Separator); Index = 0; } var ret = Line[Index]; Index++; return ret; } public int NextInt() { return int.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } } class Program { public void Solve() { var a = Console.ReadLine().Split(' '); var fizzbuzz = a.Select(s => { int i = int.Parse(s); if (i % 15 == 0) { return "FizzBuzz"; } else if (i % 3 == 0) { return "Fizz"; } else if (i % 5 == 0) { return "Buzz"; } else { return s; } }).ToArray(); Console.WriteLine(fizzbuzz.Sum(s => s.Length)); } private bool TwoPow(long n) { return (n & (n - 1)) == 0; } static public void Main() { new Program().Solve(); } }