結果

問題 No.1453 手助け
ユーザー Shawn stayCShawn stayC
提出日時 2021-08-25 23:03:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 349 bytes
コンパイル時間 2,104 ms
コンパイル使用メモリ 191,356 KB
最終ジャッジ日時 2025-01-24 01:52:07
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i=(l);i<(r);++i)
typedef long long ll;

int main(){
	int a,b,c,d,e; cin>>a>>b>>c>>d>>e;
	if(b-c==0) cout<<0<<endl;
	else if(d<e) cout<<(b-c)*a*d<<endl;
	else {
		int r=(b-c)*a;
		int x=d, ans=d;
		rep(i,2,r+1){
			if(i%10==0&&e<=x) x-=e;
			ans+=x;
		}
		cout<<ans<<endl;
	}
}
0