QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96676#5490. Smallest Calculated Valuemonkedluffy#WA 2ms3416kbC++231.1kb2023-04-15 01:40:462023-04-15 01:40:51

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-15 01:40:51]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3416kb
  • [2023-04-15 01:40:46]
  • 提交

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'