結果

問題 No.593 4進FizzBuzz
ユーザー beetbeet
提出日時 2017-11-10 22:36:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 3,140 ms
コンパイル使用メモリ 145,452 KB
実行使用メモリ 8,412 KB
最終ジャッジ日時 2023-08-16 03:15:56
合計ジャッジ時間 4,550 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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 1 ms
4,376 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,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 49 ms
6,864 KB
testcase_17 AC 48 ms
7,856 KB
testcase_18 AC 48 ms
7,888 KB
testcase_19 AC 49 ms
8,328 KB
testcase_20 AC 48 ms
6,948 KB
testcase_21 AC 47 ms
7,620 KB
testcase_22 AC 50 ms
6,908 KB
testcase_23 AC 48 ms
7,652 KB
testcase_24 AC 49 ms
7,848 KB
testcase_25 AC 48 ms
7,912 KB
testcase_26 AC 50 ms
8,032 KB
testcase_27 AC 49 ms
7,384 KB
testcase_28 AC 48 ms
8,412 KB
testcase_29 AC 49 ms
7,384 KB
testcase_30 AC 48 ms
8,360 KB
testcase_31 AC 47 ms
7,376 KB
testcase_32 AC 48 ms
7,388 KB
testcase_33 AC 48 ms
7,448 KB
testcase_34 AC 48 ms
6,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0