結果

問題 No.593 4進FizzBuzz
ユーザー GB
提出日時 2019-02-14 14:05:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 541 bytes
コンパイル時間 549 ms
コンパイル使用メモリ 57,456 KB
実行使用メモリ 7,380 KB
最終ジャッジ日時 2024-09-13 11:23:22
合計ジャッジ時間 3,601 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 12 WA * 19
権限があれば一括ダウンロードができます

ソースコード

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