- 博客(26)
- 收藏
- 关注
原创 25-题目1437:To Fill or Not to Fill
http://ac.jobdu.com/problem.php?pid=1437不大明白,没有解决。比如在当前是单价比较低,在一次最大长度内到达下一个#include#include#include#include#include#include //小数点对齐using namespace std;typedef struct GasStation{ float p
2016-02-23 15:43:11 259
原创 24-题目1436:Repair the Wall
http://ac.jobdu.com/problem.php?pid=1436#include#include#include#include#include#include //小数点对齐using namespace std;bool cmp(int a, int b){ return a > b;}int main(){ int l, n; //l为长度
2016-02-23 12:11:48 429
原创 23-题目1435:迷瘴
http://ac.jobdu.com/problem.php?pid=1435题目描述:通过悬崖的yifenfei,又面临着幽谷的考验——幽谷周围瘴气弥漫,静的可怕,隐约可见地上堆满了骷髅。由于此处长年不见天日,导致空气中布满了毒素,一旦吸入体内,便会全身溃烂而死。幸好yifenfei早有防备,提前备好了解药材料(各种浓度的万能药水)。现在只需按照配置成不同比例的浓度
2016-02-23 11:33:05 366
原创 22-题目1434:今年暑假不AC
http://ac.jobdu.com/problem.php?pid=1434题目描述:“今年暑假不AC?”“是的。”“那你干什么呢?”“看世界杯呀,笨蛋!”“@#$%^&*%...”确实如此,世界杯来了,球迷的节日也来了,估计很多ACMer也会抛开电脑,奔向电视作为球迷,一定想看尽量多的完整的比赛,当然,作为新时代的好青年,你一定还会看一些其它的节目,比如新闻联播(永远不要
2016-02-22 11:59:42 298
原创 21-题目1433:FatMouse
http://ac.jobdu.com/problem.php?pid=1433题目描述:FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.The warehouse
2016-02-22 11:58:08 261
原创 20-题目1173:查找
http://ac.jobdu.com/problem.php?pid=1173题目描述:输入数组长度 n 输入数组 a[1...n] 输入查找个数m 输入查找数字b[1...m] 输出 YES or NO 查找有则YES 否则NO 。#include#include#include#includeusing namespace
2016-02-21 23:07:40 213
原创 19-题目1126:打印极值点下标
http://ac.jobdu.com/problem.php?pid=1126题目描述:在一个整数数组上,对于下标为i的整数,如果它大于所有它相邻的整数,或者小于所有它相邻的整数,则称为该整数为一个极值点,极值点的下标就是i。一次成功!#include#include#include#includeusing namespace std;int
2016-02-21 22:54:19 1096
原创 18-题目1069:查找学生信息
http://ac.jobdu.com/problem.php?pid=1069题目描述: 输入N个学生的信息,然后进行查询#include#include#include#includeusing namespace std;typedef struct Student{ string ID; string name; string sex; i
2016-02-21 22:24:54 293
原创 17-题目1052:找x
http://ac.jobdu.com/problem.php?pid=1052题目描述:输入一个数n,然后输入n个数值各不相同,再输入一个值x,输出这个值在这个数组中的下标(从0开始,若不在数组中则输出-1)。题目很简单#include#includeusing namespace std;int main(){ int n, x, i, flag =
2016-02-21 21:46:34 270
原创 15-题目1432:叠筐
http://ac.jobdu.com/problem.php?pid=1432题目描述:把一个个大小差一圈的筐叠上去,使得从上往下看时,边筐花色交错。这个工作现在要让计算机来完成,得看你的了。我找不出来规律。。。。。
2016-02-21 18:38:10 209
原创 14-题目1065:输出梯形
http://ac.jobdu.com/problem.php?pid=1065题目描述:输入一个高度h,输出一个高为h,上底边为h的梯形。//14-题目1065:输出梯形#include #include #include using namespace std;int main(){ int h, i, j; //ifstream cin("data.t
2016-02-21 18:17:51 243
原创 13-题目1088:剩下的树
http://ac.jobdu.com/problem.php?pid=1088题目描述: 有一个长度为整数L(1 现在要移走一些树,移走的树的区间用一对数字表示,如 100 200表示移走从100到200之间(包括端点)所有的树。 可能有M(1题目比较简单,就是把区间内对应的点的值赋为0,剩下的1相加即可//13-题目1088:剩下的树
2016-02-21 17:30:45 278
原创 12-题目1156:谁是你的潜在朋友
http://ac.jobdu.com/problem.php?pid=1156题目描述: “臭味相投”——这是我们描述朋友时喜欢用的词汇。两个人是朋友通常意味着他们存在着许多共同的兴趣。然而作为一个宅男,你发现自己与他人相互了解的机会并不太多。幸运的是,你意外得到了一份北大图书馆的图书借阅记录,于是你挑灯熬夜地编程,想从中发现潜在的朋友。 首先你对借阅记录进行了一
2016-02-21 17:05:12 1042 1
原创 11-题目1431:Sort
http://ac.jobdu.com/problem.php?pid=1431题目描述:给你n个整数,请按从大到小的顺序输出其中前m大的数。ifstream cin("data.txt"); //可以直接从文件中读取测试用例,非常方便,需要有头文件用一次这个之后就不用手输入了,令文件输入符为cin,这样提交代码时只需要注释掉这一行其他就不用动了。get 新
2016-02-20 22:22:05 320
原创 10-题目1018:统计同成绩学生人数
http://ac.jobdu.com/problem.php?pid=1018题目描述:读入N名学生的成绩,将获得某一给定分数的学生人数输出。题目很简单//题目1018:统计同成绩学生人数#include #include #includeusing namespace std;int main(){ int N, score[1000],
2016-02-20 21:38:09 288
原创 6-题目1096:日期差值
http://ac.jobdu.com/problem.php?pid=1096题目描述:有两个日期,求两个日期之间的天数,如果两个日期是连续的我们规定他们之间的天数为两天我第一反应是有没有专门的函数可以计算,后来还是自己写了判断的函数。一次成功!算法是计算输入年份与1400年01月01日的相差天数,然后大-小+1~(公历纪年从1400开始~)
2016-02-20 20:53:03 288
原创 9-题目1186:打印日期
http://ac.jobdu.com/problem.php?pid=1186题目描述:给出年分m和一年中的第n天,算出第n天是几月几号。注意输出的时候printf("%04d-%02d-%02d\n", year,month,sum); 04d表示输出固定4个数字,若不满则补零, yyyy-mm-dd效果如下:2000-01-03#include #i
2016-02-20 20:44:52 254
原创 8-题目1070:今年的第几天?
http://ac.jobdu.com/problem.php?pid=1070题目相比前两个比较简单,代码简化了一下#include #include using namespace std;int main(){ int year,month,day,sum,i; int Month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31,
2016-02-20 20:12:10 254
转载 C++中map的使用详解说明
项目需要,map的使用详解键值对 匹配1 头文件 #include 2、map的功能自动建立Key - value的对应。key 和 value可以是任意你需要的类型。 根据key值快速查找记录,查找的复杂度基本是Log(N),如果有1000个记录,最多查找10次,1,000,000个记录,最多查找20次。 快速插入Key - Value 记录。
2016-02-20 16:46:20 321
原创 7-题目1043:Day of Week
http://ac.jobdu.com/problem.php?pid=1043switch和case里面不能用string,只好用if解决,或者用map,一一对应------------------------转载内容------------------------http://bbs.bccn.net/thread-162951-2-1.html----------F12-------
2016-02-20 16:36:19 312
原创 5-题目1054:字符串内排序
http://ac.jobdu.com/problem.php?pid=1054有两个版本,一个是自己写的判断char数组长度,还有一个是头文件里面含有的length = strlen(arr);函数,但是VS和OJ的判断系统不大一样,在VS里可以直接写,但是在OJ里不识别,必须写代码1:#include #include #include#include using n
2016-02-20 14:17:24 333
原创 4-题目1023:EXCEL排序
http://ac.jobdu.com/problem.php?pid=1023这道题我看到的第一反应是应该全部输入后再一起输出Case,所以写了个二维结构体数组。。。。。然后看别人的代码居然是一个一个输出的。。。。。用sort和compare好方便啊,以后不用自己写排序了好开心!~~~~~(当然算法还是要掌握的)但是这题我一直runtime error.......我不知道为
2016-02-20 12:44:09 2412
原创 3-题目1185:特殊排序
//题目1185:特殊排序//http://ac.jobdu.com/problem.php?pid=1185#include#includeusing namespace std;int main(){ int n, temp; while (cin >> n && n >= 1 && n <= 1000) { int * arr = new int[n]; fo
2016-02-19 19:25:48 433
原创 2-题目1061:成绩排序
http://ac.jobdu.com/problem.php?pid=1061#include#include#includeusing namespace std;typedef struct Student { string name; int age; int grade;}Student;int main(){ int n; Student temp;
2016-02-19 17:56:42 344
原创 1-题目1202:排序
#include#includeusing namespace std;int main(){ int n,temp; while (cin >> n && n >=1 && n <= 100) { int * arr = new int[n]; for (int i = 0; i < n; i++) cin >> arr[i]; //冒泡排序,递减序列 ,将
2016-02-19 14:41:32 219
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人