結果
問題 | No.1453 手助け |
ユーザー |
![]() |
提出日時 | 2021-03-31 21:14:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 1,536 ms |
コンパイル使用メモリ | 167,736 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-15 13:49:12 |
合計ジャッジ時間 | 2,265 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include<bits/stdc++.h>using namespace std;using u64 = uint_least64_t;using s64 = int_least64_t;using ll = uint_least64_t;int main(){int a,b,c,d,e;cin >> a >> b >> c >> d >> e;int friend_num = b - c;int candy_num = a * friend_num;if (candy_num == 0){cout << '0' << endl;return 0;}if (candy_num == 1){cout << d << endl;return 0;}int x = d;int price = x;for (int i = 2; i <= candy_num; ++i){if (i % 10 != 0){price += x;}else{if (i % 10 == 0){if (e <= x){x -= e;price += x;}else{price += x;}}}}cout << price << endl;return 0;}