Codeforces Round #316 (Div. 2B) 570B Simple Game 贪心
题目:Click here
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int M = +; int n, m;
int main() {
while( ~scanf("%d %d", &n, &m ) ) {
if( n == ) {
printf("1\n");
continue;
}
if( m > n/ )
printf("%d\n", m- );
else
printf("%d\n", m+ );
}
return ;
}
Codeforces Round #316 (Div. 2B) 570B Simple Game 贪心的更多相关文章
- Codeforces Round #316 (Div. 2) B Simple Game 贪心
贪心,如果m分成的两个区间长度不相等,那么选长的那个区间最接近m的位置,否则选m-1位置,特判一下n等于1的情况 #include<bits/stdc++.h> using namespa ...
- Codeforces Round #316 (Div. 2) B. Simple Game
思路:把n分成[1,n/2],[n/2+1,n],假设m在左区间.a=m+1,假设m在右区间,a=m-1.可是我居然忘了处理1,1这个特殊数据.被人hack了. 总结:下次一定要注意了,提交前一定要看 ...
- B. Simple Game( Codeforces Round #316 (Div. 2) 简单题)
B. Simple Game time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Codeforces Round #316 (Div. 2) C. Replacement set
C. Replacement Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/570/proble ...
- Codeforces Codeforces Round #316 (Div. 2) C. Replacement 线段树
C. ReplacementTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/570/problem ...
- Codeforces Round #316 (Div. 2)
A. Elections time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- Codeforces Round #316 (Div. 2) B 贪心
B. Simple Game time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Round #316 (Div. 2) (ABC题)
A - Elections 题意: 每一场城市选举的结果,第一关键字是票数(降序),第二关键字是序号(升序),第一位获得胜利. 最后的选举结果,第一关键字是获胜城市数(降序),第二关键字是序号(升序) ...
- Codeforces Round #316 (Div. 2) C. Replacement
题意:给定一个字符串,里面有各种小写字母和' . ' ,无论是什么字母,都是一样的,假设遇到' . . ' ,就要合并成一个' .',有m个询问,每次都在字符串某个位置上将原来的字符改成题目给的字符, ...
随机推荐
- JavaSE_ API常用对象 总目录(11~14)
JavaSE学习总结第11天_开发工具 & API常用对象111.01 常见开发工具介绍11.02 Eclipse和MyEclipse的概述11.03 Eclipse的下载安装及卸载11.04 ...
- jquery ajax 使用
异步刷新实现方式有多种,也可以借助JS的多种框架,下面是使用JQuery框架实现的AJAX 验证用户名是否存在 jQuery.ajax概述 HTTP 请求加载远程数据. 通过jQuery 底层 AJA ...
- IntelliJ IDEA中创建并运行scala应用程序
1.安装scala插件 2.创建scala项目 下载scala SDK,如果你已经下载了,选择你所下载的版本,点击OK
- Myeclipse安装Activiti
1.将压缩包内activiti文件夹放入Myeclipse\dropins文件夹内并修改activiti文件夹内Link文件指向自己的目录重启Myeclipse(这时打开bpmn文件仍会报错).2.将 ...
- Noip2007提高组总结
两道基础题,后两题比较麻烦,算法想出来后,还是一些细枝末节的问题,需要特别注意,感觉Noip的题目质量还是挺高的,每做一套,都感觉会有大大小小不同的收获,就要月考了,最后把07年的题目总结一下,算是这 ...
- poj 3335 Rotating Scoreboard - 半平面交
/* poj 3335 Rotating Scoreboard - 半平面交 点是顺时针给出的 */ #include <stdio.h> #include<math.h> c ...
- Mysql 查询 字符串 (索引和通配符)
需要查询的 Mission_Info 字段 值 CYVR-0220-1240-ZYTX-1415-1740-ZUUU-9999-9999-ZZZZ-9999-9999-ZZZZ SELECT M ...
- Nginx 之二: nginx.conf 配置及基本优化
一:常用功能优化: 1:网络连接的优化: 只能在events模块设置,用于防止在同一一个时刻只有一个请求的情况下,出现多个睡眠进程会被唤醒但只能有一个进程可获得请求的尴尬,如果不优化,在多进程的ngi ...
- Python学习之一
运行Python的步骤 1 加载内存 2 词法分析 3 语法分析 4编译字节码=>机器码 5运行 11:03:49 2016-01-11
- shell实例浅谈之六文件特定行打印的多种方法
一.问题 Sed和AWK在处理文件方面有很强的优势,还有head和tail等文件处理工具的使用,grep也可实现文本的搜索.上述命令都可以在后面直接加文件名,不需要在前面使用cat添加管道,cat会影 ...