首页 > 代码库 > poj 1430 第二类斯特林数
poj 1430 第二类斯特林数
1 #include <iostream> 2 #include <cmath> 3 #include <algorithm> 4 using namespace std; 5 6 int get2(long long n){ 7 if(n==0) 8 return 0; 9 int cnt =0; 10 while(n){ 11 cnt += n/2; 12 n = n/2; 13 } 14 return cnt; 15 } 16 int main(){ 17 18 int t; 19 cin>>t; 20 long long n,m; 21 while(t--){ 22 cin>>n>>m; 23 long long z = n-(m+2)/2; 24 long long w = (m-1)/2; 25 if(get2(z)-get2(w)-get2(z-w)>0){ 26 cout<<0<<endl; 27 }else{ 28 cout<<1<<endl; 29 } 30 } 31 return 0; 32 }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。