結果

問題 No.311 z in FizzBuzzString
コンテスト
ユーザー Haijinn
提出日時 2016-10-28 21:35:29
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
TLE  
実行時間 -
コード長 458 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 122 ms
コンパイル使用メモリ 30,020 KB
最終ジャッジ日時 2026-02-23 22:44:16
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 TLE * 1 -- * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:17:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
   17 |         strcat(s,"FizzBuzz");
      |         ^~~~~~
main.c:2:1: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:25:17: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
   25 |                 strcat(s,"Fizz");
      |                 ^~~~~~
main.c:25:17: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
main.c:31:17: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
   31 |                 strcat(s,"Buzz\n");
      |                 ^~~~~~
main.c:31:17: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
main.c:34:29: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat=]
   34 |                 sprintf(r,"%d",t);
      |                            ~^  ~
      |                             |  |
      |                             |  long unsigned int
      |                             int
      |                            %ld
main.c:35:17: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
   35 |                 strcat(s,r);
      |                 ^~~~~~
main.c:35:17: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
main.c:41:3: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
   41 | w=strlen(s);
      |   ^~~~~~
main.c:41:3: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
main.c:6:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 | scanf("%ld",&i)

ソースコード

diff #
raw source code

#include <stdio.h>

int main(void)
{
unsigned long i;
scanf("%ld",&i);
unsigned long t=1;
char s[100000];
char r[100000];
int y;
int w;
int g=0;
for(t;t<=i;t++){
	
	if(t%15==0){
		
	strcat(s,"FizzBuzz");
		
		
		
	}else if(t%3==0){
		
		
		
		strcat(s,"Fizz");
		
		
	}else if(t%5==0){
		
		
		strcat(s,"Buzz\n");
		
	}else{
		sprintf(r,"%d",t);
		strcat(s,r);
		
	}

}

w=strlen(s);
for(y=0;y<=w;y++){
	if(s[y]=='z'){
		g++;
	}
}
printf("%d",g);
return 0;
}
0