結果
| 問題 | No.311 z in FizzBuzzString |
| コンテスト | |
| ユーザー |
Haijinn
|
| 提出日時 | 2016-10-27 22:44:03 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 459 bytes |
| 記録 | |
| コンパイル時間 | 159 ms |
| コンパイル使用メモリ | 21,248 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 21:50:40 |
| 合計ジャッジ時間 | 5,829 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 RE * 3 TLE * 1 |
コンパイルメッセージ
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)
{
long i;
scanf("%ld",&i);
int 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;
}
Haijinn