QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#216126 | #7585. TDL | SolitaryDream# | AC ✓ | 313ms | 3672kb | C++17 | 858b | 2023-10-15 15:59:18 | 2023-10-15 15:59:19 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
int T,k,m;
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>T;
// T=10;
while(T--)
{
cin>>k>>m;
// k=999999999999999999,m=100;
int nk=(k>>14)<<14;
int ans=-1;
for(int i=0;i<(1<<14);i++)
{
int n=i+nk;
if(!n)
continue;
int c=m,f=-1;
for(int j=n+1;;j++)
{
if(__gcd(j,n)==1)
c--;
if(!c)
{
f=j;
break;
}
}
if((((f-n)^n))==k)
{
ans=n;
break;
}
}
cout<<ans<<"\n";
}
}
详细
Test #1:
score: 100
Accepted
time: 101ms
memory: 3672kb
input:
2 3 5 6 100
output:
5 -1
result:
ok 2 number(s): "5 -1"
Test #2:
score: 0
Accepted
time: 313ms
memory: 3596kb
input:
10 525775438567843653 99 682312746347646949 100 928247462368723598 89 389467864734767741 77 734712353456789580 91 928574865348354786 95 56042586089579521 93 614889782588491751 60 614889782588490923 90 614889782588491001 100
output:
-1 682312746347646754 928247462368723467 389467864734767645 734712353456789527 928574865348354669 56042586089579704 614889782588491410 614889782588490776 614889782588490814
result:
ok 10 numbers