結果

問題 No.593 4進FizzBuzz
ユーザー rogi52rogi52
提出日時 2022-10-01 04:26:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 1,943 ms
コンパイル使用メモリ 201,328 KB
実行使用メモリ 7,020 KB
最終ジャッジ日時 2023-08-24 21:49:00
合計ジャッジ時間 6,153 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 10 ms
5,080 KB
testcase_17 AC 10 ms
5,188 KB
testcase_18 AC 10 ms
5,072 KB
testcase_19 AC 13 ms
6,976 KB
testcase_20 AC 11 ms
5,076 KB
testcase_21 AC 10 ms
5,080 KB
testcase_22 AC 13 ms
6,924 KB
testcase_23 AC 10 ms
5,200 KB
testcase_24 AC 11 ms
5,144 KB
testcase_25 AC 11 ms
5,188 KB
testcase_26 AC 12 ms
7,020 KB
testcase_27 AC 13 ms
7,016 KB
testcase_28 AC 10 ms
5,072 KB
testcase_29 AC 12 ms
6,912 KB
testcase_30 AC 11 ms
5,064 KB
testcase_31 AC 10 ms
5,188 KB
testcase_32 AC 11 ms
5,088 KB
testcase_33 AC 13 ms
6,912 KB
testcase_34 AC 11 ms
5,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    string s; cin >> s;
    string ans = "";
    int sumA = 0;
    for(char c : s) sumA += c - '0';
    if(sumA % 3 == 0) ans += "Fizz";

    int n = int(s.size());
    int sumB = 0;
    for(int i = n - 1; i >= 0; i--) {
        sumB += (s[i] - '0') * ((n - i) % 2 == 0 ? -1 : +1);
    }
    if(sumB % 5 == 0) ans += "Buzz";

    if(ans.empty()) ans = s;
    cout << ans << "\n";
}
0