http://codeforces.com/contest/805/problem/C

题意:有n个学校,学校的编号是从1到n,从学校i到学校j的花费是(i+j)%(n+1),让你求遍历完所有学校的最小花费

解析:你会发现头尾相加就会使得他等于n+1的,那么他的遍历顺序应该是

  1---->n------>2------>(n-1)------->3--------->(n-2)……      以此类推下去,就会发现最终的总花费就是(n-1)/2

花费   0          1          0               1             0

#include <iostream>
using namespace std; int main(){
int n;
while(cin >> n){
cout << (n - ) / << endl;
}
}

Find Amir CodeForces 805C的更多相关文章

  1. Find Amir CodeForces - 805C (贪心+思维)

    A few years ago Sajjad left his school and register to another one due to security reasons. Now he w ...

  2. 【codeforces 805C】Find Amir

    [题目链接]:http://codeforces.com/contest/805/problem/C [题意] 你能从任意一个位置i到达任意一个位置j; 花费为(i+j)%(n+1); 问你从任意一个 ...

  3. CodeForces 805C Find Amir

    直觉. 先走$1$走到$n$,然后从$n$走到$2$,然后从$2$走到$n-1$,然后从$n-1$走到$3$.一次花费为$0$,一次花费为$1$. #include <cstdio> #i ...

  4. codeforces411div.2

    每日CF: 411div2 Solved A CodeForces 805A Fake NP Solved B CodeForces 805B 3-palindrome Solved C CodeFo ...

  5. codeforces 804A Find Amir 思维/水题

    A few years ago Sajjad left his school and register to another one due to security reasons. Now he w ...

  6. 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 ...

  7. 【推导】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() ...

  8. 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 ...

  9. codeforces——贪心

    codeforces 804A Find Amir   http://codeforces.com/problemset/problem/804/A /* 题意:给定n个学校,需要遍历所有学校,可从任 ...

随机推荐

  1. linux下搭建生成HLS所需的.ts和.m3u8文件

    要想利用HLS来实现视频的在线播放,就得需要将一个完整的视频文件切割成多个ts视频流,然后利用m3u8的索引文件来播放. 在Mac下,苹果提供了streamingTools的工具,里面有mediafi ...

  2. Maven项目之间的关系

    1. 依赖关系 1.1 标签<dependency>把另一个项目的jar引入到当前项目 1.2 自动下载另一个项目所依赖的其他项目 2. 继承关系. 2.1 父项目是pom类型 2.2 子 ...

  3. C# DataTable To Entities

    原地址忘了,修改过了一下. new: public static class DataTableEntityInteroperate { public static List<T> ToE ...

  4. 吴裕雄 python深度学习与实践(1)

    #coding = utf8 import threading,time count = 0 class MyThread(threading.Thread): def __init__(self,t ...

  5. 表的转置 行转列: DECODE(Oracle) 和 CASE WHEN 的异同点

    异同点 都可以对表行转列: DECODE功能上和简单Case函数比较类似,不能像Case搜索函数一样,进行更复杂的判断 在Case函数中,可以使用BETWEEN, LIKE, IS NULL, IN, ...

  6. java 集成友盟推送

    原文:https://blog.csdn.net/Athena072213/article/details/83414743 最近应公司业务需求需要完善友盟推送,认真看了官方文档后其实很简单,只需要细 ...

  7. nmap使用

    Nmap使用 Nmap是主机扫描工具,他的图形化界面是Zenmap,分布式框架为Dnamp. Nmap可以完成以下任务: 主机探测 端口扫描 版本检测 系统检测 支持探测脚本的编写 Nmap在实际中应 ...

  8. centos6.8下配置https服务器

    centos6.8下配置https服务器 1.1 环境 l  系统环境:内核环境为2.6.32版本  64位的CentOS release 6.8 (Final) [root@localhost ~] ...

  9. sqlmap自动注入

    基于python2.7开发 git clone https://github.com/sqlmapproject/sqlmap.git sqlmap-dev

  10. linux 后台运行命令

    command & 关闭终端,程序会终止 nohup command & 关闭终端,程序不会终止