Hiho #1223 Inequalities

Source: Internet
Author: User

#1223: Inequality time Limitation: 10000ms single point time limit: 1000ms memory limit: 256MB description

Given n an inequality about X, the maximum number of questions is set.

Each inequality is one of the following forms:

X < C

X <= C

X = C

X > C

X >= C

Input

The first line is an integer n.

The following n rows, one inequality per line.

Data range:

1<=n<=50,0<=c<=1000

Output

An integer line that represents the maximum number of inequalities that can be set at the same time.

Sample input
4X = 1X = 2X = 3X > 0
Sample output
2



1#include <iostream>2#include <cstring>3#include <cstdio>4#include <algorithm>5#include <string>6 using namespacestd;7typedefLong LongLL;8 #defineMAXN 559 stringS,OP[MAXN];Ten intN,NUM[MAXN]; One intMain () A { -      while(Cin >>N) -     { the          for(inti =0; I < n;i++) -         { -Cin >> S >> op[i] >>Num[i]; -Num[i] <<=1; +         } -         intMAXN =1; +          for(intx =-2; x <=2003; x + +) A         { at             intTEM =0; -              for(intK =0; k < n;k++) -             { -                 if(Op[k] = ="="&& x = = Num[k]) tem++; -                 Else if(Op[k] = ="<="&& x <= num[k]) tem++; -                 Else if(Op[k] = =">="&& x >= num[k]) tem++; in                 Else if(Op[k] = ="<"&& x < num[k]) tem++; -                 Else if(Op[k] = =">"&& x > Num[k]) tem++; to             } +MAXN =Max (maxn,tem); -         } thecout << MAXN <<Endl; *     } $     return 0;Panax Notoginseng}

Hiho #1223 Inequalities

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.