제출 #1021580

#제출 시각아이디문제언어결과실행 시간메모리
1021580avighnaCopy and Paste 3 (JOI22_copypaste3)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> typedef long long ll; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); ll n, a, b, c; std::string s; std::cin >> n >> s >> a >> b >> c; ll ans = n * a; for (ll i = 1; i < n; ++i) { ll max_parts = n / i; for (ll parts = 1; parts <= max_parts; ++parts) { ll cost = i * a; if (parts > 1) { cost += b + parts * c; } cost += (n - (parts * i)) * a; ans = std::min(ans, cost); } } std::cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...