結果

問題 No.1453 手助け
ユーザー suppy193
提出日時 2021-05-01 18:44:18
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-20 02:30:03
合計ジャッジ時間 1,080 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |     scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void) {

    int a, b, c, d, e;
	int x;
	int total = 0;
	int i;
    scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
	x = d;
	total = x;
	if(b == c){
		printf("0\n");
		return 0;
	}
	for(i = 2;i <= a * (b - c);i++){
		if(i % 10 != 0){
			total += x;
		}
		else {
			if(e <= x){
				x = x - e;
				if(x < 0)x = 0;
				total += x;
			}
			else {
				total += x;
			}
		}
	}
    printf("%d\n", total);

	return 0;
}
0