940C链接:http://codeforces.com/problemset/problem/940/C C. Phone Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output And where the are the phone numbers? You are given a string s consist…
题目链接:http://codeforces.com/problemset/problem/546/C 题解: 用两个队列模拟过程就可以了. 特殊的地方是:1.如果等大,那么两张牌都丢弃 : 2.如果操作了很多次仍不能分出胜负,则认为平手.(至于多少次,我也不知道,只能写大一点碰运气,但要防止超时) 代码如下: #include<iostream>//C - Soldier and Cards #include<cstdio> #include<cstring> #in…
Ballot Analyzing Device 题目连接: http://codeforces.com/gym/100269/attachments Description Election committee of Flatland is preparing for presidential elections. To minimize human factor in ballot counting they decided to develop an automated Ballot Ana…
这场比赛没有打,后来补了一下,第五题数位dp好不容易才搞出来(我太菜啊). 比赛传送门:http://codeforces.com/contest/1073 A. Diverse Substring 题意:给你个字符串,让你找一个子串满足任意一个字符的个数不超过其他字符的总和,输出yes或no表示否存在,如果存在输出任意一个. 这题只要找两个不同的相邻字符,因为两个字符各一个都不超过其他字符的总和,如果字符串只由一个字符组成或长度等于一才会不存在. 代码如下: #include <iostrea…
Prison Transfer Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of t…
A. Extract Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/600/problem/A Description You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon…
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://codeforces.com/contest/985/problem/F Description You are given a string s of length n consisting of lowercase English letters. For two given strings s an…
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://codeforces.com/contest/985/problem/E Description Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome w…
B. The Queue time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, b…
除非特别忙,我接下来会尽可能翻译我做的每道CF题的题面! Codeforces 148D 一袋老鼠 Bag of mice | 概率DP 水题 题面 胡小兔和司公子都认为对方是垃圾. 为了决出谁才是垃圾,大哥拿来了一袋老鼠,其中有w只白老鼠和b只黑老鼠.胡小兔先抓,先抓到白老鼠的人赢. 每次学姐抓完老鼠之后,总会有另外一只老鼠从袋子里自己跑出来(这只老鼠不算任何人抓的),而胡小兔抓老鼠时则不会发生这样的事. 每次袋子里的每只老鼠被抓到的概率相等,当有一只老鼠跑出来的时候,每只老鼠跑出来的几率也相…
B. Memory Manager 题目连接: http://www.codeforces.com/contest/7/problem/B Description There is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet - the memory manager is among th…
B. Center Alignment 题目连接: http://www.codeforces.com/contest/5/problem/B Description Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this fu…
C. Tic-tac-toe 题目连接: http://www.codeforces.com/contest/3/problem/C Description Certainly, everyone is familiar with tic-tac-toe game. The rules are very simple indeed. Two players take turns marking the cells in a 3 × 3 grid (one player always draws…
A. Games time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Manao works on a sports TV. He's spent much time watching the football games of some country. After a while he began to notice diffe…
A /*Huyyt*/ #include<bits/stdc++.h> #define mem(a,b) memset(a,b,sizeof(a)) #define pb push_back using namespace std; typedef long long ll; typedef unsigned long long ull; const ll LLmaxn = 2e18; ; inline int readint() { char c = getchar(); ; ') { c…
Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky days are repeating with some period. For example, for Alice…
题目链接:http://codeforces.com/problemset/problem/616/A 题目意思:顾名思义,就是比较两个长度不超过 1e6 的字符串的大小 模拟即可.提供两个版本,数组版本 & 指针版本. (1)数组版本(短的字符串从高位处补0,直到跟长的字符串长度相同) #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> using…
A. Vladik and flights 题目链接 http://codeforces.com/contest/743/problem/A 题面 Vladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is not as easy as it sounds: the question Vladik face now is…
题目链接: http://codeforces.com/contest/734/problem/D D. Anton and Chess time limit per test4 secondsmemory limit per test256 megabytes 问题描述 Anton likes to play chess. Also, he likes to do programming. That is why he decided to write the program that pla…
Valera and X Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the Engli…
题目链接:http://codeforces.com/contest/710/problem/E 题意:开始文本为空,可以选择话费时间x输入或删除一个字符,也可以选择复制并粘贴一串字符(即长度变为两倍),问要获得长度为n的串所需最少的时间. 思路:dp[i]表示获得长度为i的串所需要的最短时间,分i为奇数和偶数讨论. #include<bits/stdc++.h> using namespace std; const int N=1e7+3; typedef long long ll; ll…
A. Comparing Two Long Integers 题目连接: http://www.codeforces.com/contest/616/problem/A Description You are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine that they are equal.…
A. New Year and Days 题目连接: http://www.codeforces.com/contest/611/problem/A Description Today is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of the year 2015. Limak is a little polar bear. He enjoyed…
B. The Best Gift 题目连接: http://www.codeforces.com/contest/609/problem/B Description Emily's birthday is next week and Jack has decided to buy a present for her. He knows she loves books so he goes to the local bookshop, where there are n books on sale…
A. Alena's Schedule Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/586/problem/A Description Alena has successfully passed the entrance exams to the university and is now looking forward to start studying. One two-hour less…
B. Valera and Fruits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera loves his garden, where n fruit trees grow. This year he will enjoy a great harvest! On the i-th tree bi fruit gr…
Codeforces Round #551 (Div. 2) 算是放弃颓废决定好好打比赛好好刷题的开始吧 A. Serval and Bus 处理每个巴士最早到站且大于t的时间 #include <bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #define mp make_pair #define pb push_back #define space putchar(' ')…
B. Anton and Classes 题目连接: http://codeforces.com/contest/785/problem/B Description Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes. Anton has n variants when he wil…
B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly lives in the university dorm as many other students do. As you know, cockroaches are also living there together with students. Cockroaches might be of tw…
A. Game With Sticks 题目连接: http://codeforces.com/contest/451/problem/A Description After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are playing a game on a grid made of n horizontal and m vertical sticks. A…