結果
問題 |
No.593 4進FizzBuzz
|
ユーザー |
|
提出日時 | 2018-01-23 17:28:39 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,026 bytes |
コンパイル時間 | 4,351 ms |
コンパイル使用メモリ | 102,144 KB |
実行使用メモリ | 28,928 KB |
最終ジャッジ日時 | 2024-12-26 03:08:02 |
合計ジャッジ時間 | 11,518 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 15 WA * 16 |
コンパイルメッセージ
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.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; namespace _4FizzBuzz { class Program { static void Main() { string InputNum = Console.ReadLine(); Console.WriteLine(IsFizzBuzz(InputNum)); } public static bool IsModThree(string InputNum) { int PlusNum = 0; foreach (var Num in InputNum) PlusNum += Convert.ToInt32(Num.ToString()); if (PlusNum % 3 == 0) return true; else return false; } public static bool IsModFive(string InputNum) { int LastNum = Convert.ToInt32(InputNum.Substring(InputNum.Length - 1, 1)); if (LastNum % 5 == 0) return true; else return false; } public static string IsFizzBuzz(string InputNum) { bool IsThree = IsModThree(InputNum); bool IsFive = IsModFive(InputNum); if (IsThree && IsFive) return "FizzBuzz"; if (IsThree) return "Fizz"; if (IsFive) return "Buzz"; return InputNum; } } }