摘要:
题解:经过分析我们可以得到,当洞穴数与遍历间隔数互质时,一定不会有安全洞穴,所以,这就是简单的GCD的运用:#include int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}int main(){ int t; scanf... 阅读全文
摘要:
题解参考博客:http://blog.csdn.net/hjd_love_zzt/article/details/9897281#include int n,ns,n2,a[65],yes; int main(){ int cas; scanf("%d",&cas); while(cas--){ scanf("%d",&n); for(int i=1;i=1;i--){ if(a[i]==cant){yes=0;break;} else if(a[i]==des)t=sor... 阅读全文
摘要:
打表水过:#include using namespace std; int n; long long a[20] = {0,2,7,5,30,169,441,1872,7632,1740,93313,459901,1358657,2504881,0}; int main() { while(cin>>n && n!=0){ cout<<a[n]<<endl; } return 0; } 阅读全文