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

评测机被复杂度吓傻那里了

Posted by prowind at 2009-10-27 13:25:24
In Reply To:昨天上海赛区B题 我的超完美代码.为什么会超时??? Posted by:zjut020 at 2009-10-26 17:31:39
> #include<iostream>
> using namespace std;
> int a,b;int cnt;int p;
> int func(int n)
> {
>     if(n==1){
> 	    return a%p;	 
>     } 	 
>     else if(n==2)
>     {
> 	    return b%p;	   	 
>     }
>     else return func(n-1)*func(n-2)%p;
> }
> int main()
> {
>      int  t,n;
> 	 for(cin>>t;t--&&cin>>n>>a>>b>>p;cout<<func(n)<<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