标签:
链接:http://hihocoder.com/problemset/problem/1223
#include <iostream> #include <math.h> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; char s[1010][100]; int a[100]; int main() { int n; while(~scanf("%d",&n)) { char ch[2]; getchar(); memset(s,'\0',sizeof(s)); for(int i=0;i<n;i++) { scanf("%s%s%d",ch,s[i],&a[i]) ; } int temp=0; for(float i=-1;i<=1001;i+=0.5) { int cnt=0; for(int k=0;k<n;k++) { if(strcmp(s[k],"=")==0) { if(i==a[k]) cnt++; } else if(strcmp(s[k],">")==0) { if(i>a[k]) cnt++; } else if(strcmp(s[k],"<")==0) { if(i<a[k]) cnt++; } else if(strcmp(s[k],">=")==0) { if(i>=a[k]) cnt++; } else if(strcmp(s[k],"<=")==0) { if(i<=a[k]) cnt++; } } if(cnt>temp) temp=cnt; } printf("%d\n",temp); } return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/a73265/article/details/48135993