QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#188184#5490. Smallest Calculated Valuetriplem5ds#WA 0ms3608kbC++231.6kb2023-09-25 16:23:212023-09-25 16:23:22

Judging History

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

  • [2023-09-25 16:23:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3608kb
  • [2023-09-25 16:23:21]
  • 提交

answer

/// Msaa el 5ra
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")

#include "bits/stdc++.h"

using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i, a, b)  for(int i = a; i < b; i++)
#define all(a)  a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll

using ll = long long;
using ii = pair<int, int>;
using ull = unsigned long long;

const int N = 5e5 + 5, LG = 18, MOD = 1e9 + 7;
const long double PI = acos(-1);
const long double EPS = 1e-7;
int n, m;
int go[1005];
int ans[105];

void doWork() {
    int a, b, x;
    cin >> a >> b >> x;
    int ans = INT_MAX;
    for (char c: "+-*/") {
        for (char c2: "+-*/") {
            int val = a;
            if (c == '+')val += b;
            else if (c == '-')val -= b;
            else if (c == '*')val *= b;
            else if (c == '/') {
                if (val % b)continue;
                val /= b;
            }
            if (c2 == '+')val += x;
            else if (c2 == '-')val -= x;
            else if (c2 == '*')val *= x;
            else if (c2 == '/') {
                if (val % x)continue;
                val /= x;
            }
            if (val >= 0)
                ans = min(ans, val);
        }
    }
    cout << ans << '\n';
}

int32_t main() {
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif // ONLINE_JUDGE

    int t = 1;
//    cin >> t;
    while (t--) {
        doWork();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3600kb

input:

2 3 5

output:

0

result:

ok single line: '0'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

9 9 9

output:

0

result:

ok single line: '0'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3440kb

input:

5 7 3

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3388kb

input:

406 21 18

output:

367

result:

ok single line: '367'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

250 750 1000

output:

0

result:

ok single line: '0'

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3608kb

input:

774 261 747

output:

27

result:

wrong answer 1st lines differ - expected: '288', found: '27'