CodeForces 805C Find Amir
直觉。
先走$1$走到$n$,然后从$n$走到$2$,然后从$2$走到$n-1$,然后从$n-1$走到$3$。一次花费为$0$,一次花费为$1$。
#include <cstdio>
#include <cmath>
#include <set>
#include <cstring>
#include <algorithm>
using namespace std; int n; int main()
{
scanf("%d",&n); int L=2,R = n;
int ans=0; while(1)
{
if(L>=R) break;
ans++;
L++; R--;
} printf("%d\n",ans); return 0;
}
CodeForces 805C Find Amir的更多相关文章
- Find Amir CodeForces - 805C (贪心+思维)
A few years ago Sajjad left his school and register to another one due to security reasons. Now he w ...
- Find Amir CodeForces 805C
http://codeforces.com/contest/805/problem/C 题意:有n个学校,学校的编号是从1到n,从学校i到学校j的花费是(i+j)%(n+1),让你求遍历完所有学校的最 ...
- 【codeforces 805C】Find Amir
[题目链接]:http://codeforces.com/contest/805/problem/C [题意] 你能从任意一个位置i到达任意一个位置j; 花费为(i+j)%(n+1); 问你从任意一个 ...
- codeforces 804A Find Amir 思维/水题
A few years ago Sajjad left his school and register to another one due to security reasons. Now he w ...
- codeforces411div.2
每日CF: 411div2 Solved A CodeForces 805A Fake NP Solved B CodeForces 805B 3-palindrome Solved C CodeFo ...
- codeforces——贪心
codeforces 804A Find Amir http://codeforces.com/problemset/problem/804/A /* 题意:给定n个学校,需要遍历所有学校,可从任 ...
- Codeforces Round #411 (Div. 2) C. Find Amir
C. Find Amir time limit per test 1 second memory limit per test 256 megabytes A few years ago ...
- 【推导】Codeforces Round #411 (Div. 1) A. Find Amir
1 2 3 4 5 6 7 4-5-3-6-2-7-1 答案是(n-1)/2 #include<cstdio> using namespace std; int n; int main() ...
- Codeforces Round #411 (Div. 2)(A,B,C,D 四水题)
A. Fake NP time limit per test:1 second memory limit per test:256 megabytes input:standard input out ...
随机推荐
- centos7-java模拟cpu占用高及排查
环境 centos7 1核2GB Java8 模拟cpu占用高 新建一个名为jvm-learn的springboot项目 模拟代码如下 import org.springframework.boot. ...
- apache源码安装必须依赖的库apr----/etc/ld.so.conf 文件介绍
Apache所依赖的库,封装了各个系统相关的API等.虽然都是Apache开发的,但是现在最新版本的Apache和APR源码是分开的.要编Apache就必须使用APR. /etc/ld.so.conf ...
- Eclipse中使用Maven创建项目 (转)
转自:http://www.gogogogo.me/development/eclipse-maven-webapp.html Apache Maven是一个优秀的项目构建和管理工具,许多 ...
- NOIP模拟赛13
期望得分:100+0+100=200 实际得分:100+5+100=205 T1 空间卡到30M.. n<=2.5*1e7 若x是整除区间[1,n]每个数的最小的数,那么对[1,n]每个数分解质 ...
- NOIP2013 提高组 Day1
https://www.luogu.org/problem/lists?name=&orderitem=pid&tag=83%7C30 期望得分:100+100+100=300 实际得 ...
- Javascript动态绑定
<div onclick="test()"></div> <script> function test(){ //code } </scr ...
- 【洛谷】3375 KMP字符串匹配
[算法]KMP [题解][算法]字符串 #include<cstdio> #include<algorithm> #include<cstring> using n ...
- 下载Google My Tracks
http://code.google.com/p/mytracks/source/browse/?name=2.0.2#hg%2FMyTracks%253Fstate%253Dclosed 需要类似的 ...
- python并发编程之asyncio协程(三)
协程实现了在单线程下的并发,每个协程共享线程的几乎所有的资源,除了协程自己私有的上下文栈:协程的切换属于程序级别的切换,对于操作系统来说是无感知的,因此切换速度更快.开销更小.效率更高,在有多IO操作 ...
- KKT条件和拉格朗日乘子法详解
\(\frac{以梦为马}{晨凫追风}\) 最优化问题的最优性条件,最优化问题的解的必要条件和充分条件 无约束问题的解的必要条件 \(f(x)\)在\(x\)处的梯度向量是0 有约束问题的最优性条件 ...