好题整理

1.

 题面如上 2022.10做的

代码:

#include<stdio.h>
typedef long long ll;
ll x4=72201776446800;//1~31的最小公倍数

ll divv(ll a1,ll a2,ll b)//介于a1和a2之间的数有多少个形如2b*n+b形式
{
     a1=a1+b-1;a2=a2+b;b=2*b;
     return a2/b-a1/b;
}

int main()
{
   int n,i,res=0;
   ll t1,t2,c,res1,res2,res3;
   scanf("%d",&n);
   for(i=0;i<n;i++)
   {  scanf("%lld %lld %lld",&t1,&t2,&c);
      res1=divv(t1,t2,1);
      res3=divv(t1,t2,6)+divv(t1,t2,420)+divv(t1,t2,360360)+divv(t1,t2,x4);
      if(c==1)printf("%lld\n",res1%20210923);
      else if(c==3)printf("%lld\n",res3%20210923);
      else if(c==2){res2=t2-t1+1-res1-res3;
      printf("%lld\n",res2%20210923);
          }
      else printf("%lld\n",res);
   }

    return 0;
}

 

2.

posted @ 2023-05-17 18:45  shrrel  阅读(33)  评论(0)    收藏  举报