結果
問題 | No.593 4進FizzBuzz |
ユーザー |
![]() |
提出日時 | 2017-11-10 23:06:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 710 bytes |
コンパイル時間 | 1,480 ms |
コンパイル使用メモリ | 167,320 KB |
実行使用メモリ | 8,484 KB |
最終ジャッジ日時 | 2024-11-24 14:06:46 |
合計ジャッジ時間 | 3,989 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)#define rep(i,n) REP(i,0,n)#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)#define ALLOF(c) (c).begin(), (c).end()typedef long long ll;typedef unsigned long long ull;int main(){string N;cin >> N;int x = 0;int y = 0;int p = 1;for(int i=N.size()-1; i>=0; i--){int a = (int)(N[i]-'0');x += a;y += a * p;y %= 10;p *= 4;p %= 10;}string ret = "";if(x%3 == 0){ret += "Fizz";}if(y%5 == 0){ret += "Buzz";}if(ret != ""){cout << ret << endl;}else{cout << N << endl;}return 0;}