QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#771648 | #7735. Primitive Root | _LSA_ | WA | 0ms | 3556kb | C++20 | 691b | 2024-11-22 14:52:36 | 2024-11-22 14:52:37 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define fi first
#define se second
#define mk make_pair
using namespace std;
ll read(){
ll X = 0 ,r = 1;
char ch = getchar();
while(!isdigit(ch) && ch != '-') ch = getchar();
if(ch == '-') r = -1,ch = getchar();
while(isdigit(ch)) X = X*10+ch-'0',ch = getchar();
return X*r;
}
void solve(){
__int128 P = read(),m = read(),t = m/P;
if(t < 0) t = -1;
ll ans = t+1;
for(ll i=1;i<=30;i++){
__int128 x = t+i;
if(((x*P+1)^(P-1)) <= m) ans++;
}
cout << ans << "\n";
}
int main(){
int T = read();
while(T--) solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3556kb
input:
3 2 0 7 11 1145141 998244353
output:
1 3 872
result:
wrong answer 2nd lines differ - expected: '2', found: '3'