結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
22,836 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 55 ms
20,640 KB
testcase_04 AC 54 ms
22,680 KB
testcase_05 AC 54 ms
20,792 KB
testcase_06 WA -
testcase_07 AC 54 ms
20,680 KB
testcase_08 WA -
testcase_09 AC 54 ms
20,752 KB
testcase_10 WA -
testcase_11 AC 53 ms
20,732 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 318 ms
34,308 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 324 ms
34,492 KB
testcase_20 WA -
testcase_21 AC 316 ms
34,268 KB
testcase_22 AC 323 ms
32,256 KB
testcase_23 AC 313 ms
32,276 KB
testcase_24 AC 314 ms
34,316 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 335 ms
32,328 KB
testcase_28 WA -
testcase_29 AC 324 ms
34,380 KB
testcase_30 WA -
testcase_31 AC 311 ms
30,204 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 322 ms
32,320 KB
権限があれば一括ダウンロードができます

ソースコード

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