結果
| 問題 |
No.1453 手助け
|
| コンテスト | |
| ユーザー |
tsuishi
|
| 提出日時 | 2021-04-01 11:07:17 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 2,186 bytes |
| コンパイル時間 | 1,178 ms |
| コンパイル使用メモリ | 31,232 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-17 15:06:52 |
| 合計ジャッジ時間 | 1,010 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#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 = x - e;
}
money += x;
}
//fprintf(stderr,"%d\n", money);
}
//fprintf(stderr,"money=%d\n", money);
out(money);
}
tsuishi