Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

神奇的程序 G++:WA C++:AC

Posted by using at 2007-08-30 19:25:07 on Problem 2328
#include <iostream>
#include <string>

using namespace std;

int main(){
    int in=1;
    string o1,o2;
    int max,min;
    bool preright;
    cin>>in;
    max=11;
    min=0;
    while (in!=0){
      cin>>o1>>o2;
      if (o1=="right"&&o2=="on"){
         if (min<in&&in<max&&preright) {cout<<"Stan may be honest\n"; }
                                  else {cout<<"Stan is dishonest\n";}
         cin>>in;
         max=11;
         min=0;
         preright=true;
         continue;
      }else if(o1=="too"&&o2=="high"){
        if (in<min) preright=false;
        if (in<max) max=in;
      }else if(o1=="too"&&o2=="low"){
        if (in>max) preright=false;
        if (in>min) min=in;
      }
      if (max<=min) preright=false;
      cin>>in;
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator