- 博客(85)
- 问答 (1)
- 收藏
- 关注
原创 ZOJ - 2311 翻译英文数字
In this problem, you will be given one or more integers in English. Your task is to translate these numbers into their integer representation. The numbers can range from negative 999,999,999 to positi
2017-04-04 17:24:15
875
原创 乱七八糟
一、i/o:c++:getline(cin,s); istringstream is(line); while(is>>s) coutsprintf(s,"%d",i); 数字 -> 字符串%d: "%8d": 制定位数8,少补空格。"%08d": 8位补0 "%-8d":
2017-04-04 17:15:23
390
原创 Codeforces Round #369 (Div. 2) C. Coloring Trees 三维dp
C. Coloring Treestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputZS the Coder and Chris the Baboon has arrived at Ud
2016-09-08 15:26:55
553
原创 M.LCS打印
#include #include #include #include #include using namespace std;char a[1000 + 5],b[1000 + 5];int dp[1000 + 5][1000 +5];int dis[1000 + 5][1000 + 5][2];int main(){ scan
2016-09-08 15:25:12
314
原创 BestCoder Round #85 1003 abs
问题描述给定一个数x,求正整数y≥2y\geq 2y≥2,使得满足以下条件:1.y-x的绝对值最小2.y的质因数分解式中每个质因数均恰好出现2次。输入描述第一行输入一个整数T(1≤T≤501\leq T\leq 501≤T≤50)每组数据有一行,一个整数x(1≤x≤10181\leq x\leq {10}^{18}1≤x≤1018)输出描述对于每组数据,输出一行
2016-08-15 10:24:33
424
原创 多校6 A Boring Question 5793
A Boring QuestionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 635 Accepted Submission(s): 375Problem DescriptionThere are an e
2016-08-08 16:04:51
366
原创 多校4 5775 Bubble Sort
Bubble SortTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 963 Accepted Submission(s): 568Problem DescriptionP is a permutation o
2016-08-08 15:05:25
384
原创 多校4 Another Meaning 5763
Another MeaningTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1266 Accepted Submission(s): 595Problem DescriptionAs is known to
2016-08-08 10:46:02
353
原创 多校4 The All-purpose Zero 5773
The All-purpose ZeroTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1503 Accepted Submission(s): 717Problem Description?? gets an
2016-08-08 09:14:14
328
原创 多校3 5761 Rower Bo
Rower BoTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1327 Accepted Submission(s): 506Special JudgeProblem DescriptionThere i
2016-08-07 21:05:40
662
4
原创 BestCoder Round #84 1004Dertouzos
Problem DescriptionA positive proper divisor is a positive divisor of a numbern, excluding n itself. For example, 1, 2, and 3 are positive proper divisors of 6, but 6 itself is not.Peter h
2016-07-30 11:50:43
321
原创 BestCoder Round #84 1002 Bellovin
Problem DescriptionPeter has a sequence a1,a2,...,an and he define a function on the sequence -- F(a1,a2,...,an)=(f1,f2,...,fn), where fi is the length of the longest increasing subsequence en
2016-07-30 11:39:26
345
原创 BestCoder Round #841001Aaronson
AaronsonTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 684 Accepted Submission(s): 383Problem DescriptionRecently, Peter saw t
2016-07-30 11:33:33
384
原创 Codeforces#364(Div.2)B.Cell Not Under Attack
Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under
2016-07-29 20:54:29
419
原创 Codeforces #363 (Div. 2) D. Fix a Tree
D. Fix a Treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA tree is an undirected connected graph witho
2016-07-29 20:35:53
394
原创 Codeforces#363 (Div. 2) C.Vacations
Vasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was
2016-07-29 20:30:32
307
原创 Codeforces #363(Div.2) B.One Bomb
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*").You have one bomb. If you
2016-07-29 20:22:22
327
原创 多校1.Abandoned country1001
点击打开链接Problem DescriptionAn abandoned country has n(n≤100000) villages which are numbered from 1 to n. Since abandoned for a long time, the roads need to be re-built. There are m(m≤10000
2016-07-22 16:16:38
522
原创 多校2.Keep On Movin
点击打开链接Problem DescriptionProfessor Zhang has kinds of characters and the quantity of the i-th character is ai. Professor Zhang wants to use all the characters build several palindromic s
2016-07-22 15:44:03
393
原创 多校2.1012La Vie en rose
点击打开链接Problem DescriptionProfessor Zhang would like to solve the multiple pattern matching problem, but he only has only one pattern string p=p1p2...pm. So, he wants to generate as many as
2016-07-22 15:34:30
453
原创 06:最短前缀
总时间限制: 1000ms 内存限制: 65536kB描述一个字符串的前缀是从该字符串的第一个字符起始的一个子串。例如 "carbon"的字串是: "c", "ca", "car", "carb", "carbo", 和 "carbon"。注意到这里我们不认为空串是字串, 但是每个非空串是它自身的字串. 我们现在希望能用前缀来缩略的表示单词。例如, "carbohydrate" 通常用"car
2016-07-14 17:36:57
613
原创 05:字符环
总时间限制: 1000ms 内存限制: 65536kB描述有两个由字符构成的环。请写一个程序,计算这两个字符环上最长连续公共字符串的长度。例如,字符串“ABCEFAGADEGKABUVKLM”的首尾连在一起,构成一个环;字符串“MADJKLUVKL”的首尾连在一起,构成一个另一个环;“UVKLMA”是这两个环的一个连续公共字符串。输入一行,包含两个字符串,分别对应一个字符环。这两个字符
2016-07-14 17:33:27
855
原创 02:最大上升子序列和
总时间限制: 1000ms 内存限制: 65536kB描述一个数的序列bi,当b1 你的任务,就是对于给定的序列,求出最大上升子序列和。注意,最长的上升子序列的和不一定是最大的,比如序列(100, 1, 2, 3)的最大上升子序列和为100,而最长上升子序列为(1, 2, 3)输入输入的第一行是序列的长度N (1 输出最大上升子序列和样例输入71 7 3 5 9 4 8
2016-07-14 17:02:14
374
原创 L2-010. 排座位
布置宴席最微妙的事情,就是给前来参宴的各位宾客安排座位。无论如何,总不能把两个死对头排到同一张宴会桌旁!这个艰巨任务现在就交给你,对任何一对客人,请编写程序告诉主人他们是否能被安排同席。输入格式: 输入第一行给出3个正整数:N(<= 100),即前来参宴的宾客总人数,则这些人从1到N编号;M为已知两两宾客之间的关系数;K为查询的条数。随后M行,每行给出一对宾客之间的关系,格式为:“宾客
2016-07-14 16:51:34
952
原创 L2-008. 最长对称子串
对给定的字符串,本题要求你输出最长对称子串的长度。例如,给定"Is PAT&TAP symmetric?",最长对称子串为"s PAT&TAP s",于是你应该输出11。输入格式: 输入在一行中给出长度不超过1000的非空字符串。输出格式: 在一行中输出最长对称子串的长度。输入样例:Is PAT&TAP symmetric?输出样例:11有一天,某某
2016-07-14 16:28:03
345
原创 L2-002. 链表去重
给定一个带整数键值的单链表L,本题要求你编写程序,删除那些键值的绝对值有重复的结点。即对任意键值K,只有键值或其绝对值等于K的第一个结点可以被保留。同时,所有被删除的结点必须被保存在另外一个链表中。例如:另L为21→-15→-15→-7→15,则你必须输出去重后的链表21→-15→-7、以及被删除的链表-15→15。输入格式: 输入第一行包含链表第一个结点的地址、以及结点个数N(5 的正整
2016-07-14 15:24:34
509
原创 L2-004. 这是二叉搜索树吗?
一棵二叉搜索树可被递归地定义为具有下列性质的二叉树:对于任一结点,其左子树中所有结点的键值小于该结点的键值; 其右子树中所有结点的键值大于等于该结点的键值; 其左右子树都是二叉搜索树。 所谓二叉搜索树的“镜像”,即将所有结点的左右子树对换位置后所得到的树。 给定一个整数键值序列,现请你编写程序,判断这是否是对一棵二叉搜索树或其镜像进行前序遍历的结果。 输入格式: 输入的第一
2016-07-14 15:11:58
577
原创 L2-011. 玩转二叉树
给定一棵二叉树的中序遍历和前序遍历,请你先将树做个镜面反转,再输出反转后的层序遍历的序列。所谓镜面反转,是指将所有非叶结点的左右孩子对换。这里假设键值都是互不相等的正整数。输入格式: 输入第一行给出一个正整数N(输出格式: 在一行中输出该树反转后的层序遍历的序列。数字间以1个空格分隔,行首尾不得有多余空格。输入样例:71 2 3 4 5 6 74 1 3 2 6 5 7
2016-07-14 15:01:57
1372
原创 354 div2 C:两指针滑动区间
C. Vasya and Stringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputHigh school student Vasya got a string of length n
2016-05-27 16:04:06
359
原创 354diV2 B杨辉三角变形
B. Pyramid of Glassestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMary has just graduated from one well-known Univ
2016-05-26 21:31:19
532
原创 cf 671B Robin Hood
B. Robin HoodWe all know the impressive story of Robin Hood. Robin Hood uses his archery skills and his wits to steal the money from rich, and return it to the poor.There are n citizens in Kek
2016-05-26 13:39:13
657
原创 线段树飞机票
http://hihocoder.com/contest/challenge20/problem/1给出时间 票价,查询一段时间内最高票价。建树:①先用数组把时间日期对应存好,若同一天多张票取最高价的机票,没票的日期的票价初始化为0②把数组对应到树上(叶子节点??)#include#include#include#includeusing namespa
2016-05-23 19:18:48
376
原创 饭卡:先挑出最大的再把剩下的背包
HDU 2546饭卡余额大于等于5都可以买,给出饭卡买各种菜后使余额最小(可为负)最优法:先挑出最大的,饭卡金额减5再背包剩下的。
2016-05-22 21:05:54
376
原创 dp:注意列方程
AVL树的种类平衡二叉树(AVL树),是指左右子树高度差至多为1的二叉树,并且该树的左右两个子树也均为AVL树。 现在问题来了,给定AVL树的节点个数n,求有多少种形态的AVL树恰好有n个节点。Input一行,包含一个整数n。 (0 Output一行表示结果,由于结果巨大,输出它对1000000007取余数的结果。Input示例1
2016-05-22 20:14:01
392
原创 四一。 数论 。4.19(gcd 扩展gcd,素数 ,快速幂)
A 青蛙 POJ 1061 扩展gcd#include#include#includeusing namespace std;long long extgcd(long long a,long long b,long long &x,long long &y){ int d = a; if(b != 0) { d =
2016-04-12 10:33:46
491
原创 4.快排
#include void swap(int a[], int i, int j){ int t = a[i]; a[i] = a[j]; a[j] = t;}int partition(int a[], int p, int r){ int i = p; int j = r + 1; int x =
2016-04-09 22:15:45
371
原创 2.生日蜡烛
#includeusing namespace std;int main(){ int x,y; for( x=1,y=2; x for( y=x+1; (y+x)*(y-x+1) { //cout if((y+x)*(y-x+1) == 472) {
2016-04-09 22:15:13
415
原创 1.煤球
#includeusing namespace std;int main(){ int n; cin>>n; int temp = 0,sum = 0; for(int i=1; i { temp = temp + i; sum = sum + temp; //cout }
2016-04-09 22:14:20
327
原创 3.27 三二 F UVA 10608 最大朋友圈 并查集
#include#includeusing namespace std;int N,M;int father[30005],a[30005]; /// father存i的父亲节
2016-04-06 22:06:19
488
空空如也
qq官网的一段源码a标签里有个pgv
2017-03-03
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅