
Codeforces
XYZgoforit
这个作者很懒,什么都没留下…
展开
-
Codeforces 835A Key races (水题)
题目链接CF 835A题目大意分析代码#include <bits/stdc++.h>using namespace std;int main(){ int s,v1,v2,t1,t2; while (scanf("%d%d%d%d%d",&s,&v1,&v2,&t1,&t2)!=EOF) { int a=s*v1+2*t1; int b原创 2017-08-13 00:55:09 · 260 阅读 · 0 评论 -
Codeforces 835B The number on the board (贪心)
题目链接CF 835B题目大意分析代码#include <bits/stdc++.h>using namespace std;int num[100010];int main(){ string ch; int k,ans,len,i,cnt,p,t; cin>>k; cin>>ch; len=ch.length(); cnt=0; f原创 2017-08-13 00:58:11 · 307 阅读 · 0 评论 -
Codeforces 839A Arya and Bran (模拟)
题目链接CF 839A题目大意分析代码#include <bits/stdc++.h>using namespace std;const double pi=4*atan(1.0);int main(){ int a[110],n,k,i; while (scanf("%d%d",&n,&k)!=EOF) { for (i=1;i<=n;i++)原创 2017-08-13 01:01:33 · 357 阅读 · 0 评论 -
Codeforces 845B Luba And The Ticket (贪心)
题目链接CF 845B题目大意输入六位数字,问至少改变多少个数位能使前三位的和等于后三位的和。分析简单的贪心。 对于初始的六位数字,我们计算前三位的和与后三位的和,接着要让每次操作都尽可能多的填补前三位和与后三位和的差距。和较小的那一组中每一位最多能弥补的差距为9减去其数位(将其变大至9),和较大的那一组中每一位最多能弥补的差距为其数位(将其变为0),则按6个数位最多能弥补的差距排序,从大往小尽可原创 2017-08-24 23:19:32 · 702 阅读 · 0 评论 -
Codeforces 839C Journey (树的DFS+期望)
题目链接CF 839C题目大意分析代码#include <bits/stdc++.h>using namespace std;const double pi=4*atan(1.0);const int MAXN=100010;const int MAXM=2*MAXN;struct Edge{ int to,next;}e[MAXM];int head[MAXN],ind[M原创 2017-08-13 01:05:48 · 443 阅读 · 0 评论 -
Codeforces 839B Game of the Rows (贪心)
题目链接CF 839B题目大意有kk组人,第ii组有aia_i个人。飞机上有nn排座位,每排座位如下图: 问是否存在一种就座方案,使得不存在不同组的人坐在相邻的位置。分析这是Round #428 (Div.2)的B题,当时比赛的时候是通过的,赛后被Hack掉了(新增数据见注释)。。。自己想的情况还是不够全面。 显然这是一道贪心题。首先我们尽可能的让同一组的4个人去坐四人座然后尽可能让同一原创 2017-08-13 01:03:20 · 348 阅读 · 0 评论