結果
問題 |
No.1453 手助け
|
ユーザー |
|
提出日時 | 2021-05-05 12:40:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,713 bytes |
コンパイル時間 | 2,394 ms |
コンパイル使用メモリ | 196,636 KB |
最終ジャッジ日時 | 2025-01-21 07:13:25 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 WA * 19 |
ソースコード
#include "bits/stdc++.h" using namespace std; #define INIT ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define _CRT_SECURE_NO_WARINGS #define ALL(obj) (obj).begin(),(obj).end() #define SORT(obj) sort(ALL(obj)) #define rep(i,n) for(int i = 0; i < (n); ++i) #define coutALL(x) for(auto i=x.begin();i!=--x.end();i++)cout<<*i<<" ";cout<<*--x.end()<<endl; const int INF = 1e9; const int MOD = 1e9 + 7; const long long LINF = 1e18; const double PI = 3.14159265358979323846; using ll = long long; using P = pair<int, int >; using VI = vector<int>; using VP = vector<P>; template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } #pragma region vector入出力用 template<typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。 return is; } template<typename T> ostream& operator << (ostream& os, vector<T>& vec) { for (int i = 0; i < vec.size(); i++) { os << vec[i] << (i + 1 == vec.size() ? "" : " "); } return os; } #pragma endregion #pragma region Functions #pragma endregion signed main() { INIT; // 必須 int a, b, c, d, e; cin >> a >> b >> c >> d >> e; int sum{ 0 }; vector<int> sums; rep(i, b-c) { if (i == 0) { sums.push_back( d*a); continue; } // i >= 1 if (i % 10 != 0) sums.push_back(sums[i - 1] * a); else if (i % 10 == 0 and e <= sums[i - 1]) sums.push_back((sums[i - 1] - e) * a); else if (i % 10 == 0 and e > sums[i - 1]) sums.push_back(sums[i - 1] * a); } sum = accumulate(ALL(sums), 0); cout << sum << "\n"; }