結果

問題 No.593 4進FizzBuzz
ユーザー PE11PE11
提出日時 2018-01-23 17:28:39
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,026 bytes
コンパイル時間 2,926 ms
コンパイル使用メモリ 99,640 KB
実行使用メモリ 36,628 KB
最終ジャッジ日時 2023-08-26 23:25:49
合計ジャッジ時間 12,296 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
22,944 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 56 ms
20,712 KB
testcase_04 AC 57 ms
22,880 KB
testcase_05 AC 55 ms
20,820 KB
testcase_06 WA -
testcase_07 AC 57 ms
20,928 KB
testcase_08 WA -
testcase_09 AC 57 ms
20,820 KB
testcase_10 WA -
testcase_11 AC 56 ms
18,812 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 323 ms
34,372 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 327 ms
34,436 KB
testcase_20 WA -
testcase_21 AC 320 ms
34,600 KB
testcase_22 AC 330 ms
32,436 KB
testcase_23 AC 322 ms
34,440 KB
testcase_24 AC 324 ms
34,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 328 ms
34,376 KB
testcase_28 WA -
testcase_29 AC 327 ms
32,488 KB
testcase_30 WA -
testcase_31 AC 317 ms
34,468 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 324 ms
32,324 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
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;
		}

	}


}
0