http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1995
#include<iostream> using namespace std; int cal(int n) { int ans=0; while(n>0) { ans+=n/2; n/=2; } return ans; } int main() { int a, b; while(scanf("%d %d",&a,&b)!=EOF) { if(cal(a)-cal(a-b) > cal(b)) cout<<0<<endl; else cout<<1<<endl; } }
本文提供了一个针对ZJU OJ 1995题目的解决方案,采用C++编程语言实现了一个计算特定数学问题的算法。通过递减除法运算,该算法能够有效地解决题目中描述的问题。
181

被折叠的 条评论
为什么被折叠?



