hihocoder1223
来源:互联网 发布:les蝴蝶 电影 知乎 编辑:程序博客网 时间:2024/06/06 03:14
#include <cstdio>#include <iostream>#include <map>#include <cstring>using namespace std;char s[105][10];char op[105][10];int d[105];int main(){ int n; cin >> n; for(int i = 0;i < n;i++){ scanf("%s %s %d",s[i],op[i],&d[i]); } map<double,int> ma; for(double i = -1;i <= 1001;i += 0.5){ ma[i] = 0; } for(int i = 0;i < n;i++){ if(strcmp(op[i],"<") == 0){ for(double j = -1;j < d[i];j+=0.5){ ma[j] ++; } } if(strcmp(op[i],"<=") == 0){ for(double j = -1;j <= d[i];j+=0.5){ ma[j]++; } } if(strcmp(op[i],">") == 0){ for(double j = d[i]+0.5;j <= 1001; j+= 0.5){ ma[j] ++; } } if(strcmp(op[i],">=") == 0){ for(double j = d[i];j <= 1001;j+=0.5){ ma[j] ++; } } if(strcmp(op[i],"=") == 0){ ma[d[i]]++; } } int maxw = 0; for(double i = -1;i <= 1001;i += 0.5){ if(ma[i] > maxw){ maxw = ma[i]; } } cout << maxw << endl; return 0;}
坑点比较多,首先在讨论区里面可以看到x是可以是实数的,c一定是一个整数然后就可以用map离散化一下
0 0
- hihocoder1223
- 笔记-----------------------------A*寻路算法
- HTTP请求头和响应头总结
- Zookeeper Api(java)入门与应用
- EasyX
- eclipse logcat 乱码,messy code,toast乱码,genymotion
- hihocoder1223
- Android UI设计小知识——渐变色背景的制作
- 【java基础】面向过程~面向对象
- Processing 教程(2) - 鼠标、键盘事件、条件选择、屏幕宽高
- UVA705斜线墙内求封闭路径,矩阵扩充与转化
- 交换排序------冒泡排序(实现Java)
- 005-spark standalone模式安装
- 人工智能学习梵高,毕加索风格,画出的世界名画是什么样子
- hihocoder1224