码迷,mamicode.com
首页 > 其他好文 > 详细

hihoCoder (1223 : 不等式)

时间:2015-08-31 17:23:31      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:


链接: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;
}


版权声明:本文为博主原创文章,未经博主允许不得转载。

hihoCoder (1223 : 不等式)

标签:

原文地址:http://blog.csdn.net/a73265/article/details/48135993

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!