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 }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-29
  • 2021-06-16
  • 2021-09-22
  • 2021-08-12
  • 2021-12-29
  • 2022-01-23
猜你喜欢
  • 2021-05-26
  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案