Good Bye 2017 A B C
Good Bye 2017
A New Year and Counting Cards
题目链接:
http://codeforces.com/contest/908/problem/A
思路:
如果卡片上面是数字,如果是奇数,就需要检查一下。如果是字母,如果是原音字母,需要检查一下。
代码:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1504;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
string s,t;
t="aeiou";
cin>>s;
int ans=0;
int lens=s.length();
int lent=t.length();
for(int i=0;i<lens;++i) {
if(s[i]>='0'&&s[i]<='9') {
int num=s[i]-'0';
if(num%2) ++ans;
} else {
for(int j=0;j<lent;++j) {
if(s[i]==t[j]) {
++ans;
break;
}
}
}
}
cout<<ans<<endl;
return 0;
}
B New Year and Buggy Bot
题目链接:
http://codeforces.com/contest/908/problem/B
思路:
设置方向数组,全排列。暴力DFS检查每一种的可能性。要注意DFS判断最后一步的下标,少了最后一步,结果WA8,好可惜...
代码:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 55;
char mp[maxn][maxn];
char op[105];
int n,m,sx,sy,ex,ey;
int a[4]={0,1,2,3};
int ans=0;
int len;
bool dfs(int x, int y, int index) {
if(index>=len) {
if(x==ex&&y==ey) return true;
return false;
}
if(x==ex&&y==ey) return true;
int xx,yy;
for(int i=0;i<4;++i) {
if(op[index]-'0'==a[i]) {
if(i==0) {
xx=x;
yy=y-1;
} else if(i==1) {
xx=x-1;
yy=y;
} else if(i==2) {
xx=x;
yy=y+1;
} else if(i==3) {
xx=x+1;
yy=y;
}
}
}
if(xx<0||xx>=n||yy<0||yy>=m) return false;
if(mp[xx][yy]=='#') return false;
return dfs(xx,yy,index+1);
}
int main() {
scanf("%d %d",&n,&m);
for(int i=0;i<n;++i) scanf("%s",mp[i]);
scanf("%s",op);
len=strlen(op);
for(int i=0;i<n;++i) {
for(int j=0;j<m;++j) {
if(mp[i][j]=='S') {
sx=i;
sy=j;
} else if(mp[i][j]=='E') {
ex=i;
ey=j;
}
}
}
do {
if(dfs(sx,sy,0)) ++ans;
} while(next_permutation(a,a+4));
printf("%d\n",ans);
return 0;
}
C New Year and Curling
题目链接:
http://codeforces.com/contest/908/problem/C
思路:
这道题目,按照先后顺序依次访问每一个掉落下来的圆。计算和之前的圆是否存在相交或者是相切的关系,如果存在,计算出纵坐标。然后在纵坐标中渠道最大值即可。因为碰到第一个圆就停止了,不可能再与其他的圆相切。
代码:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1005;
int x[maxn];
double y[maxn];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n,r;
cin>>n>>r;
for(int i=1;i<=n;++i) {
cin>>x[i];
y[i]=r*1.0;
}
for(int i=2;i<=n;++i) {
for(int j=i-1;j>=1;--j) {
int ll=1005,rr=1;
ll=min(min(ll,x[j]-r),x[i]-r);
rr=max(max(rr,x[j]+r),x[i]+r);
if(rr-ll>4*r) continue;
double temp=sqrt(4*r*r*1.0-(x[i]*1.0-x[j]*1.0)*(x[i]*1.0-x[j]*1.0))+y[j];
y[i]=max(temp,y[i]);
}
}
for(int i=1;i<=n;++i) {
if(i==1) cout<<setiosflags(ios::fixed)<<setprecision(8) << y[i];
else cout<<" "<<setiosflags(ios::fixed)<<setprecision(8) << y[i];
}
cout<<endl;
return 0;
}
Good Bye 2017 A B C的更多相关文章
- Hello 2018, Bye 2017
2017年过去了,过去一年经历了太多,改变了好多好多,可以说人生进入了另一个阶段,有可能是成熟吧. 回顾2017 去年换了新工作,离开了将近工作了8年的公司,不带走一丝云彩,为其任劳任怨,最后没有任何 ...
- Good Bye 2017(送命场)
9815人数场,9500+围观神仙打架...断断续续打Codeforces也快有一年啦,第一次打Good Bye场,满怀前排膜tourist的心愿参加了这场送命场,虽然没看到tourist.不过还是得 ...
- Good Bye 2017 E. New Year and Entity Enumeration
先按照绿点进行分块 第一个绿点和最后一个绿点之后很好处理不说了 两个绿点之间的讨论: 有两种方案 1:红(蓝)点和绿点顺序连接,距离为相邻绿点距离(也就是双倍绿点距离) 2:红(蓝)点和绿点的点阵中寻 ...
- Good Bye 2017 D. New Year and Arbitrary Arrangement
看了别人的题解 首先这题是一个dp dp[i][j] i是当前有多少个a j是当前有多少个ab子序列 dp[i][j] = dp[i+1][j]*Pa + dp[i][i+j]*Pb; i,j 时加一 ...
- Good Bye 2017 G. New Year and Original Order
G. New Year and Original Order time limit per test 2 seconds memory limit per test 256 megabytes inp ...
- Good Bye 2017 C. New Year and Curling
Carol is currently curling. She has n disks each with radius r on the 2D plane. Initially she has al ...
- Good Bye 2017 部分题解
D. New Year and Arbitrary Arrangement 分析 \(dp[i][j]\) 表示已有 \(i\) 个 \(a\) 和 \(j\) 个 \(ab\) 的情况下继续构造能得 ...
- Good Bye 2017
太菜了啊,一不小心就goodbye rating了 A. New Year and Counting Cards time limit per test 1 second memory limit p ...
- 【EOJ Monthly 2018.2 (Good bye 2017)】
23333333333333333 由于情人节要回家,所以就先只放代码了. 此题是与我胖虎过不去. [E. 出老千的 xjj] #include<cstdio> #include<c ...
随机推荐
- [开源] gnet: 一个轻量级且高性能的 Golang 网络库
Github 主页 https://github.com/panjf2000/gnet 欢迎大家围观~~,目前还在持续更新,感兴趣的话可以 star 一下暗中观察哦. 简介 gnet 是一个基于 Ev ...
- numpy.array 合并和分割
# 导包 import numpy as np numpy.array 的合并 .concatenate() 一维数组 x = np.array([1, 2, 3]) # array([1, 2, 3 ...
- [考试反思]0825NOIP模拟测试30:没落
AB卷,15人. Lrefrain rank#1 179 skyh rank#2 122 116 108 54 42虽说还是不怎么样,但是有好转的迹象. 开卷审题,T1是个(假)期望,感觉也许还可做. ...
- Linux学习(推荐学习资源)——保持更新
1. 介绍 Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和Unix的多用户.多任务.支持多线程和多CPU的操作系统.它能运行主要的Unix工具软件.应用程序和网络协议. ...
- [ PyQt入门教程 ] PyQt5中数据表格控件QTableWidget使用方法
如果你想让你开发的PyQt5工具展示的数据显得整齐.美观.好看,显得符合你的气质,可以考虑使用QTableWidget控件.之前一直使用的是textBrowser文本框控件,数据展示还是不太美观.其中 ...
- 接口测试专题(Java & jmeter & Linux基础)
以下是我和两个朋友原创文章合集,主题是接口测试,有Java接口测试案例和jmeter的案例,还有接口测试相关服务器操作基础.欢迎点赞.关注和转发. 接口测试 httpclient处理多用户同时在线 h ...
- mysql查询不重复的行内容,不重复的记录数.count,distinct
有这么一个表 记录了id, p_id, p_name , p_content , p_time 1 343 aaa aaaaaa 2012-09-01 2 ...
- thinkphp volist标签中加if判断的写法
<if condition="$vo['devstatus'] eq 1">在线<else /> 离线</if> IF标签用法 <if c ...
- HTML中的表格标签
表格是网页制作中使用最多的工具之一,在制作网页时,使用表格可以更清晰地排列数据.但是在实际制作过程中,表格更多用在网页布局的定位上.很多网页都是以表格布局的.这是因为表格在文本和图像的位置控制方面 ...
- nyoj 23-取石子(一)(博弈)
23-取石子(一) 内存限制:64MB 时间限制:3000ms Special Judge: No accepted:20 submit:33 题目描述: 一天,TT在寝室闲着无聊,和同寝的人玩起了取 ...