首页 > 其他 > 详细

hihoCoder (1223 : 不等式)

时间:2015-08-31 17:23:21      阅读:185      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!