| ||||||||||
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 |
acm训练的内容不是错无处理,而是解决问题中最本质和重要的那个环节。想在acm中寻找对编程全面性建壮性的训练,属于缘木求鱼了。In Reply To:about problems 1000 Posted by:cherry07 at 2008-11-05 18:40:29 > 第一次写的: > #include <iostream> > using namespace std; > int main() > { > int a,b; > cout << "This program accepts two inputs a,b.(a>=0 and b<=10)\n"; > //题目是要求A>=0,B<=10吗? > cin >> a >>b; > if (a>0||a==0) > { > if(b<10||b==10) > { > cout << a+b; > } > else > { > cout << "Input b is out of range,please choose a number"; > cout << "smaller than 10 or equal with 10 as the second input"; > } > } > else > cout << "Inputs out of range!"; > } > 第一次做ACM,想问下,不能加我的这些错误处理语句是吗?加了就是错的? > 但是真正编程时,对错误的处理是很重要的啊,ACM里的都不考虑超出范围怎么办吗? > 只用考虑在范围内输出结果吗? 这样对全面性考虑的训练不太好吧~ > > 第二次交的这个就通过了: > #include <iostream> > using namespace std; > int main() > { > int a,b; > cin >> a >>b; > if (a>=0&&b<=10) > cout << a+b; > } > 然后第三次交底下的HINT(HINT就是正确答案么?): > #include <iostream> > using namespace std; > int main() > { > int a,b; > cin >> a >>b; > cout << a+b; > } > 居然耗时0MS也通过了,我都无语了,题目上不是这样 > Two integer a,b (0<=a,b<=10)写的么,有谁能告诉我怎么回事么? > (THANK YOU!) Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator