A:签到

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
#define N 100010
int n,l,m;
struct data{int x,y;
}a[N];
int main()
{
n=read(),l=read(),m=read();
for (int i=;i<=n;i++)
{
int x=read(),y=read();
a[i].x=x,a[i].y=x+y;
}
a[].x=a[].y=,a[n+].x=a[n+].y=l;
int ans=;
for (int i=;i<=n+;i++) ans+=(a[i].x-a[i-].y)/m;
cout<<ans;
return ;
}

  B:只能对于一个八个方向都被要求染色的位置染色。染完之后看一下和所要求的图是否相同就行了。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
#define N 1010
int n,m,a[N][N],b[N][N];
int main()
{
n=read(),m=read();
for (int i=;i<=n;i++)
{
for (int j=;j<=m;j++)
{
char c=getchar();
while (c!='#'&&c!='.') c=getchar();
if (c=='#') a[i][j]=;
else a[i][j]=;
}
}
for (int i=;i<=n;i++)
for (int j=;j<=m;j++)
if (a[i-][j]&&a[i][j-]&&a[i][j+]&&a[i+][j]&&a[i+][j+]&&a[i+][j-]&&a[i-][j+]&&a[i-][j-])
b[i-][j]=b[i][j-]=b[i][j+]=b[i+][j]=b[i+][j+]=b[i+][j-]=b[i-][j+]=b[i-][j-]=;
for (int i=;i<=n;i++)
for (int j=;j<=m;j++)
if (a[i][j]!=b[i][j]) {cout<<"NO";return ;}
cout<<"YES";
return ;
}

  C:要求字典序最大也就要求gcd的变化尽量早出现。如果n>=4,最容易使gcd增大的方法肯定是删掉所有奇数。所以递归删除即可。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
#define N 1000010
int n;
void print(int n,int s)
{
if (n==) {cout<<s;return;}
if (n==) {cout<<s<<' '<<(s<<);return;}
if (n==) {cout<<s<<' '<<s<<' '<<s*;return;}
for (int i=;i<=(n+)>>;i++) printf("%d ",s);
print(n>>,s*);
}
int main()
{
n=read();
print(n,);
return ;
}

  D:二分圆半径,对于每个圆就可以求出它所要求的圆心所在区间,判断一下有没有交。然而不知道是写挂还是卡精度了,一个半小时都没搞出来,惨炸。

//wa on 5
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
#define N 100010
int n;
long double eps=1E-;
struct data{int x,y;
}a[N];
struct data2
{
long double x;int op;
bool operator <(const data2&a) const
{
return x<a.x;
}
}b[N];
bool check(long double k)
{
int t=;
for (int i=;i<=n;i++)
{
if (*k-a[i].y<) return ;
long double x=sqrt(a[i].y)*sqrt(*k-a[i].y);
b[++t].x=a[i].x-x,b[t].op=,b[++t].x=a[i].x+x+eps,b[t].op=-;
}
sort(b+,b+t+);
int cnt=;
for (int i=;i<=t;i++)
{
cnt+=b[i].op;
if (cnt==n) return ;
}
return ;
}
long double calc()
{
long double l=,r=2e18,ans=2e18;
while ((r-l)/((r+l)/)>eps)
{
long double mid=(l+r)/;bool flag=;
if (check(mid)) ans=mid,r=mid-eps;
else l=mid+eps;
}
return ans;
}
int main()
{
n=read();
long double flag1=,flag2=;
for (int i=;i<=n;i++)
{
a[i].x=read(),a[i].y=read();
if (a[i].y<) flag2=;
if (a[i].y>) flag1=;
}
if (flag1&&flag2) {cout<<-;return ;}
if (flag2) for (int i=;i<=n;i++) a[i].y=-a[i].y;
double ans=calc();printf("%.7lf",ans);
return ;
}

  E:好像很多人过然而还并没有看。

  result:rank 329 rating -14

Codeforces Round#514 Div.2 翻车记的更多相关文章

  1. Codeforces Round#500 Div.2 翻车记

    A:签到 #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> # ...

  2. Codeforces Round#509 Div.2翻车记

    A:签到 #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> # ...

  3. Educational Codeforces Round 56 Div. 2 翻车记

    A:签到. B:仅当只有一种字符时无法构成非回文串. #include<iostream> #include<cstdio> #include<cmath> #in ...

  4. Educational Codeforces Round 55 Div. 2 翻车记

    A:签到. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> ...

  5. Codeforces Round #524 Div. 2 翻车记

    A:签到.room里有一个用for写的,hack了一发1e8 1,结果用了大概600+ms跑过去了.惨绝人寰. #include<iostream> #include<cstdio& ...

  6. Codeforces Round#516 Div.1 翻车记

    A:开场懵逼.然后发现有人1min过,于是就sort了一下,于是就过了.正经证明的话,考虑回文串两端点一定是相同的,所以最多有Σcnti*(cnti+1)/2个,cnti为第i种字母出现次数.而sor ...

  7. Codeforces Round #517 Div. 1翻车记

    A:真的懵逼了.冷静了半天之后决定二分一下答案,然后先a安排上尽量小的再贪心地一个个扩大.40min才过.这个做法非常怂的以代码复杂度和时间复杂度为代价换取了比较稳的正确性,事实上由于1~n可以组合出 ...

  8. Educational Codeforces Round 53 Div. 2翻车记

    A:差点开场懵逼.只要有相邻两位不同就可以作为答案. #include<iostream> #include<cstdio> #include<cmath> #in ...

  9. Codeforces Round #394 (Div. 2) 颓废记

    昨天晚上(今天凌晨),又忍不住去打CF.(本蒟弱到只能打Div.2)... 我觉得我可以用一个词概括我这次的CF: 呵呵 刚一开赛,我就codeforces访问失败.. 后来好不容易能上了,两三分钟才 ...

随机推荐

  1. 数据库路由中间件MyCat - 源代码篇(15)

    此文已由作者张镐薪授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. public static void handle(String stmt, ServerConnectio ...

  2. hive bug

    SHELL$ hive -S -e “set” | grep warehouse hive.metastore.warehouse.dir=/user/hive/warehouse hive.ware ...

  3. ln in Linux

    默认情况(硬连接) ln 目标 连接名称 ll -i 显示文件的inode信息,即文件节点信息 ➜  test1 ll -i 1.txt 27987655 -rw-r--r--  1 myuser   ...

  4. Windows网络通信(一):socket同步编程

    网络通信常用API 1. WSAStartup用于初始化WinSock环境 int WSAStartup( WORD wVersionRequested, LPWSADATA lpWSAData ); ...

  5. HDU-6315:Naive Operations(线段树+思维)

    链接:HDU-6315:Naive Operations 题意: In a galaxy far, far away, there are two integer sequence a and b o ...

  6. Python爬虫下载Bilibili番剧弹幕

    本文绍如何利用python爬虫下载bilibili番剧弹幕. 准备: python3环境 需要安装BeautifulSoup,selenium包 phantomjs 原理: 通过aid下载bilibi ...

  7. CSP201512-2:消除类游戏

    引言:CSP(http://www.cspro.org/lead/application/ccf/login.jsp)是由中国计算机学会(CCF)发起的"计算机职业资格认证"考试, ...

  8. Wacom发布Cintiq Companion 2

    全新的Cintiq Companion 2是一款强大的平板电脑,让创意专业人士获得最佳的屏幕笔触,让创意随时随地进行.用户还可以在家中或工作时连接到Mac或PC电脑获得无与伦比的灵活性! 2015年1 ...

  9. 团队目标WBS及具体任务分工

    • 首先我们讨论了实验第一个冲刺周期要实现的功能,我们的初期目标. •  然后我们进一步梳理了第一阶段的任务和需求. •  之后对任务进行了划分和领取. •  最后每个人对自己的任务进行了估算,并约定 ...

  10. 阿帕奇web服务器下载部署安装运行

    链接: https://jingyan.baidu.com/album/d8072ac47baf0eec95cefdca.html?picindex=4 1.apache服务安装成功可是启动失败“wi ...