結果

問題 No.593 4進FizzBuzz
ユーザー beetbeet
提出日時 2017-11-10 22:27:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 384 bytes
コンパイル時間 1,426 ms
コンパイル使用メモリ 159,800 KB
実行使用メモリ 9,116 KB
最終ジャッジ日時 2024-05-03 12:37:20
合計ジャッジ時間 4,337 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
5,376 KB
testcase_15 WA -
testcase_16 AC 50 ms
7,312 KB
testcase_17 WA -
testcase_18 AC 50 ms
7,184 KB
testcase_19 AC 48 ms
7,312 KB
testcase_20 WA -
testcase_21 AC 49 ms
7,184 KB
testcase_22 AC 52 ms
7,184 KB
testcase_23 WA -
testcase_24 AC 51 ms
7,184 KB
testcase_25 WA -
testcase_26 AC 51 ms
7,256 KB
testcase_27 AC 51 ms
7,312 KB
testcase_28 WA -
testcase_29 AC 51 ms
7,316 KB
testcase_30 WA -
testcase_31 AC 51 ms
7,184 KB
testcase_32 WA -
testcase_33 AC 50 ms
7,180 KB
testcase_34 AC 50 ms
7,316 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)*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