結果

問題 No.593 4進FizzBuzz
ユーザー Konton7Konton7
提出日時 2020-01-13 20:16:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 198,888 KB
実行使用メモリ 8,944 KB
最終ジャッジ日時 2023-08-23 12:43:06
合計ジャッジ時間 5,469 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 43 ms
8,748 KB
testcase_17 WA -
testcase_18 AC 41 ms
8,244 KB
testcase_19 AC 41 ms
7,148 KB
testcase_20 WA -
testcase_21 AC 42 ms
8,944 KB
testcase_22 AC 43 ms
7,076 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 42 ms
7,788 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 42 ms
7,196 KB
testcase_30 WA -
testcase_31 AC 42 ms
8,236 KB
testcase_32 AC 42 ms
7,288 KB
testcase_33 AC 42 ms
7,732 KB
testcase_34 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:23:29: 警告: ‘c’ may be used uninitialized [-Wmaybe-uninitialized]
   23 |     if ( (a - b)  % 11 == 0 && c == 3 )
      |          ~~~~~~~~~~~~~~~~~~~^~~~~~~~~
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 )
        ans = "FizzBuzz";
    else if ((a - b)  % 11 == 0)
        ans = "Buzz";
    else if (c % 3 == 0)
        ans = "Fizz";
    
    
    cout << ans << endl;
    return 0;
    
}
0