- 博客(188)
- 问答 (3)
- 收藏
- 关注
原创 xtu 1268 Strange Optimization 湘潭邀请赛I
Strange OptimizationBobo is facing a strange optimization problem. Given n,m, he is going to find a real number α such that f(12+α) is maximized, where f(t)=mini,j∈Z|in−jm+t|. Help him!Not
2017-05-16 11:08:29 1105
原创 xtu 1267 Highway 湘潭邀请赛H
HighwayIn ICPCCamp there were n towns conveniently numbered with 1,2,…,n connected with (n−1) roads. The i-th road connecting towns ai and bi has length ci. It is guaranteed that any two
2017-05-16 11:06:16 1176
原创 xtu 1266 Parentheses 2017湘潭邀请赛G
ParenthesesBobo has a very long sequence divided into n consecutive groups. The i-th group consists of li copies of character ci where ci is either "(" or ")".As the sequence may not be va
2017-05-16 11:04:05 776
原创 xtu 1264 Partial Sum 2017湘潭邀请赛E
Partial SumBobo has a integer sequence a1,a2,…,an of length n. Each time, he selects two ends 0≤lr≤n and add |∑rj=l+1aj|−C into a counter which is zero initially. He repeats the selection fo
2017-05-16 11:01:10 880
原创 2016长城信息杯中国大学生程序设计竞赛中南邀请赛 xtu 1243 2016
http://www.dengwenhuo.cn/?id=194Given a2×2 matrixA=(a 11 a 21 a 12 a 22 ), findA n whereA 1 =A,A n =A×A n−1 . As the result may be large, you are going to find onl
2016-06-20 13:44:28 1368 2
原创 2016长城信息杯中国大学生程序设计竞赛中南邀请赛 xtu 1249 Rolling Variance
Bobo learnt that the variance of a sequencea1,a2,…,anis∑ni=1(ai−a¯)2n−1−−−−−−−−−−−−√wherea¯=∑ni=1ain.Bobo has a sequencea1,a2,…,an, and he would like to find the variance o
2016-06-20 13:42:24 1285
原创 2016长城信息杯中国大学生程序设计竞赛中南邀请赛 xtu 1250 Super Fast Fourier Transform
http://www.dengwenhuo.cn/?id=196Bobo has two sequences of integers{a1,a2,…,an}and{b1,b2,…,bm}. He would like to find∑i=1n∑j=1m⌊|ai−bj|−−−−−−−√⌋.Note that⌊x⌋denotes the maximum intege
2016-06-20 13:41:26 1319
原创 2016长城信息杯中国大学生程序设计竞赛中南邀请赛 xtu 1245 Hamiltonian Path
http://www.dengwenhuo.cn/?id=197In ICPCCamp, there arencities andmdirected roads between cities. Thei-th road going from theai-th city to thebi-th city iscikilometers long. For each
2016-06-20 13:40:01 1227
原创 2016长城信息杯中国大学生程序设计竞赛中南邀请赛 xtu 1244 Gambling
http://www.dengwenhuo.cn/?id=199In ICPCCamp, gambling is conducted as follow. A player will draw balls from an opaque bag containingared balls,bgreen balls andcblue balls initially. Balls
2016-06-20 13:38:37 2135
原创 2016长城信息杯中国大学生程序设计竞赛中南邀请赛 xtu 1246 Heartstone
http://www.dengwenhuo.cn/?id=201Bobo is playing Heartstone. There arenminions in the battlefield. Thei-th minion hashihit points (HP).Bobo uses two kinds of magic. The one is Arcane Sh
2016-06-20 13:37:15 1974
原创 2016长城信息杯中国大学生程序设计竞赛中南邀请赛 xtu 1252 Defense Tower
http://www.dengwenhuo.cn/?id=200In ICPCCamp, there arencities and(n−1)(bidirectional) roads between cities. Thei-th road is between theai-th andbi-th cities. It is guaranteed that citi
2016-06-20 13:34:33 1459
原创 模板收集
ll exmod[100005],rmod[100005];ll multimod(ll a,ll b,ll mod){ ll ans = 0; for ( ; b; b >>= 1, a = (a<<1)%mod) if (b&1) { ans = (ans + a)%mod; }
2016-05-22 21:20:22 527
原创 hdu 3068 最长回文 Manacher算法
http://acm.hdu.edu.cn/showproblem.php?pid=3068#include #include #include #include #include using namespace std;int main(){ char s[220005],str[220005]; int p[220005],n; int an
2016-05-01 20:02:07 602
原创 加油
Problem Description NightGuard非常喜欢开车旅行。每年5.1节,他都要开着自己的车到一个风景比较好的地方去度假。由于路途遥远,汽车的油箱容量有限,装不下足够的汽油。NightGuard想了一个办法,自己再带上一个桶,用桶来装汽油,这样,汽油就不会不够了。 现在的问题是这样的,油箱一开始是满的,NightGuard想要用桶装尽可能多的汽油.桶的体积为V,路上总
2016-04-15 18:24:32 865
转载 dijkstra算法实现
#include #include using namespace std;const int maxnum = 100;const int maxint = 999999;// 各数组都从下标1开始int dist[maxnum]; // 表示当前点到源点的最短路径长度int prev[maxnum]; // 记录当前点的前一个结点int c[maxnum][
2016-03-15 20:08:09 497
原创 hdu 5635 LCP Array
http://acm.hdu.edu.cn/showproblem.php?pid=5635题意:给你一串数字 如54 3 2 1 04就表示 前4个字母和从第二个开始的4个字母是一样的 也就是说 这5个字母都是一样的再验证一下 3 从第二个开始的后3个字母 和从第三个开始的后3个字母 都是一样的 成立首先 只存在连续减小和0的情况 否则都是0#in
2016-03-05 22:14:18 827
原创 hdu 1073 Online Judge
http://acm.hdu.edu.cn/showproblem.php?pid=1073注意清空#include #include #include using namespace std;int main(){ int cas; char ans1[5005],ans2[5005],ans3[5005],ans4[5005],temp[5005];
2016-03-04 13:34:19 785
原创 hd 1070 Milk
http://acm.hdu.edu.cn/showproblem.php?pid=1070#include #include #include using namespace std;struct milk{ char name[1000]; double money,ml; double val; int day;}m[105];
2016-03-04 11:39:41 692
原创 小巧妙
约瑟夫问题#include #include int main( void ){ int n, i, m, p,t; while(~scanf("%d %d", &n, &m)) { t=1; i=0; while( ++i <= n ) { p = i * m;
2015-12-22 18:41:59 553
原创 poj 1786 Bridge Hands
Drivers of Advanced Cargo Movement, Ltd. usually have to wait quite a long time when waiting at border crossings for duty clearance. They are used to play various (card) games to have some fun. One of
2015-12-13 18:11:02 742
原创 年月日计算星期公式
if( M==1 || M==2 ) { M+=12; --Y; } //1582年9月3日后:w = (d + 2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7; //1582年9月3日前:w = (d+2*m+3*(m+1)/5+y+y/4+5) % 7; //蔡勒公式 0是星期天 if( Y < 1582 ||
2015-12-09 11:16:43 1329
转载 java保留小数
import java.math.BigDecimal;import java.text.DecimalFormat;import java.text.NumberFormat;public class Format { double f = 111231.5585; public void m1() { BigDecimal bg = new BigDecimal(f);
2015-10-16 17:05:24 662
原创 hdu 1061 Rightmost Digit
Problem DescriptionGiven a positive integer N, you should output the most right digit of N^N. InputThe input contains several test cases. The first line of the input is a single in
2015-10-08 15:09:36 551
原创 UVA 1585 Score
There is an objective test result such as ``OOXXOXXOOO". An `O' means a correct answer of a problem and an `X' means a wrong answer. The score of each problem of this test is calculated by itself and
2015-09-06 17:57:00 753
原创 ZOJ 3210 A Stack or A Queue?
Do you know stack and queue? They're both important data structures. A stack is a "first in last out" (FILO) data structure and a queue is a "first in first out" (FIFO) one.Here comes the problem:
2015-09-06 17:48:48 542
原创 ZOJ 2975 Kinds of Fuwas
In the year 2008, the 29th Olympic Games will be held in Beijing. This will signify the prosperity of China as well as becoming a festival for people all over the world.The official mascots of Bei
2015-09-06 15:35:05 548
原创 ZOJ 2971 Give Me the Number
Numbers in English are written down in the following way (only numbers less than109 are considered). Number abc,def,ghi is written as "[abc] million[def] thousand [ghi]". Here "[xyz] " means the w
2015-09-06 15:26:19 555
原创 ZOJ 2969 Easy Task
Calculating the derivation of a polynomial is an easy task. Given a function f(x) , we use (f(x))' to denote its derivation. We use x^n to denote xn. To calculate the derivation of a polynomial, you s
2015-09-06 15:24:10 525
原创 ZOJ 2965 Accurately Say "CocaCola"!
In a party held by CocaCola company, several students stand in a circle and play a game.One of them is selected as the first, and should say the number 1. Then they continue to count number from 1 o
2015-09-06 15:22:41 524
原创 UVA 12290 Counting Game
There are n people standing in a line, playing a famous game called \counting". When the game begins,the leftmost person says \1" loudly, then the second person (people are numbered 1 to n from left
2015-09-06 15:08:45 578
原创 UVA 12289 One-Two-Three
Your little brother has just learnt to write one, two and three, in English. He has written a lot of thosewords in a paper, your task is to recognize them. Note that your little brother is only a ch
2015-09-06 14:46:52 545
原创 ZOJ 3787 Access System
For security issues, Marjar University has an access control system for each dormitory building.The system requires the students to use their personal identification cards to open the gate if they wan
2015-09-06 14:39:09 518
原创 ZOJ 3785 What day is that day?
It's Saturday today, what day is it after 11 + 22 + 33 + ... +NN days? InputThere are multiple test cases. The first line of input contains an integer T indicating the number of test c
2015-09-06 14:36:49 672
原创 ZOJ 3778 Talented Chef
As we all know, Coach Gao is a talented chef, because he is able to cookM dishes in the same time. Tonight he is going to have a hearty dinner with his girlfriend at his home. Of course,Coach Gao
2015-09-06 14:34:49 599
原创 ZOJ 3714 Java Beans
There are N little kids sitting in a circle, each of them are carrying some java beans in their hand. Their teacher want to selectM kids who seated in M consecutive seats and collect java beans from
2015-09-06 13:46:07 2052
原创 ZOJ 3713 In 7-bit
Very often, especially in programming contests, we treat a sequence of non-whitespace characters as a string. But sometimes, a string may contain whitespace characters or even be empty. We can have su
2015-09-06 13:41:19 483
原创 ZOJ 3712 Hard to Play
MightyHorse is playing a music game called osu!. After playing for several months, MightyHorse discovered the way of calculating score inosu!: 1. While playing osu!, player need to click som
2015-09-06 13:32:32 517
原创 ZOJ 3710 Friends
Alice lives in the country where people like to make friends. The friendship is bidirectional and if any two person have no less thank friends in common, they will become friends in several days. Cu
2015-09-06 13:27:18 423
原创 ZOJ 3708 Density of Power Network
The vast power system is the most complicated man-made system and the greatest engineering innovation in the 20th century. The following diagram shows a typical 14 bus power system. In real world, the
2015-09-06 13:24:57 510
原创 ZOJ 3878 Convert QWERTY to Dvorak
Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY Keyboard with a brokenCaps Lock key, so Edward never presses the brokenCaps Lock key. Luckily, all the othe
2015-09-06 12:59:09 1459
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人