結果

問題 No.593 4進FizzBuzz
ユーザー PE11PE11
提出日時 2018-01-23 17:22:12
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,010 bytes
コンパイル時間 2,558 ms
コンパイル使用メモリ 103,244 KB
実行使用メモリ 37,152 KB
最終ジャッジ日時 2023-08-26 23:23:06
合計ジャッジ時間 11,931 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
21,556 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 56 ms
23,368 KB
testcase_04 AC 56 ms
21,388 KB
testcase_05 AC 56 ms
21,376 KB
testcase_06 WA -
testcase_07 AC 57 ms
23,452 KB
testcase_08 WA -
testcase_09 AC 57 ms
23,516 KB
testcase_10 WA -
testcase_11 AC 57 ms
23,468 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 336 ms
33,136 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 346 ms
35,116 KB
testcase_20 WA -
testcase_21 AC 340 ms
35,160 KB
testcase_22 AC 344 ms
33,208 KB
testcase_23 AC 336 ms
33,040 KB
testcase_24 AC 336 ms
35,136 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 346 ms
35,184 KB
testcase_28 WA -
testcase_29 AC 344 ms
35,136 KB
testcase_30 WA -
testcase_31 AC 333 ms
35,112 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 343 ms
35,168 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.Last().ToString());

			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