Codefoces 828C】的更多相关文章

C. String Reconstruction time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ivan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid…
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/u011328934/article/details/26094917 题目连接:Codefoces 432C Prime Swaps 题目大意:给出一个序列.长度为n,要求用5n以内的交换次数使得序列有序.而且交换的i,j两个位置的数时要满足,j−i+1为素数. 解题思路:a数组为相应的序列,b数组为相应的有序序列,p为相应数的位置.每次从有序序列最小的位置開始,该为必须放b[i]才对.所以p[b…
Ivan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string s. Ivan preferred making a new string to finding the old one. Ivan knows some information about the string s. Namely, he re…
link: http://codeforces.com/contest/332/problem/A /* ID: zypz4571 LANG: C++ TASK: 193a.cpp */ #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <cctype> #include <a…
裸的近期点对.... D. Tricky Function time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Iahub and Sorin are the best competitive programmers in their town. However, they can't both qualify to an imp…
哥德巴赫猜想: 任一大于2的偶数,都可表示成两个素数之和. 任一大于5的整数都可写成三个质数之和. 贪心取尽可能大的素数..... C. Prime Swaps time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have an array a[1], a[2], ..., a[n], containing distinc…
B. Text Document Analysis time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Modern text editors usually show some information regarding the document being edited. For example, the number of w…
A. The New Year: Meeting Friends time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, t…
<题目链接> 题目大意: 给你一段只由 'B'和'R'组成的字符串,问你在连续的区间内,"B"和"R"的差值最大是多少,输出该区间:如果对于差值相等的区间,优先输出左端点小的,左端点相同,优先输出右端点小的. 解题分析: 很明显要分两种情况讨论,一种是该区间内B比R多,第二种是该区间内R比B多.仔细思考后发现,可以将此题转化为最大连续和问题,对于B多的情况,用dp1来维护,将B看成1,R看成-1,对于R多的情况则用dp2来维护,将R看成1,B看成-1,然…
题目链接:http://codeforces.com/problemset/problem/277/E 参考了这篇题解:http://blog.csdn.net/Sakai_Masato/article/details/50775315 没看出来是费用流啊...我好菜啊. 我写得有一点和上面这篇题解不同:在判断是否无解时我直接记录最大流,判断最大流是否等于$n-1$(似乎是等价的...) #include<iostream> #include<cstdio> #include<…