結果
問題 |
No.593 4進FizzBuzz
|
ユーザー |
|
提出日時 | 2018-01-23 17:40:17 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,027 bytes |
コンパイル時間 | 1,434 ms |
コンパイル使用メモリ | 103,680 KB |
実行使用メモリ | 28,928 KB |
最終ジャッジ日時 | 2024-12-26 03:10:05 |
合計ジャッジ時間 | 9,608 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 RE * 1 |
other | AC * 16 WA * 13 RE * 2 |
コンパイルメッセージ
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 - 2, 2)); if (LastNum % 11 == 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; } } }