Education Round16
A题:
题意:给定国际象棋king的坐标,求能向几个方向移动
分析:处理一下边界情况,其他的都是8
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
string s;
int main()
{
while(cin>>s)
{
if((s[]!='a'&&s[]!='h')&&(s[]!=''&&s[]!=''))
cout<<""<<endl;
else
{
if(s[]=='a'||s[]=='h')
{
if(s[]==''||s[]=='')
cout<<""<<endl;
else
cout<<""<<endl;
}
else
cout<<""<<endl;
}
}
return ;
}
B题:
题意:给定一条直线上的一些点,求到这些点距离最近的点的坐标
分析:有推倒可以得到,我们可以把坐标先排序,如果有偶数个则取中间一个,如果有奇数个取中间一个的下一个
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
const int maxn=;
const int INF=<<;
int a[maxn];
int n;
int main()
{
while(cin>>n)
{
for(int i=;i<=n;i++)
scanf("%d",&a[i]);
sort(a+,a++n);
int k=n/;
if(n%==)
cout<<a[n/]<<endl;
else
cout<<a[n/+]<<endl;
}
return ;
}
Education Round16的更多相关文章
- Codeforces 915E Physical Education Lessons
原题传送门 我承认,比赛的时候在C题上卡了好久(最后也不会),15min水掉D后(最后还FST了..),看到E时已经只剩15min了.尽管一眼看出是离散化+线段树的裸题,但是没有时间写,实在尴尬. 赛 ...
- CF915E Physical Education Lessons 动态开点线段树
题目链接 CF915E Physical Education Lessons 题解 动态开点线段树 代码 /* 动态开点线段树 */ #include<cstdio> #include&l ...
- 【题解】Luogu CF915E Physical Education Lessons
原题传送门:CF915E Physical Education Lessons 前置芝士:珂朵莉树 窝博客里对珂朵莉树的介绍 没什么好说的自己看看吧 这道题很简单啊 每个操作就是区间赋值,顺带把总和修 ...
- 2.Early Education of Children 儿童的早期教育
2.Early Education of Children 儿童的早期教育 (1) In bringing up children,every parent watches eagerly the c ...
- 1.The Necessity of a Broad Education 全面教育的必要性
1.The Necessity of a Broad Education 全面教育的必要性 (1) According to a survey,which was based on the respo ...
- L219 China's office workers consider further education, training essential
More than 90 percent of China's office workers consider on-the-job training and continuing education ...
- CF915E Physical Education Lessons
题意: Alex高中毕业了,他现在是大学新生.虽然他学习编程,但他还是要上体育课,这对他来说完全是一个意外.快要期末了,但是不幸的Alex的体育学分还是零蛋! Alex可不希望被开除,他想知道到期末还 ...
- Give $20/month and provide 480 hours of free education
Hi , Hope all is well. Summer is right around the corner, and the Khan Academy team is excited to sp ...
- 【CodeForces】915 E. Physical Education Lessons 线段树
[题目]E. Physical Education Lessons [题意]10^9范围的区间覆盖,至多3*10^5次区间询问. [算法]线段树 [题解]每次询问至多增加两段区间,提前括号分段后线段树 ...
随机推荐
- 用For Each语句对Session.Contents树组进行遍历
<%@ LANGUAGE=VBScript codepage ="936" %> <% Option Explicit %> 您的sessionID号是:& ...
- php-redis 下载地址
http://windows.php.net/downloads/pecl/snaps/redis/2.2.5/
- ubuntu apt-get update 连接不到指定的源
问题描述: ubuntu apt-get update 连接不到指定的源,修改了几个软件源还是连接不上,同样的软件源在别的机器上都可以正常使用,后来发现每次 sudo apt-get update操作 ...
- 学习笔记:GLSL Core Tutorial – Vertex Shader(内置变量说明)
1.每个Vertex Shader都有用户定义的输入属性,例如:位置,法线向量和纹理坐标等.Vertex Shaders也接收一致变量(uniform variables). uniform vari ...
- Android OpenGL ES(十)绘制三角形Triangle .
三角形为OpenGL ES支持的面,同样创建一个DrawTriangle Activity,定义6个顶点使用三种不同模式来绘制三角形: float vertexArray[] = { -0.8f, - ...
- JPA 系列教程2-单表操作
JPA Sun官方提出的Java持久化规范.它为Java开发人员提供了一种对象/关系映射工具来管理Java应用中的关系数据.他的出现主要是为了简化现有的持久化开发工作和整合ORM技术,结束现在Hibe ...
- UIScreen的scale属性
用来表示显示屏的像素密度与点坐标系统之间的关系.通过该属性,我们可以把视图中逻辑坐标系统里的点坐标转换成设备的物理像素坐标.在配有Retina显示屏的设备中,scale值是2.0,而在非Retina显 ...
- ibatis 自动生成map,bean,dao
1.下载 AbatorForEclipse1.1.0 地址:http://download.csdn.net/detail/fym548/9426877 点击Archive按钮选择下载的,然后重启My ...
- 单元测试、自动化测试、接口测试过程中的Excel数据驱动(java实现)
import java.io.FileInputStream;import java.io.InputStream;import java.util.HashMap;import java.util. ...
- PL/SQL Developer StringBuffer 专用复制
;PL/SQL Developer SpecialCopy definition;<LINE_1> for first line;<LINE_*> for all other ...