結果

問題 No.593 4進FizzBuzz
ユーザー GBGB
提出日時 2019-02-14 13:58:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 555 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 54,648 KB
実行使用メモリ 10,408 KB
最終ジャッジ日時 2023-10-11 12:35:51
合計ジャッジ時間 4,302 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 2 ms
4,356 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,372 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 61 ms
9,472 KB
testcase_17 AC 60 ms
8,440 KB
testcase_18 AC 61 ms
9,788 KB
testcase_19 AC 60 ms
7,468 KB
testcase_20 AC 53 ms
9,624 KB
testcase_21 AC 61 ms
9,280 KB
testcase_22 AC 61 ms
7,128 KB
testcase_23 AC 54 ms
10,240 KB
testcase_24 AC 59 ms
7,872 KB
testcase_25 AC 60 ms
7,128 KB
testcase_26 AC 61 ms
8,620 KB
testcase_27 AC 61 ms
7,984 KB
testcase_28 AC 54 ms
10,228 KB
testcase_29 AC 61 ms
7,168 KB
testcase_30 AC 53 ms
9,616 KB
testcase_31 AC 61 ms
9,336 KB
testcase_32 AC 60 ms
7,620 KB
testcase_33 AC 61 ms
8,220 KB
testcase_34 AC 61 ms
10,408 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,3) && isMultiple(str,5))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