QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#771648#7735. Primitive Root_LSA_WA 0ms3556kbC++20691b2024-11-22 14:52:362024-11-22 14:52:37

Judging History

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

  • [2024-11-22 14:52:37]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3556kb
  • [2024-11-22 14:52:36]
  • 提交

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'