Submission #1021578

#TimeUsernameProblemLanguageResultExecution timeMemory
1021578avighnaCopy and Paste 3 (JOI22_copypaste3)C++17
0 / 100
1 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 cost = i * a; ll parts = n / i; if (parts > 1) { cost += b + parts * c; } cost += (n % 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...