二分
聪明绝顶的你与即将秃头的我
这个作者很懒,什么都没留下…
展开
-
二分查找的种种
1.从一组有序数组里找出值为target的数对应的下标:private int binarySearch(int[] nums,int target) { int left=0,right=nums.length-1; while(right>=left) { int mid=left+(right-left)>>1; if(nums[mid]==target) return mid; if(n原创 2020-05-10 19:25:46 · 158 阅读 · 0 评论 -
人见人爱A-B
Problem Description参加过上个月月赛的同学一定还记得其中的一个最简单的题目,就是{A}+{B},那个题目求的是两个集合的并集,今天我们这个A-B求的是两个集合的差,就是做集合的减法运算。(当然,大家都知道集合的定义,就是同一个集合中不会有两个相同的元素,这里还是提醒大家一下)呵呵,很简单吧? Input每组输入数据占1行,每行数据的开始是2个整数n(0<=n<=100...原创 2018-05-29 19:10:43 · 124 阅读 · 0 评论 -
Can you find it?
Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj+Ck = X. InputThere are...原创 2018-04-15 11:01:01 · 503 阅读 · 0 评论 -
Strange fuction
Now, here is a fuction: F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100) Can you find the minimum value when x is between 0 and 100.InputThe first line of the input contains an integer T(1&...原创 2018-04-10 23:02:13 · 278 阅读 · 0 评论 -
Can you solve this equation
Now,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; Now please try your lucky.InputThe first line of the input contains an integer T(1<=T<=10...原创 2018-04-10 20:18:23 · 365 阅读 · 1 评论 -
Cup
The WHU ACM Team has a big cup, with which every member drinks water. Now, we know the volume of the water in the cup, can you tell us it height? The radius of the cup's top and bottom circle is known...原创 2018-04-11 16:57:20 · 462 阅读 · 0 评论 -
Pie
My 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 party and each of ...原创 2018-04-13 19:11:32 · 1331 阅读 · 0 评论