QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#95737#5602. Sun and Moon__#WA 2ms3564kbC++141.0kb2023-04-11 19:07:002023-04-11 19:07:00

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-11 19:07:00]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3564kb
  • [2023-04-11 19:07:00]
  • 提交

answer

#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")

#include <bits/stdc++.h>
using namespace std;

#define el '\n'
#define F first
#define S second

typedef long long ll;
typedef long double ld;

bool multipleTestCases = 0, sublime = 0;
const int N = 4e5 + 5, INF = 1e9 + 5, mod = 1e9 + 7, LOG = 22, SQ = 500;



void doWork() {
    ll ps, ts, ns, pm, tm, nm;

    cin >> ps >> ts >> pm >> tm;

    ns = ts - ps;
    nm = tm - pm;

    ts += ps;
    tm += pm;

    for (int i = 1; i <= 1e4; i++) {
        if (i % ts == ns and i % tm == nm) {
            return cout << i << el, void();
        }
    }
}
signed main() {
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
#ifndef ONLINE_JUDGE
    if (sublime) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
#endif
    int tests = 1;
    if (multipleTestCases) {
        cin >> tests;
    }
    for (int tc = 1; tc <= tests; tc++) {
        doWork();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3564kb

input:

3 10
1 2

output:

7

result:

ok single line: '7'

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3440kb

input:

27 32
39 41

output:

1362

result:

wrong answer 1st lines differ - expected: '453', found: '1362'