結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
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 << s << std::endl;
  return 0;
}

}
0