input:gcdxor.in output:gcdxor.out
时间限制: 1000 ms 空间限制: 262144 KB 具体限制
1 #include<stdio.h>
2 using namespace std;
3 int main()
4 {
5 freopen("gcdxor.in","r",stdin);
6 freopen("gcdxor.out","w",stdout);
7 int n,i,j,x,a,b,r,ans;
8 scanf("%d",&n);
9 ans=0;
10 for (i=1;i<=n/2;++i)
11 {
12 j=2;
13 while (i*j<=n)
14 {
15 x=i^(j*i);
16 b=i*j-i;
17 if (x==b)
18 ans++;
19 j++;
20 }
21 }
22 printf("%d",ans);
23 fclose(stdin);
24 fclose(stdout);
25 }