Coder-Strike 2014 - Round 2】的更多相关文章

题目地址:http://codeforces.com/problemset/problem/412/A /* 模拟:题目没看懂,但操作很简单,从最近的一头(如果不在一端要先移动到一端)往另一头移动,顺便打印内容 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <string&g…
t题目链接:Coder-Strike 2014 - Round 2 A题:简单水题,注意能加入反复的数字.因此仅仅要推断是否能把Min和Max加入好.就能够了 B题:开一个sum计算每一个聊天总和,和一个s计算每一个人在每一个聊天总和,最后每一个人就用总和减掉自己发送的就可以 C题:最优策略为先把非特殊的答完,然后从最大的開始答 D题:dp,状态为dp[i][j][k],i表示当前长度,j表示前面数字的总和,k表示是否能组成,然后进行记忆化搜索 代码: A: #include <stdio.h>…
TCO round 1C的 250 和500 的题目都太脑残了,不说了. TCO round 1C 950 一个棋子,每次等概率的向左向右移动,然后走n步之后,期望cover的区域大小?求cover,肯定就是dp[l][r][n], 走了n步之后,左边cover了l,右边cover了r. 一开始DP没有搞清楚,这个要画一下图就更清楚了. 转移方程就是概率的传递方向. 1: double dp[505][505][2]; // l,r,n steps unsed; 2: class RedPain…
题目的意思是 老板给n个人发工资,x欠y的工资,the joy of person x from his brand new money reward will be much less, 老板想避免x后面是y领工资,故利用bfs,找到无后继的点 在提交代码的时候输出时格式好像没有oj的平台那么严,可以包含多余的空格(注释的代码也可以提交 #include <iostream> #include <vector> #include <algorithm> #includ…
此题题意就是匹配邮箱,提交时一直在test 14上WA,看了测试用例之后才发现计数用的int溢出,要用long long还是做题经验不够,导致此题未能通过,以后一定要考虑数据量大小 题意是找出邮件地址的数量,永许出现相同的地址 此题最重要的部分是要注意邮件地址的构成规则 1.邮件开始部分必须是字母串,数字和‘_’,但必须以字母开头 2.必须有字符‘@’ 3.接着是非空的字母或数字 4.接着是必须有‘.’ 5.地址必须以非空的字母串结束,不能含有数字,'_',和'.' 本题的想法是先按照@对字符串…
题目的意思是给出n个长度相同的字符串然后找出与他们匹配的字符串 将字符串存入类似二维数组的里面,每一行代表一个字符串,遍历每列,判断每列是否有公共的匹配字符,如果有输出任意一个 如果没有输出'?' #include <iostream> #include <vector> #include <algorithm> #include <string> using namespace std; int main(){ int n; cin >> n;…
题目的意思就是给每台电脑的最大传输速度,可以限制每台电脑的最大速度,然后选择k台电脑,使这k台电脑有相同的速度,且这个速度最大 典型的贪心算法,电脑的速度排个序,选择第k大速度即可 #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,k; cin >>n >> k; vector<int> a…
主要就是先将梯子移动到最左边或者最右边 k>n/2时移动到最右边 k<=n/2时移动到最左边 然后遍历一遍 #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,k; cin >> n >> k; string poster ; cin >> poster; ){ ; i <…
二进制数位DP,涉及到数字的按位与操作. 查看官方解题报告 #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> using namespace std; #define MAX_LEN 50 long long A, B, K; int a[MAX_LEN], b[MAX_LEN], k[MAX_LEN]; ][][]; void input() { scan…
题目链接 A. Poster time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard output The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the ne…
顺利搞出  A B 两题,然后压线晋级了,手速场. A 题 , 求排列最小的,肯定从后往前来做,维护一个最小的set,只是第一个字母要特判一下. 1: #line 5 "EllysSortingTrimmer.cpp" 2: #include <vector> 3: #include <list> 4: #include <map> 5: #include <set> 6: #include <deque> 7: #inclu…
Problem A permutation of size N is a sequence of N numbers, each between 0 and N-1, where each number appears exactly once. They may appear in any order. There are many (N factorial, to be precise, but it doesn't matter in this problem) permutations…
Problem A tree is a connected graph with no cycles. A rooted tree is a tree in which one special vertex is called the root. If there is an edge between X and Y in a rooted tree, we say that Y is a child of X if X is closer to the root than Y (in othe…
Problem Shota the farmer has a problem. He has just moved into his newly built farmhouse, but it turns out that the outlets haven't been configured correctly for all of his devices. Being a modern farmer, Shota owns a large number of smartphones and…
Codeforces Round #270 A. Design Tutorial: Learn from Math time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One way to create a task is to learn from math. You can generate some random math s…
D. Design Tutorial: Inverse the Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There is an easy way to obtain a new task from an old one called "Inverse the problem": we give…
http://codeforces.com/contest/472/problem/D D. Design Tutorial: Inverse the Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There is an easy way to obtain a new task from an old on…
Google Code Jam 2014 Round 1B Problem B hdu 2089 hdu 3555 uestc 250 (原1307) hdu 3652 hdu 3709 Light OJ 1140 Light OJ 1032 Codeforces 55D poj 3252 Light OJ 1068…
D. Design Tutorial: Inverse the Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There is an easy way to obtain a new task from an old one called "Inverse the problem": we give…
称号:http://community.topcoder.com/stat?c=problem_statement&pm=13251&rd=16017 參考:http://apps.topcoder.com/wiki/display/tc/TCO+2014+Round+2C 假设用先计算出每条边,用邻接矩阵来表示图,然后用BFS或 Floyd-Warshall算法来计算距离的话.时间复杂度是O(N^3),会超时.依据题名的提示知要利用clique graph的性质来做.基本思想是在BFS的…
今天比较无聊,就随便找了个程序设计来做,下面是源代码,以及效果图...不喜请喷!/*题目1:年历显示. 功能要求: (1) 输入一个年份,输出是在屏幕上显示该年的日历.假定输入的年份在1940-2040年之间. (2) 输入年月,输出该月的日历. (3) 输入年月日,输出距今天还有多少天,星期几,是否是公历节日. */ //日历 // Coder @Gxjun 2014/3/30/10:35 #include<iostream> #include<ctime> #include&l…
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…
Description Edward is a rich man. He owns a large factory for health drink production. As a matter of course, there is a large warehouse in the factory. To ensure the safety of drinks, Edward hired a security man to patrol the warehouse. The warehous…
题意:       这个是The 2014 ACM-ICPC Asia Mudanjiang Regional First Round 的C题,这个题目当时自己想的很复杂,想的是优先队列广搜,然后再在前向星里排序,结果写了好长,然后wa掉了,还好后来被队友A了,题意是给你一个无向图,然后让你遍历所有的点,但是有一些点的之间的遍历顺序有限制,最后问你能否遍历所有点. 思路:        今早起来才用自己的思路A了这个题,其实我们可以按照限制的顺序,一个一个枚举,对于当前的这个点,我们从它开始搜,…
我也有够懒的,今天才跑来写总结,自觉面壁中… 上一篇是Practice Round,今天是Round A,五道题. 每次做完都想说,其实题不难..但在做的过程中总是会各种卡,只有自己一行一行实现了,才算真正做过一道题,忌眼高手低啊~没做过的先自己做做吧. Problem A. Read Phone Number Do you know how to read the phone numbers in English? Now let me tell you. For example, In Ch…
今天有Google of Greater China Test for New Grads of 2014的练习赛,主要是为了过几天的校园招聘测试做练习用的,帮助熟悉平台,题目嘛,个人觉得除了A题外,B和C就是练习基本编程的. A题:Bad Horse二分图判定问题.话说昨晚刚简单看了一下代码,写都没写过,只好翻书抄代码了...还是有点幸运的,如果昨天没看,这个题估计就要留白了...感觉还有好多东西没学啊... #include <cstdio> #include <iostream&g…
B. Japanese Crosswords Strike Back time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of thi…
A题 简单模拟. /************************************************************************* > File Name: A.cpp > Author: Stomach_ache > Mail: sudaweitong@gmail.com > Created Time: 2014年09月01日 星期一 08时08分12秒 > Propose: *******************************…
思路: 将4个串每个串都反向这样得到新的四个串一共8个串,对于母串每个位置检测这个串能不能放进去,hs或者后缀数组都可以.然后dp[i][j]  (0<i<len  0<=j<8)表示长度为i以第j个串结尾能不能到达,如果能 那么 就可以i+1位置利用原来处理出来的来转移.要注意开头结尾即可. 注意:以第i个串结尾  那么下个串 就不能用第i个串的反向串. #include<iostream> #include<cstdio> #include<alg…