| ||||||||||
| 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 | |||||||||
你换成非递归试试.. 好像有人这样过啦!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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator