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

why runtime error? help!!!!!!!!! problem 1942

Posted by woshiniya at 2006-06-13 15:49:15
#include <iostream.h>
unsigned k(unsigned, unsigned);

void main() {
	unsigned row, col;
	while(cin >> row >> col) {
		if(!row && !col)
			break;
		cout << k(row, col) << endl;
	}
}
unsigned k(unsigned m, unsigned n) {
	unsigned temp, i;
	if(m == 1) 
		temp = n+1;
	else if(n == 1)
		temp = m+1;
	else {
		temp = 1 + n;
		for(i = 2; i <= m; i++)
			temp += k(i, n-1);
	}
	return temp;
}




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