QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#95736 | #5602. Sun and Moon | __# | WA | 2ms | 3564kb | C++14 | 1.1kb | 2023-04-11 18:57:56 | 2023-04-11 18:57:57 |
Judging History
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;
// nextSun = totSun - pastSum --> 7 + X (10)
// nextMoon = totMoon - pastMoon --> 1 + Y (2)
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: 3416kb
input:
3 10 1 2
output:
7
result:
ok single line: '7'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3304kb
input:
27 32 39 41
output:
453
result:
ok single line: '453'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
43 48 39 50
output:
1061
result:
ok single line: '1061'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
44 45 11 22
output:
451
result:
ok single line: '451'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
36 45 14 41
output:
1134
result:
ok single line: '1134'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3564kb
input:
1 22 30 39
output:
87
result:
ok single line: '87'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3516kb
input:
18 40 4 6
output:
62
result:
ok single line: '62'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3404kb
input:
34 39 1 7
output:
83
result:
ok single line: '83'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3340kb
input:
27 49 12 30
output:
708
result:
ok single line: '708'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
49 50 33 36
output:
651
result:
ok single line: '651'
Test #11:
score: 0
Accepted
time: 2ms
memory: 3524kb
input:
22 26 39 45
output:
186
result:
ok single line: '186'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3416kb
input:
11 13 21 28
output:
119
result:
ok single line: '119'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3424kb
input:
16 36 10 23
output:
128
result:
ok single line: '128'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3444kb
input:
11 23 42 49
output:
840
result:
ok single line: '840'
Test #15:
score: -100
Wrong Answer
time: 2ms
memory: 3356kb
input:
31 39 0 31
output:
result:
wrong answer 1st lines differ - expected: '1178', found: ''