結果

問題 No.593 4進FizzBuzz
ユーザー GBGB
提出日時 2019-02-14 02:00:17
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 648 bytes
コンパイル時間 436 ms
コンパイル使用メモリ 60,768 KB
実行使用メモリ 9,076 KB
最終ジャッジ日時 2023-10-11 12:28:37
合計ジャッジ時間 7,355 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,352 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 144 ms
7,116 KB
testcase_20 WA -
testcase_21 AC 144 ms
7,960 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 144 ms
7,744 KB
testcase_28 WA -
testcase_29 AC 146 ms
7,080 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<math.h>

using namespace std;

typedef long long ll;

//文字を整数に
int ctoi(const char c){
    if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
//4から10
ll quatoDec( string s){
    int indexNum=s.size()-1;
    double buff=0;
    ll dec=0;
    for(int i=0;i<s.size();i++){
        dec+=ctoi(s[i])*pow(4,indexNum-i);
    }
    return dec;
}
int main(){

    string str;
    cin>>str;
    ll ans=quatoDec(str);
    if(ans%3==0 && ans%5==0)cout<<"FizzBuzz"<<endl;
    else if(ans%3==0)cout<<"Fizz"<<endl;
    else if(ans%5==0)cout<<"Buzz"<<endl;
    else cout<<str<<endl;
 
    return 0;
}
0