QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#468738#5490. Smallest Calculated ValueEiad_Ahmed#WA 0ms3644kbC++20848b2024-07-08 23:57:482024-07-08 23:57:48

Judging History

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

  • [2024-07-08 23:57:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3644kb
  • [2024-07-08 23:57:48]
  • 提交

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'