- 博客(16)
- 收藏
- 关注
原创 魔法宝石
Description小s想要创造n种魔法宝石。小s可以用ai的魔力值创造一棵第i种魔法宝石,或是使用两个宝石合成另一种宝石(不消耗魔力值)。请你帮小s算出合成某种宝石的所需的最小花费。 Input第一行为数据组数T(1≤T≤3)。 对于每组数据,首先一行为n,m(1≤n,m≤10^5)。分别表示魔法宝石种类数和合成魔法的数量。 之后一行n个数表示a1到an。(1≤ai≤10^9)。a_i表示合
2017-04-23 21:02:54 624 3
原创 Aladdin and the Flying Carpet 唯一分解定理
DescriptionIt’s said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery.Aladdin was about to enter t
2017-04-23 18:06:47 362
原创 ch追妹 博弈
Descriptionn个点的一张无向图,ch站在a点,ch要追的妹子站在b点。r_clover为了让ch安心训练,要阻止ch追妹。ch每走一步,r_clover就会挖断一条路。ch和r_clover均采用最优策略,问ch能不能追到妹子 Input第一行为数据组数T(T≤10)。 每组数据的第一行为四个数 n,m,a,b(1≤a,b≤n≤20; 1≤m≤80),分别表示点数,边数,ch的位置,妹子
2017-04-23 17:00:13 499
原创 奇数最大子段和 dp
Description一个大小为n的数组a1到an(−10^4≤ai≤10^4)。请你找出一个连续子段,使子段长度为奇数,且子段和最大。 Input第一行为T(1≤T≤5),代表数据组数。 之后每组数据,第一行为n(1≤n≤10^5),代表数组长度。 之后一行n个数,代表a1到anOutput每组数据输出一行,表示满足要求的子段和最大值Sample Input1 4 1 2 3 4Sampl
2017-04-23 16:53:35 703 2
原创 Joseph's Problem 数论 找规律
Joseph likes taking part in programming contests. His favorite problem is, of course, Joseph’s problem. It is stated as follows. There are n persons numbered from 0 to n - 1 standing in a circle. The
2017-04-20 23:06:00 593 1
原创 Bi-shoe and Phi-shoe 线筛欧拉函数
Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for his students, so he asked his assistant Bi-Shoe to go
2017-04-18 22:03:03 365
原创 Pairs Forming LCM 唯一分解定理
Find the result of the following code:long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) for( int j = i; j <= n; j++ ) if( lcm(i, j) == n
2017-04-18 18:26:47 396
原创 CD Making
Tom has NN songs and he would like to record them into CDs. A single CD can contain at most KK songs. In addition, Tom is very superstitious and he believes the number 13 would bring bad luck, so he wi
2017-04-15 11:17:50 282
原创 ants run 题意理解
Professor Yang likes to play with ants when he is free. What? Are you asking why he plays with ants instead of others? Ah, because ant is the only non-plant living thing which can be found in Qingshuih
2017-04-15 11:02:40 637
原创 Finding LCM gcd
LCM is an abbreviation used for Least Common Multiple in Mathematics. We say LCM (a, b, c) = L if and only if L is the least integer which is divisible by a, b and c.You will be given a, b and L. You h
2017-04-14 11:25:35 414
原创 How Many Points? gcd
Given two points A and B on the X-Y plane, output the number of the lattice points on the segment AB. Note that A and B are also lattice point. Those who are confused with the definition of lattice poi
2017-04-14 10:03:22 605
原创 Non-square Equation 数学
Let’s consider equation:x2 + s(x)·x - n = 0, where x, n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.You are given an integer n, fi
2017-04-13 22:19:12 478 1
原创 Bungee Jumping 物理题 能量关系
Once again, James Bond is fleeing from some evil people who want to see him dead. Fortunately, he has left a bungee rope on a nearby highway bridge which he can use to escape from his enemies. His plan
2017-04-13 21:20:40 332
原创 Fibsieve`s Fantabulous Birthday 找规律
Fibsieve had a fantabulous (yes, it’s an actual word) birthday party this year. He had so many gifts that he was actually thinking of not having a party next year.Among these gifts there was an N x N g
2017-04-12 16:58:39 258
原创 青蛙的约会 扩展欧几里得
两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,你
2017-04-11 20:28:20 356 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人