結果

問題 No.593 4進FizzBuzz
ユーザー ukohank517ukohank517
提出日時 2017-11-10 23:50:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 1,330 bytes
コンパイル時間 851 ms
コンパイル使用メモリ 91,844 KB
実行使用メモリ 5,344 KB
最終ジャッジ日時 2023-08-16 05:41:09
合計ジャッジ時間 3,433 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 19 ms
5,124 KB
testcase_17 AC 19 ms
5,208 KB
testcase_18 AC 20 ms
5,060 KB
testcase_19 AC 21 ms
5,128 KB
testcase_20 AC 19 ms
5,344 KB
testcase_21 AC 19 ms
5,084 KB
testcase_22 AC 20 ms
5,080 KB
testcase_23 AC 19 ms
5,128 KB
testcase_24 AC 20 ms
5,192 KB
testcase_25 AC 19 ms
5,200 KB
testcase_26 AC 21 ms
5,180 KB
testcase_27 AC 20 ms
5,200 KB
testcase_28 AC 19 ms
5,132 KB
testcase_29 AC 20 ms
5,096 KB
testcase_30 AC 20 ms
5,200 KB
testcase_31 AC 20 ms
5,064 KB
testcase_32 AC 20 ms
5,048 KB
testcase_33 AC 20 ms
5,080 KB
testcase_34 AC 19 ms
5,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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";



  ll fi = 0;
  rep(i,str.size()-1){
    ll num = str.size()-1-i;
    if((num%2)==1)
      fi += (str[i]-'0')*4;
    else
      fi += (str[i]-'0')*6;
    fi%=5;
  }
  fi += (str[str.size()-1]-'0');
  if((fi%5)==0) ans += "Buzz";

  if(ans=="")cout << str << endl;
  else cout << ans << endl;
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}
0