結果

問題 No.593 4進FizzBuzz
ユーザー GBGB
提出日時 2019-02-14 14:03:06
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 1,347 ms
コンパイル使用メモリ 54,256 KB
実行使用メモリ 8,548 KB
最終ジャッジ日時 2023-10-11 12:36:32
合計ジャッジ時間 4,404 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 1 ms
4,352 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 54 ms
7,752 KB
testcase_17 AC 63 ms
8,356 KB
testcase_18 AC 55 ms
7,624 KB
testcase_19 AC 64 ms
7,072 KB
testcase_20 AC 49 ms
7,988 KB
testcase_21 AC 55 ms
7,888 KB
testcase_22 AC 63 ms
7,916 KB
testcase_23 AC 48 ms
7,280 KB
testcase_24 AC 62 ms
7,812 KB
testcase_25 AC 62 ms
7,084 KB
testcase_26 AC 64 ms
7,340 KB
testcase_27 AC 63 ms
7,132 KB
testcase_28 AC 48 ms
8,180 KB
testcase_29 AC 64 ms
7,080 KB
testcase_30 AC 48 ms
7,772 KB
testcase_31 AC 55 ms
7,128 KB
testcase_32 AC 63 ms
7,988 KB
testcase_33 AC 63 ms
8,168 KB
testcase_34 AC 55 ms
8,548 KB
権限があれば一括ダウンロードができます

ソースコード

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 true;
  else return false;
}
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