题目:http://www.lydsy.com/JudgeOnline/problem.php?id=3850题解:类似于国王游戏,推一下相邻两个元素交换的条件然后排个序就可以了。代码: 1 #include 2 3 #include 4 5 #include 6 7 #include 8 ...
分类:
其他好文 时间:
2015-01-08 20:00:59
阅读次数:
231
date用法1:
格式:date [OPTION]... [+FORMAT]
FORMAT controls the output. Interpreted sequences are:...
分类:
系统相关 时间:
2015-01-08 00:58:21
阅读次数:
290
Though ZCC has many Fans, ZCC himself is a crazy Fan of a coder, called "Memset137".It was on Codefires(CF), an online competitive programming site, t...
分类:
其他好文 时间:
2015-01-07 16:35:55
阅读次数:
269
贪心,就跟NOIP2012国王游戏差不多,考虑交换相邻两题的位置,对其他题是毫无影响的,然后看两题顺序先后哪个更优。sort即可。WA了一次的原因:虽然ans开的是long long,但是在这一句:ans+=time*a[i].k;时,还是需要在time(int类型)前面加上(LL)进行类型强制转换...
分类:
其他好文 时间:
2015-01-07 10:38:48
阅读次数:
124
水题,直接贴代码。
//poj 1492
//sep9
#include
using namespace std;
int a[64];
int n;
void deal()
{
int up=0,down=0,upSum=0,downSum=0;
int i,j;
for(i=1;i<n;){
if(a[i]<a[i+1]){
++up;
for(j=i+1;j<=...
分类:
其他好文 时间:
2015-01-07 01:53:11
阅读次数:
163
题目大意:给出一个无向图,问删掉k条边的时候,图是否联通。
思路:虽然我把这两个题放在了一起,但是其实这两个题可以用完全不同的两个解法来解决。
第一个题其实是DZY出错了。。。把每次的边数也异或了,那就直接用这个性质一个一个往后推就行了。。最后一个暴力求一下。。
第二个题才是本意啊。
听到做法的时候我惊呆了。。
首先是将整个图中拆出一个树,那么所有边就分为树边和非树边。将所有非树...
分类:
其他好文 时间:
2014-12-25 16:29:58
阅读次数:
233
题目大意:
枚举d=gcd(i,j),得到
现在我们只需要知道Σ[d|T]f(d)μ(T/d)的前缀和就行了 设这个函数为g(x)
观察这个函数 由于含平方因子数的μ值都为零,因此我们只考虑μ(T/d)!=0的数
令T=p1^a1*p2^a2*...*pk^ak,d=p1^b1*p2^b2*...*pk^bk
那么0
如果存在ai≠aj(i≠j),那么我们可以将所有的a...
分类:
其他好文 时间:
2014-12-24 13:31:37
阅读次数:
220
Problem Description
Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj...
分类:
编程语言 时间:
2014-12-22 16:17:44
阅读次数:
252
One TopCoder article introduces a very interesting alternative solution to Longest Common Sequences problem.It is based on this statement (http://comm...
分类:
其他好文 时间:
2014-12-20 10:26:37
阅读次数:
240
Problem DescriptionSoapbear is the mascot of WHUACM team. Like other bears, Soapbear loves honey very much, so he decides to get some honeycombs for h...
分类:
其他好文 时间:
2014-12-19 20:36:01
阅读次数:
269