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. Windows Server 2008 R2微软官方下载

    注意:Windows Server 2008 R2仅有64位版本. 以下下载地址为Windows Server 2008 R2 RTM Build 7600.16385的评估版本,此版本可免费试用18 ...

  2. eclipse git 分享项目到GitHub上

    先在github上创建仓库

  3. 怎么在idea中新建package包,只有directory选项

    http://blog.csdn.net/liyanlei5858/article/details/77320063

  4. Spark MLlib特征处理:OneHotEncoder OneHot编码 ---原理及实战

    http://m.blog.csdn.net/wangpei1949/article/details/53140372 Spark MLlib特征处理:OneHotEncoder OneHot编码 - ...

  5. CMake Error at cmake/OpenCVModule.cmake:295 (message): No extra modules found in folder:Please provide path to 'opencv_contrib/modules' folder

    其实,我们使用的opencv中要用的contrib/modules   是需要额外下载并在cmakelists.txt中指定的 git clone https://github.com/opencv/ ...

  6. 内存占用过高 kill 调整mysql内存占用

    通过 /var/log/messages  查看  被系统kill掉的进程   如果是自己崩溃会产生 hs_err_ 修改mysql  my.cnf    innodb_buffer_pool_siz ...

  7. 使用openshit在ubuntu14.04下一键部署openstack(juno版本)

    一.基本介绍 本实验是在vmware workstation上虚拟机ubuntu14.04(64bit,desktop)上部署openstack(Juno版本).采用的工具是openshit.open ...

  8. keras初探

    1.对网络的理解: 2.怎样训练,输入已经数据,经过训练,输入测试数据,得到相似数据 3.RNNs  循环神经网络

  9. oracle中sequence(自增序号)的用法

    转载:https://www.cnblogs.com/liuzy2014/p/5794928.html 在oracle中sequence就是序号,每次取的时候它会自动增加.sequence与表没有关系 ...

  10. dedecms(织梦系统)如何更新手机版首页模板文件

    https://jingyan.baidu.com/article/ad310e80e4b1dd1849f49e8f.html