結果
| 問題 | No.593 4進FizzBuzz | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-11-10 22:52:27 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 55 ms / 2,000 ms | 
| コード長 | 415 bytes | 
| コンパイル時間 | 758 ms | 
| コンパイル使用メモリ | 68,336 KB | 
| 実行使用メモリ | 9,728 KB | 
| 最終ジャッジ日時 | 2024-11-24 13:07:47 | 
| 合計ジャッジ時間 | 3,206 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 31 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	string n4;
	cin >> n4;
	auto n4_rev = n4;
	reverse(n4_rev.begin(), n4_rev.end());
	int x = 0;
	for (auto c : n4_rev) {
		x = x * 4 + (c - '0');
		x %= 15;
	}
	string ans = "";
	if (x % 3 == 0) { ans += "Fizz"; }
	if (x % 5 == 0) { ans += "Buzz"; }
	if (ans.empty()) { ans = n4; }
	cout << ans << endl;
	return 0;
}
            
            
            
        