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:Re:这样的算法是不是有很大问题?请大侠指正!不胜感激! Posted by:AP0606409 at 2008-09-02 23:58:19 提交的时候尽量把注释的内容删掉!可能系统的问题,会把代码中的一些注释的内容错读(只是个人猜想)o(∩_∩)o... 整理后AC的代码如下: #include <iostream> using namespace std; #include<string> int main() { int var; string s,s1; int high_var=11; int low_var=0; while ( cin >> var && var) { if(var<0 || var >10) { throw "array not allow!"; break; } cin>>s1>>s; if("high"== s && high_var > var ) high_var=var; if("low"==s && low_var < var) low_var=var; if("on"==s) if( high_var<=var || low_var>=var || high_var<low_var ) { cout<<"Stan is dishonest\n"; high_var=11;low_var=0; } else { cout<<"Stan may be honest\n"; high_var=11;low_var=0; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator