結果

問題 No.604 誕生日のお小遣い
ユーザー ECHO_1221ECHO_1221
提出日時 2017-12-06 22:53:50
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 267 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 22,400 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-05-06 17:17:45
合計ジャッジ時間 3,610 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 OLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d %d %d\n", &x, &y, &z);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main()
{
	int x,y,z;
	int sum = 0;
	int age = 1;
	
	scanf("%d %d %d\n", &x, &y, &z);
	
	while(sum < z){
		sum += (age % x == 0) ? y : 1;
		printf("sum[%d] = %d\n", age, sum);
		if(sum < z){
			age++;
		}
	}
	printf("%d\n", age);
	return (0);
}
0