結果
| 問題 |
No.311 z in FizzBuzzString
|
| コンテスト | |
| ユーザー |
spacenaut
|
| 提出日時 | 2016-05-15 19:42:13 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 275 bytes |
| コンパイル時間 | 233 ms |
| コンパイル使用メモリ | 21,120 KB |
| 実行使用メモリ | 13,764 KB |
| 最終ジャッジ日時 | 2024-09-24 21:41:06 |
| 合計ジャッジ時間 | 3,135 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 TLE * 1 -- * 3 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:17: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘long int *’ [-Wformat=]
8 | scanf("%d", &N);
| ~^ ~~
| | |
| | long int *
| int *
| %ld
main.c:19:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
19 | printf("%d", cnt);
| ~^ ~~~
| | |
| int long int
| %ld
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d", &N);
| ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(){
long N = 0;
long i;
long cnt = 0;
scanf("%d", &N);
for(i = 1; i <= N; i++){
if(i % 3 == 0 && i % 5 == 0){
cnt += 4;
}else if(i % 3 == 0){
cnt += 2;
}else if(i % 5 == 0){
cnt += 2;
}
}
printf("%d", cnt);
return 0;
}
spacenaut