結果

問題 No.311 z in FizzBuzzString
ユーザー HaijinnHaijinn
提出日時 2016-10-28 21:35:29
言語 C90
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 458 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 21,504 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 21:50:57
合計ジャッジ時間 1,564 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:17:9: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
   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:17:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
   17 |         strcat(s,"FizzBuzz");
      |         ^~~~~~
main.c:17:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
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: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
   41 | w=strlen(s);
      |   ^~~~~~
main.c

ソースコード

diff #

#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