結果
| 問題 |
No.1453 手助け
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-31 21:21:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,574 bytes |
| コンパイル時間 | 1,701 ms |
| コンパイル使用メモリ | 168,864 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-15 14:21:55 |
| 合計ジャッジ時間 | 2,906 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
#include <map>
#include <math.h>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
using namespace std;
using ll = long long;
const ll dx[4] = {1,0,-1,0};
const ll dy[4] = {0,1,0,-1};
ll mod(ll x, ll m){return x & m;}
ll modinv(ll a, ll m) {
ll b = m, u = 1, v = 0;
while (b) {
ll t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
u %= m;
if (u < 0) u += m;
return u;
}
ll modpow(ll a, ll n, ll m) {
ll res = 1;
while (n > 0) {
if (n & 1) res = res * a % m;
a = a * a % m;
n >>= 1;
}
return res;
}
ll yaku(ll x){
ll cnt = 0;
for(int i = 1; i * i <= x; i++){
if(x % i == 0){
if(i == x / i) cnt++;
else cnt += 2;
}
}
return cnt;
}
ll modwaru(ll a, ll b, ll m){
a %= m;
return a * modinv(b, m) % m;
}
ll gcd(ll x, ll y){
if(x % y == 0)return y;
else return gcd(y, x % y);
}
int main(){
ll A, B, C, D, E, kosuu = 0, ans = 0 ,X;
cin >> A >> B >> C >> D >> E;
X = D;
kosuu = A * (B - C);
bool b = true;
while(kosuu > 0){
if(E <= X){
if(!b)X -= E;
if(X < 0) X = 0;
if(b)ans += X * min(kosuu, (ll)9);
else ans += X * min(kosuu, (ll)10);
if(!b)kosuu -= 10;
else kosuu -= 9;
b = false;
}else{
ans += X * min(kosuu, (ll)10);
kosuu -= 10;
}
}
cout << ans << endl;
}