結果
| 問題 | No.311 z in FizzBuzzString |
| コンテスト | |
| ユーザー |
Haijinn
|
| 提出日時 | 2016-10-29 16:51:30 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 489 bytes |
| 記録 | |
| コンパイル時間 | 407 ms |
| コンパイル使用メモリ | 21,504 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 21:51:25 |
| 合計ジャッジ時間 | 6,262 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 RE * 4 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:35:29: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long long unsigned int’ [-Wformat=]
35 | sprintf(r,"%d",t);
| ~^ ~
| | |
| | long long unsigned int
| int
| %lld
main.c:7:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%lld",&i);
| ^~~~~~~~~~~~~~~~
ソースコード
#include <string.h>
#include <stdio.h>
int main(void)
{
unsigned long long i;
scanf("%lld",&i);
unsigned long 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;
}
Haijinn