- 博客(18)
- 收藏
- 关注
原创 牛客 丢手绢
“丢~丢~丢手绢,轻轻地放在小朋友的后面,大家不要告诉她,快点快点抓住她,快点快点抓住她。”牛客幼儿园的小朋友们围成了一个圆圈准备玩丢手绢的游戏,但是小朋友们太小了,不能围成一个均匀的圆圈,即每个小朋友的间隔可能会不一致。为了大家能够愉快的玩耍,我们需要知道离得最远的两个小朋友离得有多远(如果太远的话牛老师就要来帮忙调整队形啦!)。因为是玩丢手绢,所以小朋友只能沿着圆圈外围跑,所以我们定义两个小朋友的距离为沿着圆圈顺时针走或者逆时针走的最近距离。第一行一个整数N,表示有N个小朋友玩丢手绢的游戏。接下来的第
2022-07-02 10:43:14
345
原创 牛客 货仓选址
在一条数轴上有N家商店,它们的坐标分别为 A[1]~A[N]。现在需要在数轴上建立一家货仓,每天清晨,从货仓到每家商店都要运送一车商品。为了提高效率,求把货仓建在何处,可以使得货仓到每家商店的距离之和最小。第一行一个整数N,第二行N个整数A[1]~A[N]。输出描述:一个整数,表示距离之和的最小值。输入46 2 9 1输出12备注:对于100%的数据:N≤100000, A[i]≤1000000——————————————————————————
2022-07-02 09:31:19
232
原创 牛客[CQOI2009]中位数图
给出1~n的一个排列,统计该排列有多少个长度为奇数的连续子序列的中位数是b。中位数是指把所有元素从小到大排列后,位于中间的数。第一行为两个正整数n和b ,第二行为1~n 的排列。输出描述:输出一个整数,即中位数为b的连续子序列个数。输入7 45 7 2 4 3 1 64对于30%的数据中,满足 n≤100;对于60%的数据中,满足 n≤1000;对于100%的数据中,满足 n≤100000,1≤b≤n。————————————————————
2022-06-30 11:53:53
406
原创 牛客网[NOIP2016]回文日期
在日常生活中,通过年、月、日这三个要素可以表示出一个唯一确定的日期。牛牛习惯用8位数字表示一个日期,其中,前4位代表年份,接下来2位代表月份,最后2位代表日期。显然:一个日期只有一种表示方法,而两个不同的日期的表示方法不会相同。牛牛认为,一个日期是回文的,当且仅当表示这个日期的8位数字是回文的。现 在,牛牛想知道:在他指定的两个日期之间包含这两个日期本身),有多少个真实存在的日期是回文的。一个8位数字是回文的,当且仅当对于所有的i ( 1 ...
2022-06-18 19:13:47
392
原创 Codeforces#799(Div4)F. 3SUM
Given an array a of positive integers with length n, determine if there exist three distinct indices i, j, k such that ai+aj+ak ends in the digit 3.InputThe first line contains an integer t (1≤t≤1000) — the number of test cases.The first line of each test
2022-06-17 23:37:12
513
原创 Codeforces#799(Div4)E. Binary Deque
Slavic has an array of length n consisting only of zeroes and ones. In one operation, he removes either the first or the last element of the array.What is the minimum number of operations Slavic has to perform such that the total sum of the array is equal
2022-06-17 21:13:33
659
原创 Codeforces 799(Div.4) D. The Clock
Victor has a 24-hour clock that shows the time in the format "HH:MM" (00 ≤ HH ≤ 23, 00 ≤ MM ≤ 59). He looks at the clock every x minutes, and the clock is currently showing time s.How many different palindromes will Victor see in total after looking at the
2022-06-16 17:33:01
415
原创 Codeforces 797(div3)E. Price Maximization
A batch of n goods (n — an even number) is brought to the store, i-th of which has weight ai. Before selling the goods, they must be packed into packages. After packing, the following will be done:With this, the cost of a package of weight x is always ⌊x/k
2022-06-09 23:32:34
301
原创 Codeforce A. Everything Everywhere All But One
You are given an array ofnnintegersa1,a2,…,ana1,a2,…,an. After you watched the amazing film "Everything Everywhere All At Once", you came up with the following operation.In one operation, you choosen−1n−1elements of the array and replace each ...
2022-05-29 17:01:49
351
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人