結果
問題 | No.593 4進FizzBuzz |
ユーザー |
![]() |
提出日時 | 2017-11-10 22:36:00 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 388 bytes |
コンパイル時間 | 1,407 ms |
コンパイル使用メモリ | 160,072 KB |
実行使用メモリ | 7,312 KB |
最終ジャッジ日時 | 2024-11-24 12:49:19 |
合計ジャッジ時間 | 3,998 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 |
ソースコード
#include<bits/stdc++.h>using namespace std;using Int = long long;signed main(){string s;cin>>s;int x=0,y=0;int n=s.size();reverse(s.begin(),s.end());for(int i=0;i<n;i++){x+=s[i]-'0';y+=5+(s[i]-'0')*(1-(!(i&1))*2);x%=3;y%=5;}reverse(s.begin(),s.end());if(!x) cout<<"Fizz";if(!y) cout<<"Buzz";if(x&&y) cout<<s;cout<<endl;return 0;}