結果
問題 |
No.311 z in FizzBuzzString
|
ユーザー |
![]() |
提出日時 | 2016-10-28 21:34:05 |
言語 | C90 (gcc 12.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 473 bytes |
コンパイル時間 | 440 ms |
コンパイル使用メモリ | 21,376 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 21:51:04 |
合計ジャッジ時間 | 5,522 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 RE * 4 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:7:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%ld",&i); | ^~~~~~~~~~~~~~~
ソースコード
#include <string.h> #include <stdio.h> int main(void) { unsigned long i; scanf("%ld",&i); unsigned 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; }