結果

問題 No.593 4進FizzBuzz
ユーザー Konton7Konton7
提出日時 2020-01-13 20:18:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 588 bytes
コンパイル時間 1,968 ms
コンパイル使用メモリ 199,152 KB
実行使用メモリ 8,860 KB
最終ジャッジ日時 2023-08-23 12:44:19
合計ジャッジ時間 5,290 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 42 ms
7,944 KB
testcase_17 WA -
testcase_18 AC 42 ms
7,044 KB
testcase_19 AC 43 ms
7,376 KB
testcase_20 WA -
testcase_21 AC 42 ms
7,800 KB
testcase_22 AC 42 ms
7,512 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 43 ms
7,832 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 43 ms
8,628 KB
testcase_30 AC 41 ms
7,696 KB
testcase_31 AC 41 ms
7,324 KB
testcase_32 AC 41 ms
7,652 KB
testcase_33 AC 42 ms
7,572 KB
testcase_34 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:23:34: 警告: ‘c’ may be used uninitialized [-Wmaybe-uninitialized]
   23 |     if ( (a - b)  % 11 == 0 && c % 3 == 0 )
      |                                ~~^~~
main.cpp:10:15: 備考: ‘c’ はここで定義されています
   10 |     int a, b, c;
      |               ^

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
    
    string s;
    cin >> s;
    int a, b, c;
    a = b = 0;
    int n = s.size();
    
    for (int i = 0; i < n; i++){
        c += s[i] - '0';
        if ((i - '0') % 2 == 0)
            a += s[i] - '0';
        else
            b += s[i] - '0';
    }
    
    string ans = s;
    if ( (a - b)  % 11 == 0 && c % 3 == 0 )
        ans = "FizzBuzz";
    else if ((a - b)  % 11 == 0)
        ans = "Buzz";
    else if (c % 3 == 0)
        ans = "Fizz";
    
    cout << ans << endl;
    return 0;
    
}
0