摘要:
题目:一个人要买房,一共有n间在一排的房,有k间已经售出。但这个人只想买旁边有人居住的房,问最多有多少选择,最少有多少选择。 题解:当k==0或k==n时,max==min==0。一般情况时三个为一组,k--,tot+=2,n-=3;当n<3时,tot+=(n-k)。 代码: #include<cs 阅读全文
posted @ 2017-09-12 15:08
LMissher
阅读(229)
评论(0)
推荐(0)
摘要:
题目:最小生成树裸题。 注意getchar的使用。 代码: #include<cstdio>#include<cstring>#include<algorithm>using namespace std;int per[110];struct node{ char a,b; int w;}s[100 阅读全文
posted @ 2017-09-12 14:55
LMissher
阅读(117)
评论(0)
推荐(0)
摘要:
题目:裸的Floyd。 代码: #include <cstdio>const int inf=1<<29;int n,m;int a[500];int dp[500][500];void floyd(){ for(int k=1;k<=n;k++) for(int i=1;i<=n;i++) for 阅读全文
posted @ 2017-09-12 13:37
LMissher
阅读(181)
评论(0)
推荐(0)
摘要:
题目:有两组数目相同的数,数目可以顺序移动。每组数从1到n进行ai-bi并求和,当和小于0时停止,并把之前的ai求和输出,求最大的ai求和。 题解:把两组数复制并延长一倍。一个循环搞定。 ps:第一道自己做出的网络赛题目,继续努力! 代码: #include<cstdio>int a[1100000 阅读全文
posted @ 2017-09-12 13:32
LMissher
阅读(94)
评论(0)
推荐(0)

浙公网安备 33010602011771号