A. Voting for Photos 题目连接: http://www.codeforces.com/contest/637/problem/A Description After celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct a vote for the best photo. They published t…
今天在codeforces上面做到一道题:http://codeforces.com/contest/638/problem/B 题目大意是:给定n个字符串,找到最短的字符串S使得n个字符串都是这个字符串S的子串. 题目里有一个限制条件是每个字母都最多出现一次,所以可以用下面的方法来解决: http://codeforces.com/contest/638/submission/16900955 然后我想到如果问题没有“每个字母最多只出现一次”这个限制的话应该怎么解决. 暂时还在想………
D. Three-dimensional Turtle Super Computer 题目连接: http://www.codeforces.com/contest/638/problem/D Description A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepip…
C. Road Improvement 题目连接: http://www.codeforces.com/contest/638/problem/C Description In Berland there are n cities and n - 1 bidirectional roads. Each road connects some pair of cities, from any city you can get to any other one using only the given…
B. Making Genome in Berland 题目连接: http://www.codeforces.com/contest/638/problem/B Description Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has notin…
A. Home Numbers 题目连接: http://www.codeforces.com/contest/638/problem/A Description The main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with od…
D. Running with Obstacles 题目连接: http://www.codeforces.com/contest/637/problem/D Description A sportsman starts from point xstart = 0 and runs to point with coordinate xfinish = m (on a straight line). Also, the sportsman can jump - to jump, he should…
C. Promocodes with Mistakes 题目连接: http://www.codeforces.com/contest/637/problem/C Description During a New Year special offer the "Sudislavl Bars" offered n promo codes. Each promo code consists of exactly six digits and gives right to one free…
B. Chat Order 题目连接: http://www.codeforces.com/contest/637/problem/B Description Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his fri…
A. Voting for Photos time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output After celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct…
B. Chat Order time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that wh…
题目地址:http://blog.csdn.net/shiyuankongbu/article/details/10004443 /* 题意:在i前面找回文子串,在i后面找回文子串相互配对,问有几对 DP:很巧妙的从i出发向两头扩展判断是否相同来找回文串 dpr[i] 代表记录从0到i间的回文子串的个数,dpl[i] 代表记录i之后的回文子串个数 两两相乘就行了 详细解释:http://blog.csdn.net/shiyuankongbu/article/details/10004443 */…
Facebook Hacker Cup 2014 Qualification Round比赛Square Detector题的解题报告.单击这里打开题目链接(国内访问需要那个,你懂的). 原题如下: Square Detector Problem Description You want to write an image detection system that is able to recognize different geometric shapes. In the first ver…
2014 Qualification Round Solutions 2013年11月25日下午 1:34 ...最简单的一题又有bug...自以为是真是很厉害! 1. Square Detector (20 Points) When facing a problem in a programming contest there are three main things to consider when planning your solution. In order of importanc…
B. Photo to Remember Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/522/problem/B Description One day n friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together…
题目链接:http://codeforces.com/contest/158/problem/E E. Phone Talks time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Cool J has recently become a businessman Mr. Jackson, and he has to make a l…
C. Cd and pwd commands Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/158/C Description Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he dec…
C. String Manipulation 1.0 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 codeforces.com/problemset/problem/91/B Description One popular website developed an unusual username editing procedure. One can change the username only by deleting some characte…
Cd and pwd commands time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he…
题目链接: http://codeforces.com/problemset/problem/522/D D. Closest Equals time limit per test3 secondsmemory limit per test256 megabytes 问题描述 You are given sequence a1, a2, ..., an and m queries lj, rj (1 ≤ lj ≤ rj ≤ n). For each query you need to print…
D. Closest Equals Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/problem.php?id=3224 Description You are given sequence a1, a2, ..., an and m queries lj, rj (1 ≤ lj ≤ rj ≤ n). For each query you need to print the minimu…
传送门 A. Reposts time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One day Polycarp published a funny picture in a social network making a poll about the color of his handle. Many of his friend…
D. Jerry's Protest 题目连接: http://www.codeforces.com/contest/626/problem/D Description Andrew and Jerry are playing a game with Harry as the scorekeeper. The game consists of three rounds. In each round, Andrew and Jerry draw randomly without replaceme…
暴力 A - Orchestra import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner (System.in); int r = cin.nextInt (); int c = cin.nextInt (); int n = cin.nextInt (); int k = cin.nextInt ();…
在家补补题   模拟 A - Robot Sequence #include <bits/stdc++.h> char str[202]; void move(int &x, int &y, char ch) { if (ch == 'U') x--; if (ch == 'D') x++; if (ch == 'L') y--; if (ch == 'R') y++; } int main(void) { int n; scanf ("%d", &…
题目链接:http://codeforces.com/contest/626/problem/C 题意就是给你n个分别拿着2的倍数积木的小朋友和m个分别拿着3的倍数积木的小朋友,每个小朋友拿着积木的数量互不相同,求小朋友中拿着最大积木数的最小的情况(有点绕). 那最坏的情况就是2n或者3m,假设最大的积木数为x,x肯定能被2或3整除,那么x/2就是2的倍数个数,x/3就是3的倍数的个数,x/6就是6的倍数的个数. 因为这个数据量很小,那么只要暴力寻找刚好符合x/3 + x/2 - x/6 >=…
C. Lieges of Legendre 题意:给n,m表示有n个为2的倍数,m个为3的倍数:问这n+m个数不重复时的最大值 最小为多少? 数据:(0 ≤ n, m ≤ 1 000 000, n + m > 0) ps:很水的题,主要是策略: 思路:由于里面每隔6就会重复一次,不好直接模拟,并且模拟的效率很低,那就二分吧!二分即上界为2单独的最大倍数与3单独时的最大倍数之和,下界为前面二者的max;之后利用判断是否mid/2 >= n && mid/3 >= m &am…
E - Preorder Test 思路:想到二分答案了之后就不难啦, 对于每个答案用树形dp取check, 如果二分的值是val, dp[ i ]表示 i 这棵子树答案不低于val的可以访问的 最多节点, 第二次dfs求出以每个点为根的答案. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PII pair<int,…
F - Group Projects 题目大意:给你n个物品, 每个物品有个权值ai, 把它们分成若干组, 总消耗为每组里的最大值减最小值之和. 问你一共有多少种分组方法. 思路:感觉刚看到的时候的想法是先排好序, dp[ i ][ j ][ k ]表示已经划分了 i 个, 并且分成了 j 组, 目前为止的总消耗为k的方案总数. 但是这个状态没有办法转移, 题解提供了一种将贡献分段的方法, 比如说原数组为1 2 3 6 7 8 10, 其中一组里面有 1 3 7 8 那么我们不是 直接计算出(8…
A. Orchestra time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Paul is at the orchestra. The string section is arranged in an r × c rectangular grid and is filled with violinists with the ex…