摘要: 题意:输入一个n以EOF作为结束,之后n行每行输入一个x,一个v,x代表当前车的坐标,v代表车的速度,问最后总共的超车数。解题思路:思路其实很简单,用将车排序,按照x1y2排序。然后比较就好了,当x1y2时超车数就增加。不过这题数据量比较大,暴力搜索的话肯定超时。在网上看到别人的思路才明白,也了解了... 阅读全文
posted @ 2014-05-20 00:17 903SW-BAO 阅读(603) 评论(0) 推荐(0) 编辑
摘要: 题意:输入 m和n 然后输入m个字典序列,每个序列包括一个字符窜 和一个数字,之后输入n个文章,以'.'作为结束,查询文章中是否有字典里的字符串有的话加上他的数字。解题思路:使用map 看了别人写的map确实好用,解决了好多麻烦。map m,相当于简历一个b类型的数组以a类型为下标。剩下的就是查询就... 阅读全文
posted @ 2014-05-19 00:39 903SW-BAO 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 题意:输入一个n,然后输入两个n*n矩阵,一个代表雷的矩阵,一个代表走过的的矩阵。然后输出结果矩阵、解题思路:结果矩阵分两种情况,一个是没有踩到雷的,一个是踩到雷的,踩到雷的要把雷都显示出来。其实就是用结构体的二维数组存的两个矩阵,然后输入,判断即可。具体代码:#include#include#in... 阅读全文
posted @ 2014-05-18 17:28 903SW-BAO 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 题目描述:大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2 3,1 3 2,2 1 3,2 3 1,3 1 2,3 2 1六个排列。任务描述:给出某个排列,求出这个排列的下k个排列,如果遇到最后一个排列,则下1排列为第1... 阅读全文
posted @ 2014-05-18 10:50 903SW-BAO 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 题意:贪心,排序后大数与小数相加具体代码:#include #include #include #include #include using namespace std;#define maxn 100005int n, m;int f[maxn];int cmp(int a, int b){ ... 阅读全文
posted @ 2014-05-17 22:17 903SW-BAO 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 题意:模拟题,用字母模拟数字,没有数字代表的则跳过,有数则代表但是连续多组的只输出一个。具体代码:#include#include#includeusing namespace std;int zimu[26]={0,1,2,3,0,1,2,0,0,2,2,4,5,5,0,1,2,6,2,3,0,1... 阅读全文
posted @ 2014-05-17 21:58 903SW-BAO 阅读(169) 评论(0) 推荐(0) 编辑
摘要: escriptionThenthTriangularnumber,T(n) = 1 + … +n, is the sum of the firstnintegers. It is the number of points in a triangular array withnpoints on si... 阅读全文
posted @ 2014-05-17 21:32 903SW-BAO 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 题意很好理解具体思路:3 4 6 9 4 5 7 1 5 8 2 6 3 7 8看成是34 56 7 89 1 2 34 5 6 7 8再做就可以了,就是数字变换的时候需要%10控制一下具体代码:#include#include#includeusing namesp... 阅读全文
posted @ 2014-05-17 20:48 903SW-BAO 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 题意:输入一个N和B N为牛的个数,B为高度,然后输入N头牛,为最少多少头牛加起来高度大于B解题思路:排序,贪心具体代码:#include#include#includeusing namespace std;int main(){ int n,b; int num[20005]; ... 阅读全文
posted @ 2014-05-17 18:38 903SW-BAO 阅读(189) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#includeusing namespace std;int main(){ int t; string s; cin>>t; while(t--) { cin>>s; int ls=s.le... 阅读全文
posted @ 2014-05-17 18:24 903SW-BAO 阅读(123) 评论(0) 推荐(0) 编辑