結果

問題 No.593 4進FizzBuzz
ユーザー GBGB
提出日時 2019-02-14 14:03:06
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 56,884 KB
実行使用メモリ 8,784 KB
最終ジャッジ日時 2024-09-13 11:23:18
合計ジャッジ時間 4,180 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

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