Find Amir CodeForces 805C
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的更多相关文章
- Find Amir CodeForces - 805C (贪心+思维)
A few years ago Sajjad left his school and register to another one due to security reasons. Now he w ...
- 【codeforces 805C】Find Amir
[题目链接]:http://codeforces.com/contest/805/problem/C [题意] 你能从任意一个位置i到达任意一个位置j; 花费为(i+j)%(n+1); 问你从任意一个 ...
- CodeForces 805C Find Amir
直觉. 先走$1$走到$n$,然后从$n$走到$2$,然后从$2$走到$n-1$,然后从$n-1$走到$3$.一次花费为$0$,一次花费为$1$. #include <cstdio> #i ...
- codeforces411div.2
每日CF: 411div2 Solved A CodeForces 805A Fake NP Solved B CodeForces 805B 3-palindrome Solved C CodeFo ...
- codeforces 804A Find Amir 思维/水题
A few years ago Sajjad left his school and register to another one due to security reasons. Now he w ...
- 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 ...
- codeforces——贪心
codeforces 804A Find Amir http://codeforces.com/problemset/problem/804/A /* 题意:给定n个学校,需要遍历所有学校,可从任 ...
随机推荐
- java 代理学习
转自黄勇大神的博客.http://my.oschina.net/huangyong/blog/159788 Proxy,也就是“代理”了.意思就是,你不用去做,别人代替你去处理. 它在程序开发中起到了 ...
- sql-mybatis-多表查询不查的字段一定不要查
在多表联查的时候,这时用的是左外联(即如果右边的没有就查出左边的表) 如果右边的没有,那么在Navicat中查询出如下图 而在mybatis中运用同样的查询语句时,查询出来字段的也是这样 这时如果左表 ...
- zookeeper 常用cLi命令
官网:https://zookeeper.apache.org/doc/r3.4.8/zookeeperAdmin.html#sc_zkCommands stat path [watch] set p ...
- 1.5、CDH 搭建Hadoop在安装之前(定制安装解决方案)
Cloudera托管两种类型的软件存储库,您可以使用它们来安装诸如Cloudera Manager或CDH-parcel存储库和软件包存储库之类的产品. 在大多数情况下,这些存储库是有效的解决方案,但 ...
- webpack-manifest-plugin
[webpack-manifest-plugin] Webpack plugin for generating an asset manifest. This will generate a mani ...
- http4e eclipse plugin 插件介绍
感谢作者的分享: http://blog.csdn.net/wiker_yong/article/details/10066905 以及作者的破解jar.目前看网站留言说已经git了. 官网链接地址: ...
- Hibernate一对多关联映射的配置及其级联删除问题
首先举一个简单的一对多双向关联的配置: 一的一端:QuestionType类 package com.exam.entity; import java.util.Set; public class Q ...
- android 区分wifi是5G还是2.4G(转)
http://bbs.csdn.net/topics/391033966?page=1 我一开始看这帖子,找不到答案,为了后来的人,我来回复吧.WifiManager wifiManager = (W ...
- centos 7 redis-4.0.11 主从
redis-master:192.168.199.223 redis-slave: 192.168.199.224 cd /opt wget http://download.redis.io/rele ...
- verilog task1
问题描述: 设计中需要重复多次施加一种激励,每一次激励的施加过程,都可以划分为4个部分,如图所示. 每一次施加的激励只有第二部分的数据有变化(数据格式无变化).所以顶层的Testbench代码如下: ...