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:如果是runtime error,建议把数组开大一点,尽量的大,100000就差不多啦.....我的小小代码 如下.....ac啦 Posted by:wangjiayu at 2010-08-18 12:09:14 #include<iostream> using namespace std; int t,a,b; int main() { cin>>t; while(t--) { cin>>a>>b; if(a==0&&b==0) cout<<"0"<<endl; else if(a==1&&b==1) cout<<"1"<<endl; else if(a%2==0) { if(b==a) cout<<2*a<<endl; else if(b==a-2) cout<<2*a-2<<endl; else cout<<"No Number"<<endl; } else { if(b==a) cout<<2*a-1<<endl; else if(b==a-2) cout<<2*a-3<<endl; else cout<<"No Number"<<endl; } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator