QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#719504 | #5602. Sun and Moon | nickbelov# | AC ✓ | 0ms | 3704kb | C++20 | 2.3kb | 2024-11-07 02:21:06 | 2024-11-07 02:21:06 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
ostream_iterator<T> oit(const string &s = " "){ return ostream_iterator<T>(cout,s.c_str()); }
inline auto rep(int l, int r) { return views::iota(min(l, r), r); }
inline auto rep(int n) { return rep(0, n); }
inline auto rep1(int l, int r) { return rep(l, r + 1); }
inline auto rep1(int n) { return rep(1, n + 1); }
inline auto per(int l, int r) { return rep(l, r) | views::reverse; }
inline auto per(int n) { return per(0, n); }
inline auto per1(int l, int r) { return per(l, r + 1); }
inline auto per1(int n) { return per(1, n + 1); }
#define A(a) begin(a),end(a)
inline auto len = ranges::ssize;
struct chash {
static uint64_t splitmix64(uint64_t x) {
// http://xorshift.di.unimi.it/splitmix64.c
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
template<typename T, typename U> using pb_map = gp_hash_table<T, U, chash>;
template<typename T> using pb_set = gp_hash_table<T, null_type, chash>;
#define K first
#define V second
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
typedef vector<ll> vll;
using pll = pair<ll,ll>;
using pii = pair<int,int>;
constexpr ll NN = 2e5, L = 20;
ll M;
ll f1[NN], f2[NN];
ll inv(ll a, ll b=M) { return 1 < a ? b - inv(b % a, a) * b / a : 1; } // inv a mod b
ll choose(ll n, ll k) { return f1[n] * f2[k] % M * f2[n - k] % M; } // n choose k
ll powmod(ll x, ll y){
if(y==0) return 1LL;
ll t=powmod(x,y/2);
if (y%2==0) return (t*t)%M;
return (((x*t)%M)*t)%M;
}
void run()
{
ll s1,m1,s2,m2;
cin >> s1 >> m1 >> s2 >> m2;
for(ll i : rep1(10000)){
s1 += 1, s1 %= m1;
s2 += 1, s2 %= m2;
if(s1 == s2 and s1==0)
return void(cout << i << '\n');
}
assert(false);
}
int main()
{
//KING OF THE WORLD...... U.W.T.B
cin.tie(0);
ios_base::sync_with_stdio(false);
run();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3696kb
input:
3 10 1 2
output:
7
result:
ok single line: '7'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
27 32 39 41
output:
453
result:
ok single line: '453'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
43 48 39 50
output:
1061
result:
ok single line: '1061'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
44 45 11 22
output:
451
result:
ok single line: '451'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
36 45 14 41
output:
1134
result:
ok single line: '1134'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 22 30 39
output:
87
result:
ok single line: '87'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
18 40 4 6
output:
62
result:
ok single line: '62'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
34 39 1 7
output:
83
result:
ok single line: '83'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
27 49 12 30
output:
708
result:
ok single line: '708'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
49 50 33 36
output:
651
result:
ok single line: '651'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
22 26 39 45
output:
186
result:
ok single line: '186'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
11 13 21 28
output:
119
result:
ok single line: '119'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
16 36 10 23
output:
128
result:
ok single line: '128'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
11 23 42 49
output:
840
result:
ok single line: '840'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
31 39 0 31
output:
1178
result:
ok single line: '1178'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
23 41 5 25
output:
920
result:
ok single line: '920'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
31 39 41 50
output:
359
result:
ok single line: '359'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
38 42 24 43
output:
1180
result:
ok single line: '1180'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
45 47 30 36
output:
942
result:
ok single line: '942'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
31 41 44 46
output:
830
result:
ok single line: '830'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
0 14 20 24
output:
28
result:
ok single line: '28'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
49 50 37 44
output:
51
result:
ok single line: '51'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
23 47 35 46
output:
1575
result:
ok single line: '1575'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
46 49 44 45
output:
1081
result:
ok single line: '1081'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
36 47 14 17
output:
105
result:
ok single line: '105'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
15 19 3 33
output:
327
result:
ok single line: '327'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
6 37 28 42
output:
1400
result:
ok single line: '1400'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
17 32 49 50
output:
751
result:
ok single line: '751'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 48 41 47
output:
335
result:
ok single line: '335'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
30 42 42 44
output:
222
result:
ok single line: '222'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
2 13 32 35
output:
388
result:
ok single line: '388'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
4 30 13 17
output:
446
result:
ok single line: '446'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1 37 29 34
output:
73
result:
ok single line: '73'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
4 30 44 50
output:
56
result:
ok single line: '56'
Test #35:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
25 45 44 46
output:
830
result:
ok single line: '830'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
37 43 12 48
output:
1812
result:
ok single line: '1812'
Test #37:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
24 25 47 48
output:
1
result:
ok single line: '1'
Test #38:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
8 42 4 8
output:
76
result:
ok single line: '76'
Test #39:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
4 8 37 43
output:
92
result:
ok single line: '92'
Test #40:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
27 50 25 32
output:
423
result:
ok single line: '423'
Test #41:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
7 31 20 22
output:
24
result:
ok single line: '24'