codeforces 411 div2-find amir
来源:互联网 发布:linux sh 函数 编辑:程序博客网 时间:2024/06/06 18:45
A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.
There are n schools numerated from 1 to n. One can travel between each pair of them, to do so, he needs to buy a ticket. The ticker between schoolsi and j costs and can be used multiple times. Help Sajjad to find the minimum cost he needs to pay for tickets to visit all schools. He can start and finish in any school.
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of schools.
Print single integer: the minimum cost of tickets needed to visit all schools.
2
0
10
4
In the first example we can buy a ticket between the schools that costs .
#include<cstdio>#include<iostream>using namespace std;int main(){int n;cin >> n;if (n % 2==0) {cout << n / 2 - 1 << endl;}else cout << (n - 1) / 2 << endl;return 0;}
- codeforces 411 div2-find amir
- Codeforces Round #411 C. Find Amir
- 【Codeforces Round #411 (Div. 1)】Codeforces 804A Find Amir
- CodeForces 805C Find Amir
- Codeforces 805C Find Amir
- codeforces 804A Find Amir
- Codeforces Round #411 (Div. 2) C. Find Amir
- Codeforces Round #411(Div. 2)C. Find Amir【思维】
- Codeforces Round #411 C.Find Amir (思维题)
- codeforces 804A——Find Amir
- Find Amir
- Codeforces Round #411 (Div. 2) C. Find Amir(简单题目)
- 小白题解 Codeforces 804A Find Amir
- Codeforces Round #411(A. Fake NP; B. 3-palindrome; C. Find Amir; D.Minimum number of steps)
- Codeforces805 C. Find Amir
- CF411div2C.Find Amir
- C. Find Amir
- [Codeforces805] C. Find Amir
- 總結——關於2017 10 23測試的分析總結
- oracle hint(提示)大全
- Spring学习笔记(一)
- 17102101_CentOS7下利用systemd机制实现tomcat开机自启动
- nio使用之netty框架
- codeforces 411 div2-find amir
- 《c语言程序设计》例 2-8 2-9 2-10 2-11
- Gson 解析数组数组时
- springboot 快速集成的一些启动类模块
- 关于SimpleDateFormat安全的时间格式化线程安全问题
- Qt 学习 第6节 添加绘图控件Qwt
- ICCV2017: Unlabeled Samples Generated by GAN Improve the Person Re-Identification Baseline in Vitro
- openCV学习笔记(1)
- opencv-模板匹配