QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#468732 | #5490. Smallest Calculated Value | Eiad_Ahmed# | WA | 0ms | 3696kb | C++20 | 850b | 2024-07-08 23:53:33 | 2024-07-08 23:53:34 |
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]));
int x = solve(i + 1, val - a[i]);
if (x < 0) x = 1e9;
ans = min(ans, x);
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;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3640kb
input:
2 3 5
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
9 9 9
output:
0
result:
ok single line: '0'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3552kb
input:
5 7 3
output:
4
result:
wrong answer 1st lines differ - expected: '1', found: '4'