結果

問題 No.593 4進FizzBuzz
ユーザー GB
提出日時 2019-02-14 13:58:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 555 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 56,928 KB
実行使用メモリ 10,696 KB
最終ジャッジ日時 2024-09-13 11:22:39
合計ジャッジ時間 4,382 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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,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