随笔分类 - online judge Codeforces
摘要:D2. RGB Substring (hard version) inputstandard input outputstandard output The only difference between easy and hard versions is the size of the input
阅读全文
摘要:D. Yet Another Subarray Problem You are given an array $a_1, a_2, \dots , a_n$ and two integers $m$ and $k$. You can choose some subarray $a_l, a_{l+1
阅读全文
摘要:BC都被hack的人生,痛苦。 下面是题解的表演时间: A. QAQ "QAQ" is a word to denote an expression of crying. Imagine "Q" as eyes with tears and "A" as a mouth. Now Diamond h
阅读全文
摘要:D. Magic Breeding link http://codeforces.com/contest/878/problem/D description Nikita and Sasha play a computer game where you have to breed some magi
阅读全文
摘要:C. Tournament link http://codeforces.com/contest/878/problem/C description Recently a tournament in k kinds of sports has begun in Berland. Vasya want
阅读全文
摘要:B. Teams Formation link http://codeforces.com/contest/878/problem/B describe This time the Berland Team Olympiad in Informatics is held in a remote ci
阅读全文
摘要:A. Short Program link http://codeforces.com/contest/878/problem/A describe Petya learned a new programming language CALPAS. A program in this language
阅读全文
摘要:D. Winter is here 题目连接: http://codeforces.com/contest/839/problem/D Description Winter is here at the North and the White Walkers are close. John Snow
阅读全文
摘要:E. DNA Evolution 题目连接: http://codeforces.com/contest/828/problem/E Description Everyone knows that DNA strands consist of nucleotides. There are four
阅读全文
摘要:D. High Load 题目连接: http://codeforces.com/contest/828/problem/D Description Arkady needs your help again! This time he decided to build his own high sp
阅读全文
摘要:C. String Reconstruction 题目连接: http://codeforces.com/contest/828/problem/C Description Ivan had string s consisting of small English letters. However,
阅读全文
摘要:python 2.7,用来熟悉Python 由于都是智障题,所以我也不讲述题意和题解,直接贴代码了…… A import sys h,m = map(int,raw_input().split(":")) ans = 0 while True: if h%10 == m/10 and h/10 ==
阅读全文
摘要:A. Fake NP 题意:给你l,r,让你输出[l,r]里面除1以外的,出现因子数量最多的那个数。 题解:如果l==r输出l,否则都输出2 include using namespace std; int main(){ int l,r; cin l r; if(r l==0){ coutnum)
阅读全文
摘要:A Hometask 题意:给你一个字符串,然后再给你k个禁止挨在一起的字符串,问你最少删除多少个字符串,使得不会有禁忌的字符串对挨在一起。题目保证每个字符最多出现在一个禁忌中。 题解:由于每个字符只会出现在一个禁忌里面,那么就说明每个询问是独立的。对于每个询问,我们贪心的去处理就好了,就连续的禁忌
阅读全文
摘要:A 题意:问你恰好修改一个字符,能不能使得字符串变成回文串 题解:显然直接for一遍,如果长度为偶数,那么不一样的必须是1个;如果长度为奇数,那么不一样的也可以是0个 include using namespace std; string s; int main(){ cin s; int tmp
阅读全文
摘要:A. k Factorization 题意:给你一个n,问你这个数能否分割成k个大于1的数的乘积。 题解:因为n的取值范围很小,所以感觉dfs应该不会有很多种可能…… include using namespace std; long long n; int k; vector ans; void
阅读全文
摘要:A Buying A House 题意:给你n个房间,妹子住在第m个房间,你有k块钱,你想买一个离妹子最近的房间。其中相邻的房间之间距离为10,a[i]=0表示已经被别人买了。 题解:扫一遍更新答案即可。 include using namespace std; const int maxn = 1
阅读全文
摘要:趁着上课无聊,来补一补…… A. Numbers Joke 直接oeis就好了:http://oeis.org/search?q=numbers+joke&language=english&go=Search include using namespace std; long long p[]={
阅读全文
摘要:B. Legacy 题目连接: http://codeforces.com/contest/786/problem/B Description Rick and his co workers have made a new radioactive formula and a lot of bad g
阅读全文
摘要:Anastasia and pebbles 题意:你有两种框,每个框可以最多装k重量的物品,但是你每个框不能装不一样的物品。现在地面上有n个物品,问你最少多少次,可以把这n个物品全部装回去。 题解:其实就是问你得用多少次框,然后把多少次除以2就好了。每次装k的物品装回去就好了。 代码: includ
阅读全文