- 博客(24)
- 资源 (1)
- 收藏
- 关注
原创 题目-放苹果
描述把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。输入第一行是测试数据的数目t(0 <= t <= 20)。以下每行均包含二个整数M和N,以空格分开。1<=M,N<=10。输出对输入的每组数据M和N,用一行输出相应的K。样例输入17 3样例输出 8解题思路:对...
2018-03-29 14:57:07 254
原创 题解--HDU 1016 Prime Ring Problem 素数环
A ring is compose of n circles as shown in diagram....Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the su...
2018-03-25 21:35:35 4296 3
转载 hdoj--1016--Prime Ring Problem(递归回溯)
Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prim...
2018-03-25 20:43:59 194
转载 LeetCode OJ Permutation Sequence
求第k个排列,下面给出一个可以直接求的方法(不用枚举)。http://blog.csdn.net/modiziri/article/details/22389303截取一段出来:康托展开的公式:(不用记,看形势就行,下面会有例子)X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+a2*1!+a1*0!ai为整数,并且0<=ai<i(1<=i<...
2018-03-25 20:16:41 131
原创 题解-In a two-dimensional plane there are two line belts, there are two segments AB and CD
Problem DescriptionIn a two-dimensional plane there are two line belts, there are two segments AB and CD, lxhgww's speed on AB is P and on CD is Q, he can move with the speed R on other area on the pl...
2018-03-25 11:38:02 641
原创 关于函数的学习总结
1,函数 定义形式:函数返回值类型 函数名(形参列表){ 函数体; return 返回值;} 1》:函数返回值类型:即一个数据类型,可以为int,float,double,char,bool等等,需注意,当函数返回值类型为void时,函数没有返回值。 2》:函数名称,命名规则同变量名命名规则,是自定义的,尽量取有意义的函数名称。例,求最大值的函数可以命名为max,...
2018-03-22 18:51:41 272
转载 C++ Queues(队列)、Priority Queues(优先队列)
C++ Queues(队列)、Priority Queues(优先队列)C++ Queues(队列)C++队列是一种容器适配器,它给予程序员一种先进先出(FIFO)的数据结构。 1.back() 返回一个引用,指向最后一个元素 2.empty() 如果队列空则返回真 3.front() 返回第一个元素 4.pop() 删除第一个元素 ...
2018-03-20 18:40:28 1629
原创 题解—Angel was caught by theMOLIGPY!
Problem DescriptionAngel was caught by theMOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M &lt;= 200) matrix. There are WALLs, ROADs, and GUARDs in theprison.<...
2018-03-20 18:35:33 2513 2
转载 INT_MIN的用法
版权声明:转载请注明出处 http://blog.csdn.net/TwT520Ly http://blog.csdn.net/TwT520Ly/article/details/53038345INT_MIN在标准头文件limits.h中定义。#define INT_MAX 2147483647#define INT_MIN (-INT_MAX - 1)12在C/C++语言中,不能够直接使用-2...
2018-03-20 17:45:15 28641 1
原创 题解—detecting underground oil deposits
Problem DescriptionThe GeoSurvComp geologicsurvey company is responsible for detecting underground oil deposits.GeoSurvComp works with one large rectangular region of land at a time, and creates a gri...
2018-03-20 15:40:40 2504
原创 题解-Inhabitants of the Wonderlandhave decided to hold a regional programming contest.
Problem DescriptionInhabitants of the Wonderlandhave decided to hold a regional programming contest. The Judging Committee has volunteeredand has promised to organize the most honest contest ever. It ...
2018-03-19 20:45:04 2675
原创 题目—bought a new car!One day he comes to avertical corner.
Problem EProblem DescriptionMr. West bought a new car! Sohe is travelling around the city.<br><br>One day he comes to avertical corner. The street he is currently in has a width x, the str...
2018-03-19 15:04:53 589
原创 题目-My birthday is coming up and traditionally I'm serving pie.
Problem DescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my...
2018-03-19 11:12:03 3878
原创 题解-calculate the angle
Problem DescriptionThe recreation center of WHU ACM Team has indoor billiards, Ping Pang, chess and bridge, toxophily, deluxe ballrooms KTV rooms, fishing, climbing, and so on.<br>We all like to...
2018-03-17 10:15:39 324
原创 题解-F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x
Problem DescriptionNow, here is a fuction:<br>&nbsp;&nbsp;F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 &lt;= x &lt;=100)<br>Can you find the minimum value when x is between 0 an...
2018-03-17 09:58:50 4639 3
原创 题解-equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y;
Problem DescriptionNow,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,can you find its solution between 0 and 100;<br>Now please try your lucky. InputThe first line of the input contain...
2018-03-17 09:24:38 5311
转载 C++中cos,sin,asin,acos这些三角函数操作
http://blog.csdn.net/xky140610205/article/details/52192889C++中cos,sin,asin,acos这些三角函数操作的是弧度,而非角度,你需要把角度转化为弧度.弧度=角度*Pi/180;例子1:比如对边和邻边分别为a,b 设角度为x,则 x=atan(a/b); 其中x为弧度制 如需转换为角度值,则x*180/3.1415例子2: //...
2018-03-17 08:07:48 18411
原创 next_permutation-做题之看不懂题解
以一道题打头:将1,2,…,9共9个数分成三组,分别组成三个三位数,且使这三个三位数的比例是A:B:C,试求出所有满足条件的三个三位数,若无解,输出“No!!!”。解:1- 每个数不可重复 ;2- 比例未定;3- 三个数都为三位数;可以枚举(123-327),根据A:B:C这一比例得到其余两个数(判断能否整除),然后用一bool类型数组标记,判断是否符合1-9这一要求。(判断九个数是否刚好为1-9...
2018-03-16 00:18:47 285
原创 一个打了激素的数组--python列表(课堂笔记)
十,一个打了激素的数组 1,可以包含整数,浮点数,字符串,对象。 1- 创建一个普通列表: 2- 创建一个混合列表 3- 创建一个空列表 2,向列表里添加元素 1- append(): 将括号内元素添加到列表末尾 例1: ...
2018-03-16 00:12:17 289
原创 python-七,八,九了不起的分支和循环(课堂笔记)
七,了不起的分支和循环1 八,了不起的分支和循环21,elif 相当于else if2,Python可以有效避免“悬挂else”。(强调缩进的重要性,与c++不同)3,条件表达式(三元操作符)例:x, y = 4 , 5if x < y :small = xelse :small = y可以改进为:small = x if x < y else y4,assert(断言) ...
2018-03-16 00:10:43 256
原创 六,Python之常用操作符(课堂笔记)
1,算数运算符:+;-;*;/(简化用法同c++);%; **:幂运算符 //:地板除法(对除法结果使用floor()函数) 2,比较操作符: 3,逻辑操作符:and(相当于c++中的&&) ; or(相当于c++中的 || ) ; not(对其后变量进行布尔类型的相反值)参考...
2018-03-16 00:08:32 161
原创 五,闲聊之Python的数据类型
1,Python的数值类型1- 整型2- 浮点型(区分整型与浮点型的唯一依据是是否有小数点 。)3- 布尔型:有两个值 true(相当于1) ,false(相当于0)。(可以用来计算,例:ture+true=2,但是不妥,尽量不要用)4- e计法:科学计数法例:1.5 e 4=150002,类型转换1- 转换及为整型:int()。例1:a=‘520’ b=int(a) b 将得到:520例...
2018-03-16 00:05:47 286
转载 setprecision、fixed、showpoint的用法总结
转载于http://www.cnblogs.com/My-Sunshine/p/4889183.html 首先要加头文件:iomanip一:setprecision 作用:控制输出流显示浮点数的数字个数,setprecision(n)就是输出的n个数,会有四舍五入。 比如:double s=20.7843000, cout<<setprecision(1)...
2018-03-15 18:08:26 773
原创 题目--台阶问题
题目描述有N级的台阶,你一开始在底部,每次可以向上迈最多K级台阶(最少1级),问到达第N级台阶有多少种不同方式。输入输出格式输入格式:输入文件的仅包含两个正整数N,K。输出格式:输入文件stair.out仅包括1个正整数,为不同方式数,由于答案可能很大,你需要输出mod 100003后的结果。输入输出样例输入样例#1: 5 2 输出样例#1: 8说明对于20%的数据,有N ≤...
2018-03-02 10:35:17 1539
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人