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

Re:发个清晰明了的ac

Posted by l331258747 at 2011-08-06 09:53:20 on Problem 1664
In Reply To:发个清晰明了的ac Posted by:l331258747 at 2011-08-06 09:53:08
#include<iostream>
using namespace std;
int split(int n,int m){
	if(n==0||m==0)
		return 0;
	if(n==1||m==1)
		return 1;
	if(n<m) 
		return split(n,n);
	if(n==m)
		return (split(n,m-1)+1);
	return split(n,m-1)+split(n-m,m);
}
int main(){
	int n,m,a;
	cin>>a;
	while(a--){
		cin>>n>>m;
		split(n,m);
		cout<<split(n,m)<<endl;
	}
}

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