結果

問題 No.593 4進FizzBuzz
ユーザー PE11PE11
提出日時 2018-01-23 17:40:17
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,027 bytes
コンパイル時間 2,165 ms
コンパイル使用メモリ 102,340 KB
実行使用メモリ 36,372 KB
最終ジャッジ日時 2023-08-26 23:27:41
合計ジャッジ時間 11,519 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 54 ms
22,744 KB
testcase_02 AC 53 ms
20,764 KB
testcase_03 WA -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 54 ms
20,648 KB
testcase_07 AC 54 ms
20,832 KB
testcase_08 AC 55 ms
20,680 KB
testcase_09 AC 54 ms
20,712 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 55 ms
22,732 KB
testcase_15 WA -
testcase_16 AC 319 ms
34,388 KB
testcase_17 WA -
testcase_18 AC 322 ms
32,364 KB
testcase_19 AC 325 ms
34,252 KB
testcase_20 WA -
testcase_21 AC 322 ms
32,256 KB
testcase_22 AC 323 ms
34,400 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 325 ms
36,372 KB
testcase_27 AC 324 ms
32,416 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 313 ms
34,552 KB
testcase_31 WA -
testcase_32 AC 315 ms
34,328 KB
testcase_33 AC 328 ms
32,284 KB
testcase_34 AC 324 ms
32,344 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 - 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;
		}

	}


}
0