結果

問題 No.604 誕生日のお小遣い
ユーザー ECHO_1221ECHO_1221
提出日時 2017-12-06 22:50:25
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 267 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 22,400 KB
実行使用メモリ 13,640 KB
最終ジャッジ日時 2024-11-29 01:30:11
合計ジャッジ時間 16,388 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 14 OLE * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
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