結果
問題 |
No.593 4進FizzBuzz
|
ユーザー |
|
提出日時 | 2017-12-25 18:22:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 441 bytes |
コンパイル時間 | 572 ms |
コンパイル使用メモリ | 60,384 KB |
実行使用メモリ | 8,968 KB |
最終ジャッジ日時 | 2024-12-17 20:07:15 |
合計ジャッジ時間 | 4,212 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 WA * 14 |
ソースコード
#include <iostream> #include <string> #include <math.h> using namespace std; typedef long long LL; int main(int argc, char* argv[]) { string N; cin>>N; int i; int len=N.length()-1; LL m=0; for (i=len;i>=0;i--){ int n=N[i]-'0'; m+=n*(LL)(pow(4.0,len-i)); } if (m%3==0 && m%5==0){ cout<<"FizzBuzz"<<endl; }else if (m%3==0){ cout<<"Fizz"<<endl; }else if (m%5==0){ cout<<"Buzz"<<endl; }else{ cout<<N<<endl; } return 0; }