結果

問題 No.1453 手助け
ユーザー tsuishitsuishi
提出日時 2021-04-01 10:58:15
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 2,194 bytes
コンパイル時間 1,001 ms
コンパイル使用メモリ 29,776 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-22 15:26:00
合計ジャッジ時間 1,846 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,380 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 0 ms
4,384 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 0 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 0 ms
4,380 KB
testcase_13 AC 0 ms
4,376 KB
testcase_14 WA -
testcase_15 AC 0 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 0 ms
4,376 KB
testcase_18 AC 0 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,384 KB
testcase_23 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
extern int getchar_unlocked(void);
extern int putchar_unlocked(int);
#define gc(d)	(d)=getchar_unlocked()
#define	pc(d) putchar_unlocked(d)
static char *GETWORD(char* r) {char c;char *cp;cp=&r[0];gc(c);while(c!=EOF){if((c==' ')||(c=='\n'))break;*cp++=c;gc(c);}*cp='\0';return &r[0];}
#define SWAP(type,a,b) do{type _c;_c=a;a=b;b=_c;}while(0)
#define MAX(a,b)	((a)>(b)?(a):(b))
#define MIN(a,b)	((a)<(b)?(a):(b))
#define REP(a,b) for(int a=0;a<(int)(b);++a)
#define REP1(a,b) for(int a=1;a<=(int)(b);++a)
#define	ull	unsigned long long
void out(int n) {
	int i;
	char b[70];
	if (!n) pc('0');
	else {
		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}
void outl(ull n) {
	int i;
	char b[70];
	if (!n) pc('0');
	else {
		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}
ull a2l(char *r) {
    ull res = 0;
    ull sign= 1;
    int i=0;

    while ((r[i]==' ')||(r[i]=='\t')||(r[i]=='\n')||(r[i]=='\v')||(r[i]=='\r')||(r[i]=='\f')) i++;
	/*
    if (r[i] == '-') sign = -1;
    if (r[i] == '+' || r[i] == '-') i++;
	*/
    while ((r[i]>='0')&&(r[i]<='9')){
		ull	dmy = res;
        res <<= 3;
        dmy <<= 1;
        res = res + dmy;
        res += (ull)(r[i] - '0');
        i++;
    }
    return res * sign;
}
// *********************
int in()   // 整数の入力(負数に対応)
{
	int c,n = 0;
	gc(c);
	do {
		n = 10 * n + (c & 0xf);
		gc(c);
	} while (c >= '0');
	return n;
}

void ins(char *s)  // 文字列の入力 スペース以下の文字で入力終了
{
	do {
		gc(*s);
	} while (*s++ > ' ');
	*(s - 1) = 0;
}
// *********************
int main( void ) {
	int	a,b,c,d,e,x;
	int	need;
	int	money = 0;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	need = MAX( b - c, 0 ) * a;
	//fprintf(stderr,"need=%d\n", need);
	if( need > 0 ) money = x = d;
	for(int i=2; i <= need ; i++ ) {
		//fprintf(stderr,"i%d ", i);
		if( i  % 10 ) {
			money += x;
		} else {
			if( e <= x ) {
				x = d - e;
			}
			money += x;
		}
		//fprintf(stderr,"%d\n", money);
	}
	//fprintf(stderr,"money=%d\n", money);
	out(money);
}

0