結果
| 問題 |
No.593 4進FizzBuzz
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-10 23:28:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,268 bytes |
| コンパイル時間 | 813 ms |
| コンパイル使用メモリ | 93,148 KB |
| 実行使用メモリ | 5,484 KB |
| 最終ジャッジ日時 | 2024-11-24 15:36:20 |
| 合計ジャッジ時間 | 3,193 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 WA * 8 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:52:8: warning: 'c' may be used uninitialized [-Wmaybe-uninitialized]
52 | if((c%11)==0) ans+="Buzz";
| ~~^~~~
main.cpp:42:7: note: 'c' was declared here
42 | int c;
| ^
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;
#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string str; cin >> str;
string ans = "";
ll th = 0;
rep(i,str.size()){
th += (str[i]-'0');
th%=3;
}
if((th%3)==0) ans+="Fizz";
int c;
rep(i,str.size()){
if(i==0) c = (str[i]-'0');
else{
c*=10;
c+=(str[i]-'0');
c%=11;
}
}
if((c%11)==0) ans+="Buzz";
if(ans=="")cout << str << endl;
else cout << ans << endl;
//cout << fixed << setprecision(16) << ans << endl;
return 0;
}