結果
問題 | No.593 4進FizzBuzz |
ユーザー |
|
提出日時 | 2019-02-14 02:00:17 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 648 bytes |
コンパイル時間 | 545 ms |
コンパイル使用メモリ | 61,648 KB |
実行使用メモリ | 9,172 KB |
最終ジャッジ日時 | 2024-09-13 11:16:07 |
合計ジャッジ時間 | 5,396 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 WA * 15 |
ソースコード
#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; }