結果
| 問題 |
No.604 誕生日のお小遣い
|
| コンテスト | |
| ユーザー |
l950n
|
| 提出日時 | 2017-12-14 00:41:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 275 bytes |
| コンパイル時間 | 270 ms |
| コンパイル使用メモリ | 22,144 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-14 10:32:31 |
| 合計ジャッジ時間 | 1,278 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
19 | printf("l%d 歳の誕生日\n", i-1);
| ~^ ~~~
| | |
| int long int
| %ld
ソースコード
#include <stdio.h>
int main() {
long a, b, c,i;
long sum = 0;
a = 2;
b = 5;
c = 8;
for (i = 1; sum < c; i++) {
if (i % a == 0) {
sum = sum + b;
}
else {
sum = sum + 1;
}
printf("sum =%ld\n", sum);
}
printf("l%d 歳の誕生日\n", i-1);
return 0;
}
l950n