上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 31 下一页
摘要: //Time Limit Exceeded 普通递归 自顶向下#include #define N 105 #includeusing namespace std;int a[N][N];int n;int max(int x, int y){ return x>y?x:y ; }int maxs... 阅读全文
posted @ 2014-08-12 10:02 2014acm 阅读(103) 评论(0) 推荐(0) 编辑
摘要: if(n%2==1) 等价 if( n&1 ) 位与&是位与操作符,n&1, n的最低位是1 1&1 就是 1不是将n的二进制形式与00000000 00000001按位做与操作。这时,只... 阅读全文
posted @ 2014-08-11 23:01 2014acm 阅读(181) 评论(0) 推荐(0) 编辑
摘要: zjut 1176 菲波那契数" - 博客后台管理 - 博客园http://i.cnblogs.com/EditPosts.aspx?postid=3887297 #include#include#includeusing namespace std;int main(int argc, char... 阅读全文
posted @ 2014-08-11 22:46 2014acm 阅读(91) 评论(0) 推荐(0) 编辑
摘要: #include #include int a[31][31] = {0}; using namespace std;int main(){ a[0][0] = 1; int i = 0, j = 0, n = 0; for(i = 1; i > n) { ... 阅读全文
posted @ 2014-08-11 22:42 2014acm 阅读(87) 评论(0) 推荐(0) 编辑
摘要: (a+b)%c===(a%c + b%c ) %c#includeusing 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;iusing ... 阅读全文
posted @ 2014-08-11 22:38 2014acm 阅读(212) 评论(0) 推荐(0) 编辑
摘要: #include int fib(int n){if(nint fib(int n){ if(n#define MAX 50+1int a[MAX];int fib(int n){ if (a[n]==-1) return a[n]=fib(n-1)+fib(n-2)... 阅读全文
posted @ 2014-08-11 22:35 2014acm 阅读(398) 评论(0) 推荐(0) 编辑
摘要: n==10 20 30 40 50 46 体验一下,感受一下,运行时间#include int fib(int n){ if (nint fib(int n){ if (nint fib[50]={0,1}; //使用打表void in... 阅读全文
posted @ 2014-08-11 21:47 2014acm 阅读(217) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;int n,k,a[10000];int binsearch(int low,int high){ int i,len,s;while(lowk) low=len+1; else if(s>n>>k) ... 阅读全文
posted @ 2014-08-11 21:42 2014acm 阅读(86) 评论(0) 推荐(0) 编辑
摘要: #include #include #define N 4000using namespace std;int a[N],b[N],c[N],d[N],ab[N*N],cd[N*N];int main(){int n,ans,i,j,k;while(scanf("%d",&n)!=EOF){ ... 阅读全文
posted @ 2014-08-11 21:41 2014acm 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 群#include #include int a[220][220];int x[220],y[220],n;int init(){ int i,j; for(i=0;iy?x:y;}int floyd(){ int i,j,k,t; for(k=0;kt) a[i][j]=t; ... 阅读全文
posted @ 2014-08-11 21:29 2014acm 阅读(105) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 31 下一页