Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

GL都不大于30怎么可能超时。。。王记万恶的\n了搞了一次PE!!!

Posted by KatrineYang at 2016-08-18 02:48:27 on Problem 1243
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator