結果
| 問題 |
No.593 4進FizzBuzz
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-03 07:44:23 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 2,000 ms |
| コード長 | 794 bytes |
| コンパイル時間 | 769 ms |
| コンパイル使用メモリ | 103,296 KB |
| 実行使用メモリ | 24,320 KB |
| 最終ジャッジ日時 | 2024-10-14 13:46:56 |
| 合計ジャッジ時間 | 4,021 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
using System.Numerics;
public class prog{
public static void Main(){
string line = Console.ReadLine();
// BigInteger num = new BigInteger(line);
int odd = 0;
int even = 0;
for (int i = 0; i < line.Length; ++i){
int c = line[i] - '0';
if (i%2 == 1) odd += c;
else even += c;
}
bool div5 = (odd - even) % 5 == 0;
bool div3 = (odd + even) % 3 == 0;
if (div5 && div3){
Console.WriteLine("FizzBuzz");
}else if (div5){
Console.WriteLine("Buzz");
}else if (div3){
Console.WriteLine("Fizz");
}else{
Console.WriteLine(line);
}
}
}