#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