首页 > 代码库 > POJ 1430
POJ 1430
上面的估计是题解吧。。。。呃,如果真要用到公式的话,确实没听过。。。。
#include <iostream>#include <cstdio>#include <algorithm>#define LL __int64LL work(LL n){ LL res=0; LL divd=2; while(divd<=n){ res+=(n/divd); divd=(divd<<1); // cout<<divd<<endl; } return res; }int main(){ LL n,k; int T; scanf("%d",&T); while(T--){ scanf("%I64d%I64d",&n,&k); LL z=n-(LL)((k+2)/2); LL w=(k-1)/2; if(work(z)-work(w)-work(z-w)==0) printf("1\n"); else printf("0\n"); } return 0;}
POJ 1430
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。