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 ...
随机推荐
- linux shell学习四
Shell分支语句 case 值 in 模式1) command1 command2 command3 ;; 模式2) command1 command2 command3 ;; *) command ...
- PlantUML —— 应用于 Eclipse 的简单快速的 UML 编辑软件
PlantUML —— 应用于 Eclipse 的简单快速的 UML 编辑软件 简介: 在应用系统软件开发过程中,如果软件由很多对象组成,它的结构仅仅凭借分析很难理清,同时为了有利于软件的开发及重用, ...
- CSS选择器-常用搜集
标签选择器: div{ font-size=10px; color=red; background-color=yello; width=200px; height=200px; } <div& ...
- constant value too large
出错现场: .model small .data byte_var dw dup(-, dup()) .stack .code 将byte_var dw 'abc',10h,2 dup(-1,2 du ...
- JAVA多线程提高六:java5线程并发库的应用_线程池
前面我们对并发有了一定的认识,并且知道如何创建线程,创建线程主要依靠的是Thread 的类来完成的,那么有什么缺陷呢?如何解决? 一.对比new Threadnew Thread的弊端 a. 每次ne ...
- 自己封装的ASP.NET的MYSQL的数据库操作类
/** * 作者:牛腩 * 创建时间:2010年3月7日17时35分 * 类说明:对MYSQL数据库的操作类 */ using System; using System.Data; using MyS ...
- MQTT协议及推送服务
MQTT(Message Queuing Telemetry Transport,消息队列遥测传输协议),是一种基于发布/订阅(publish/subscribe)模式的“轻量级”通讯协议,该协议构建 ...
- arch优化开机
查看开机时间 systemd-analyze 具体开机时间 systemd-analyze blame 你可以systemctl --all | grep not-found 查看有哪些服务挂掉了.然 ...
- Windows下Oracle数据库自动备份批处理脚本
expdb命令版本 @echo off REM ########################################################### REM # Windows Se ...
- C/++——C语言备忘录
1. static变量初始化 在C中,由static修饰的静态变量在没有显式初始化时,将会被初始化为0(对于指针是NULL) 参考:https://en.wikipedia.org/wiki/Unin ...