| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
GL都不大于30怎么可能超时。。。王记万恶的\n了搞了一次PE!!!#include <stdio.h>
int F[33][33] = {0};
int getF(int G, int L){
if(G < 0 || L < 0) return 0;
int jyAns = F[G][L];
if(jyAns > 0) return jyAns;
if(G == 1){
F[G][L] = 1;
return 1;
}
if(G < L) return getF(G, G);
int ans = 1 + getF(G-1, L-1) + getF(G-1, L);
F[G][L] = ans;
return ans;
}
int main() {
int G, L, cnt = 1;
while(1){
scanf("%d%d", &G, &L);
if(G == 0) return 0;
printf("Case %d: %d\n", cnt, getF(G, L));
cnt++;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator