标签:style color os io strong for amp size
(a+b)%c===(a%c + b%c ) %c
#include<iostream>
using namespace std;
int a[5000]={0,0,1};
int main()
{ int i,p,k;
while(cin>>p>>k)
{ if(p==0&&k==0) break;
for(i=3;i<=p;i++)
a[i]=(a[i-1]%(1<<k)+a[i-2]%(i<<k))%(1<<k);
cout<<a[p]<<endl;
}
return 0;
}
#include<iostream>
using namespace std;
int a[5000]={0,0,1};
int main()
{ int i,n,k;
while(cin>>n>>k)
{ if(n==0&&k==0) break;
for(i=3;i<=n;i++)
a[i]=(a[i-1]%(1<<k)+a[i-2]%(i<<k))%(1<<k);
cout<<a[n]<<endl;
}
return 0;
}
zjut 1090 --------同余定理的应用,布布扣,bubuko.com
标签:style color os io strong for amp size
原文地址:http://www.cnblogs.com/2014acm/p/3905839.html