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 |
开始觉得要打表,最后发现有公式,水一个~~~#include<iostream> using namespace std; int main() { int t,x,y; cin>>t; while(t--) { cin>>x>>y; if (x==y) { if(x%2)cout<<2*x-1<<endl; else cout<<2*x<<endl; } else if (x-2==y) { if(x%2)cout<<2*x-3<<endl; else cout<<2*x-2<<endl; } else { cout<<"No Number\n"; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator