結果

問題 No.593 4進FizzBuzz
コンテスト
ユーザー slim
提出日時 2018-01-27 15:38:33
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 453 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 94 ms
コンパイル使用メモリ 39,404 KB
実行使用メモリ 9,416 KB
最終ジャッジ日時 2026-07-21 18:37:27
合計ジャッジ時間 3,100 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20 WA * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:8:3: warning: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    8 |   gets(n);
      |   ^~~~
      |   fgets
/usr/bin/ld: /tmp/ccyqvLe8.o: in function `main':
main.c:(.text.startup+0xe): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #
raw source code

#include <stdio.h>
#include <string.h>

int main()
{
  char n[2000001];
  int n10,temp,i,len,four;
  gets(n);
  len = strlen(n)-1;
  n10 = 0;
  four = 1;
  while(len >= 0){
    temp = n[len] - '0';
    n10 += temp * four;
    four *= 4;
    len--;
  }
  if(n10 % 15 == 0){
    printf("FizzBuzz");
  }else if(n10 % 3 == 0){
    printf("Fizz");
  }else if(n10 % 5 == 0){
    printf("Buzz");
  }else{
    printf("%s",n);
  }
  printf("\n");
  return(0);
}
0