QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#245535 | #5490. Smallest Calculated Value | momen159# | WA | 0ms | 3804kb | C++14 | 1.5kb | 2023-11-10 00:22:51 | 2023-11-10 00:22:53 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define momen ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define ld long double
#define fp(n) for(int i=0;i<n;i++)
#define fp1(n) for(int i=1;i<=n;i++)
#define all(v) v.begin() , v.end()
const int mod = 1e9 + 7, N = 1e6 + 5, M = 8e6 + 5;
const ll LG = 20, inf = 1e9 + 6;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
void solve(int z) {
int a,b,c ;
cin>>a>>b>>c ;
vector<int>ans ;
ans.push_back(a+b+c) ;
ans.push_back(a-b-c) ;
ans.push_back(a*b*c) ;
ans.push_back(a+b-c) ;
ans.push_back(a-b+c) ;
ans.push_back(a*b+c) ;
ans.push_back((a+b)*c) ;
ans.push_back((a-b)*c) ;
ans.push_back(a*b-c) ;
if (a%b == 0) {
ans.push_back(a / b + c);
ans.push_back(a / b - c);
ans.push_back(a / b * c);
}
if (b%c == 0){
ans.push_back((a + b) / c);
ans.push_back( (a - b) / c);
ans.push_back((a * b) / c);
}
if (a%b == 0 && (a/b) %c == 0)
ans.push_back(a/b/c) ;
sort(all(ans)) ;
for (int i = 0; i < ans.size(); ++i) {
if (ans[i]>=0)
return void(cout<<ans[i]);
}
}
int main() {
momen
int t = 1;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
// cin >> t;
for (int i = 1; i <= t; ++i) {
//cout<<"Case #"<<i<<": ";
solve(t);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3592kb
input:
2 3 5
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
9 9 9
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
5 7 3
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
406 21 18
output:
367
result:
ok single line: '367'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
250 750 1000
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
774 261 747
output:
288
result:
ok single line: '288'
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3524kb
input:
893 407 5
output:
481
result:
wrong answer 1st lines differ - expected: '260', found: '481'