08 2016 档案
摘要:Description Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd. Input The only l
阅读全文
摘要:Description You are given n points on a line with their coordinates xi. Find the point x so the sum of distances to the given points is minimal. Descr
阅读全文
摘要:Description he only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is
阅读全文
摘要:Description Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triple
阅读全文
摘要:Description Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of
阅读全文
摘要:Description Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of
阅读全文
摘要:Description Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a sequence of vertices, such that first one is conn
阅读全文
摘要:Description Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's
阅读全文
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=5806 题意:有多少个区间里的第 k 大的数不小于 m 解法:尺取法,首先我们用dp[i]保存到i的位置有多少大于m的数 l=1,r=1,r开始遍历,只要符合dp[l]-dp[r]==k就是sum+=(n-r
阅读全文
摘要:链接:http://acm.hdu.edu.cn/showproblem.php?pid=5805 题意:删除数列中一个数,找出相邻之差绝对值最大,求依次删除最大值的和 解法:删除边缘位置的数字需要注意 它们的差就是 a[i-1]-a[i-2] ,a[i+2]-a[i+1],a[i-1]-a[i+1
阅读全文
摘要:链接http://acm.hdu.edu.cn/showproblem.php?pid=5804 题意:给你一些商店和他的商品价格,然后给你一个记账本,问你记大了就是1,否则是0 解法:模拟,注意测试数据大小
阅读全文
摘要:Description Little Mishka is a great traveller and she visited many countries. After thinking about where to travel this time, she chose XXX — beautif
阅读全文
摘要:Description Mishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in a wonderful sunn
阅读全文