結果

問題 No.593 4進FizzBuzz
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2019-03-19 20:30:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 685 bytes
コンパイル時間 1,139 ms
コンパイル使用メモリ 64,672 KB
実行使用メモリ 9,012 KB
最終ジャッジ日時 2023-10-12 07:14:40
合計ジャッジ時間 4,678 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,368 KB
testcase_02 AC 1 ms
4,368 KB
testcase_03 AC 2 ms
4,368 KB
testcase_04 AC 2 ms
4,368 KB
testcase_05 AC 1 ms
4,368 KB
testcase_06 AC 2 ms
4,368 KB
testcase_07 AC 1 ms
4,372 KB
testcase_08 AC 2 ms
4,372 KB
testcase_09 AC 2 ms
4,368 KB
testcase_10 AC 2 ms
4,372 KB
testcase_11 AC 1 ms
4,368 KB
testcase_12 AC 2 ms
4,372 KB
testcase_13 AC 2 ms
4,368 KB
testcase_14 AC 1 ms
4,372 KB
testcase_15 AC 2 ms
4,372 KB
testcase_16 AC 41 ms
7,504 KB
testcase_17 AC 42 ms
7,128 KB
testcase_18 AC 42 ms
7,692 KB
testcase_19 AC 42 ms
7,500 KB
testcase_20 AC 42 ms
7,172 KB
testcase_21 AC 41 ms
7,772 KB
testcase_22 AC 42 ms
7,116 KB
testcase_23 AC 41 ms
7,924 KB
testcase_24 AC 41 ms
8,032 KB
testcase_25 AC 41 ms
7,032 KB
testcase_26 AC 42 ms
7,872 KB
testcase_27 AC 43 ms
9,012 KB
testcase_28 AC 42 ms
7,356 KB
testcase_29 AC 42 ms
7,868 KB
testcase_30 AC 41 ms
7,496 KB
testcase_31 AC 41 ms
7,768 KB
testcase_32 AC 41 ms
6,948 KB
testcase_33 AC 42 ms
7,760 KB
testcase_34 AC 42 ms
8,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>

using ll = long long;
using namespace std;

const int MOD = 1e9+7;

int main() {
    string N;
    int a,b;
    a = b = 0;
    cin >> N;
    for(int i = 0; i < (int)N.length(); i++)
    {
        a += N[i] - '0';
        if (((int)N.length() - 1 - i) % 2) {
            b -= N[(int)N.length() - 1 - i] - '0';
        }
        else {
            b += N[(int)N.length() - 1 - i] - '0';
        }
    }
    if (a % 3 == 0) {
        cout << "Fizz";
    }
    if (b % 5 == 0) {
        cout << "Buzz";
    }
    if (a % 3 && b % 5) {
        cout << N;
    }
    cout << endl;
    return 0;
}
0