UVALive4886 E - Page Count 模拟
2017-01-16 22:56
295 查看
思路:
>处理下字符串 ,遍历字符串每次查找到一个区间就更新一下 ,最后总的遍历一次页码看看有多少需要打印 (因为页码数不大 ,只有 1000 .字符串长度最长也只有 1000 .).>特例:
20
1,3,12345,6-3,5-9,,,
7
这组数据就是做一下处理: 碰到大于 1000 的数 ,初始化为 1000 .
20
-2,5—,6,,,7-10—-
7
大概思路会想到遇到 “,”做一下更新 ,结尾没有 “,”的类似上组数据 .
在遍历字符串的开始结尾先加一个 “,” .
对于中间过多的 “-” , “,”还要处理一下细节 .
类似以上的非法数据,坑~~巨坑~~~
>时间复杂度:O(n⋅l),l为字符串长度.
Ugly_CODE
相关文章推荐
- UVALive 4886|HDU 3777|Page Count|暴力
- UVALive3638 UVA12100 POJ3125 HDU1972 Printer Queue【队列+模拟】
- UVALive - 7511 Multiplication Table (模拟)
- [UVALive 6663 Count the Regions] (dfs + 离散化)
- UvaLive 6663 Count the Regions 离散化+DFS
- UVALive 5739|User Names|模拟
- UVALive 6257 Chemist's vows --一道题的三种解法(模拟,DFS,DP)
- UVAlive 6426 Count【读入】
- UVALive 6093 Emergency Room --优先队列实现的模拟
- UVALive - 7511 Multiplication Table (模拟)
- UVALive 4725 Airport 贪心 二分 模拟
- UVALive 6663 Count the Regions --离散化+DFS染色
- Uvalive 6471 Triangle Count Sequences of Polygon Triangulations 多边形三角剖分 递归思想
- UVALive 6833 (模拟 水~)
- UVaLive 7269 Snake Carpet (找规律,模拟)
- UVALive 6680 Join the Conversation (模拟)
- UVALive 3971 Assemble(模拟 + 二分)
- UVALive - 7511 Multiplication Table (模拟)
- [大模拟]两种方式解决Chat(UVALive-7047)大模拟
- UVALive4536 POJ3824 HDU3328 Flipper【模拟+堆栈】