結果

問題 No.593 4進FizzBuzz
ユーザー jenene08jenene08
提出日時 2017-11-15 01:56:26
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 53,320 KB
実行使用メモリ 9,072 KB
最終ジャッジ日時 2023-08-16 13:17:31
合計ジャッジ時間 5,290 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <stdlib.h>
#include <stdio.h>

int main() {
  std::string s;
  std::cin >> s;
  int i = 0;
  while(s[i]){
    // printf("%c\n",s[i] );
    i++;
  }
  int len = i;

  int output = 0;
  int pownum4 = 1;
  int pownum10 = 1;

  for(int i=len-1;i>=0;i--){
    int digit = atoi(&s[i]) / pownum10;

    int temp = digit * pownum4;
    // printf("%c\n",s[i] );
    // printf("%i\n",temp );
    output += temp;

    pownum4 = pownum4 * 4;
    pownum10 = pownum10 * 10;
  }

  std::string outstr = "";
  bool flg = true;
if(output%3==0){
  outstr += "Fizz";
  flg = false;
}
if(output%5==0){
  outstr += "Buzz";
  flg = false;
}
if(flg){
  // printf("%i\n", output);
  std::cout << output << std::endl;
  return 0;
}
else{
  std::cout << outstr << std::endl;
  return 0;
}

}
0