QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#468738 | #5490. Smallest Calculated Value | Eiad_Ahmed# | WA | 0ms | 3644kb | C++20 | 848b | 2024-07-08 23:57:48 | 2024-07-08 23:57:48 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 5, mod = 1e9 + 7;
vector<int> a;
int solve(int i, int val) {
if (i == 3)
return val;
int ans = 1e9;
ans = min(ans, solve(i + 1, val * a[i]));
ans = min(ans, solve(i + 1, val + a[i]));
if(val - a[i] >= 0){
ans = min(ans, solve(i + 1 , val - a[i]));
}
if (val % a[i] == 0) {
ans = min(ans, solve(i + 1, val / a[i]));
}
return ans;
}
void setAnswer(int Case) {
a.resize(3);
cin >> a[0] >> a[1] >> a[2];
cout << solve(1,a[0]);
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int testCases = 1;
// cin >> testCases;
for (int i = 1; i <= testCases; i++) {
setAnswer(i);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
input:
2 3 5
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
9 9 9
output:
0
result:
ok single line: '0'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3644kb
input:
5 7 3
output:
4
result:
wrong answer 1st lines differ - expected: '1', found: '4'