結果
| 問題 | No.593 4進FizzBuzz |
| コンテスト | |
| ユーザー |
No
|
| 提出日時 | 2018-01-21 02:46:26 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 337 ms / 2,000 ms |
| コード長 | 997 bytes |
| 記録 | |
| コンパイル時間 | 1,748 ms |
| コンパイル使用メモリ | 104,192 KB |
| 実行使用メモリ | 29,696 KB |
| 最終ジャッジ日時 | 2026-05-31 08:13:51 |
| 合計ジャッジ時間 | 9,191 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace y
{
class Program
{
static void Main(string[] args)
{
string n = Console.ReadLine();
int a = 0;
int b = 0;
int c = 0;
bool f = true;
foreach (var s in n)
{
a += int.Parse(Convert.ToString(s));
if (f)
{
b += int.Parse(Convert.ToString(s));
f = false;
}
else
{
c += int.Parse(Convert.ToString(s));
f = true;
}
}
string ans = "";
if (a % 3 == 0)
{
ans += "Fizz";
}
if ((b - c) % 5 == 0)
{
ans += "Buzz";
}
if (ans.Length == 0)
{
ans = n;
}
Console.WriteLine(ans);
}
}
}
No