結果

問題 No.593 4進FizzBuzz
ユーザー GBGB
提出日時 2019-02-14 14:05:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 541 bytes
コンパイル時間 728 ms
コンパイル使用メモリ 54,040 KB
実行使用メモリ 9,160 KB
最終ジャッジ日時 2023-10-11 12:36:37
合計ジャッジ時間 3,776 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,348 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,352 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 41 ms
7,504 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 42 ms
7,036 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 41 ms
7,808 KB
testcase_27 AC 43 ms
7,656 KB
testcase_28 WA -
testcase_29 AC 41 ms
7,276 KB
testcase_30 WA -
testcase_31 AC 49 ms
7,580 KB
testcase_32 WA -
testcase_33 AC 41 ms
7,056 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>

using namespace std;

int ctoi(const char c){
    if('0' <= c && c <= '9') return (c-'0');
  return -1;
} 
bool isMultiple(string s,int mod){
  int tmp=0;
  for(int i=0;i<s.size();i++){
    tmp=(tmp*4+(ctoi(s[i])))%mod;
    if(tmp>0)return false;
  }
  return true;
}
int main(){

    string str;
    cin>>str;
    if(isMultiple(str,15))cout<<"FizzBuzz"<<endl;
    else if(isMultiple(str,3))cout<<"Fizz"<<endl;
    else if(isMultiple(str,5))cout<<"Buzz"<<endl;
    else cout<<str<<endl;
 
    return 0;
}
0