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 |
Re:到底怎么错啊???高手们帮忙啊。难道我理解错了??还是。。。。。。。。。。。In Reply To:到底怎么错啊???高手们帮忙啊。难道我理解错了??还是。。。。。。。。。。。 Posted by:smilezhen at 2005-08-10 16:23:49 > #include <iostream.h> > > int main(void){ > unsigned long long t, s, d; > cin >> t; > while(t--){ > cin>> s>>d; > if(s<d) cout<<"impossible"<<endl; > else { > if(s%2 ==0) cout <<(s/2+d/2)<<' '<<(s-d)/2<<endl; <--- (s/2+d/2)<<应该为(s+d)/2,因为s和d可能同是奇数 > else cout <<((s-1)/2+(d+1)/2)<<' '<<(s-d)/2<< endl; > } > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator