QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96676 | #5490. Smallest Calculated Value | monkedluffy# | WA | 2ms | 3416kb | C++23 | 1.1kb | 2023-04-15 01:40:46 | 2023-04-15 01:40:51 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
ll a, b, c;
cin >> a >> b >> c;
vector<ll> v;
v.push_back(a + b + c);
v.push_back(a + b - c);
v.push_back(a + b * c);
if((a + b)%c == 0) v.push_back((a + b) / c);
v.push_back(a - b - c);
v.push_back(a - b + c);
v.push_back(a - b * c);
if(abs(a-b)%c == 0) v.push_back((a - b) / c);
v.push_back(a * b + c);
v.push_back(a * b - c);
v.push_back(a * b * c);
if((a*b)%c == 0) v.push_back((a * b) / c);
if(a%b == 0) v.push_back((a / b) + c);
if(a%b == 0) v.push_back((a / b) - c);
if(a%b == 0) v.push_back((a / b) * c);
if(a%b == 0 && (a/b)%c == 0) v.push_back((a / b) / c);
sort(v.begin(), v.end());
for(ll i = 0; i < (ll)v.size(); i++){
if(v[i] >= 0){
cout << v[i];
break;
}
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
//cin >> t;
while(t--){
cout << fixed << setprecision(15);
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3328kb
input:
2 3 5
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3312kb
input:
9 9 9
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3416kb
input:
5 7 3
output:
1
result:
ok single line: '1'
Test #4:
score: -100
Wrong Answer
time: 2ms
memory: 3340kb
input:
406 21 18
output:
28
result:
wrong answer 1st lines differ - expected: '367', found: '28'