A. Pasha and Stick

题目连接:

http://www.codeforces.com/contest/610/problem/A

Description

Pasha has a wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four parts of the stick. Each part must have some positive integer length and the sum of these lengths will obviously be n.

Pasha likes rectangles but hates squares, so he wonders, how many ways are there to split a stick into four parts so that it's possible to form a rectangle using these parts, but is impossible to form a square.

Your task is to help Pasha and count the number of such ways. Two ways to cut the stick are considered distinct if there exists some integer x, such that the number of parts of length x in the first way differ from the number of parts of length x in the second way.

Input

The first line of the input contains a positive integer n (1 ≤ n ≤ 2·109) — the length of Pasha's stick.

Output

The output should contain a single integer — the number of ways to split Pasha's stick into four parts of positive integer length so that it's possible to make a rectangle by connecting the ends of these parts, but is impossible to form a square.

Sample Input

20

Sample Output

4

Hint

题意

给你一个长度为n的木棍,问你有多少种切法,切出四条边,然后使得切出来的能够组成矩形,而不能组成正方形

题解:

组成矩形很简单,l + h = n/2 ,种类数就是 n/4

由于l = h的话是正方形,就-1就好了

代码

#include<bits/stdc++.h>
using namespace std; int main()
{
long long ans;
cin>>ans;
if(ans%2==1)
return puts("0");
cout<<(ans/2-1)/2<<endl;
}

最新文章

  1. js 压缩工具总结
  2. 读Java 804 - Quick refresher
  3. 浅谈 MVP in Android
  4. 连接器|网络滤波连接器|电脑连接器|RJ45变压器-华联威电子有限公司
  5. oralce health monitor
  6. CentOS6.4卸载自带的OpenJDK并安装jdk1.6.21
  7. 写Java程序的三十个基本规则【新手必读】
  8. ES1:Windows下安装ElasticSearch
  9. ceph 高级运维
  10. BZOJ5412 : circle
  11. LDAP与实现
  12. myls
  13. 【XSY1515】【GDKOI2016】小学生数学题 组合数学
  14. QToolButton按钮
  15. 【LeetCode】547. 朋友圈
  16. time since epoch
  17. javascript将算法复杂度从O(n^2)做到O(n)
  18. VS2005快捷键大全
  19. VS中 Winform查看窗体内控件之间的相互关系
  20. uva 12086 线段树or树状数组练习

热门文章

  1. 设置TextView控件的背景透明度和字体透明度
  2. Delphi 调用串口例子
  3. java基础语法知识
  4. 数据结构(12) -- 图的邻接矩阵的DFS和BFS
  5. linux常用的一些命令(不断增加中)
  6. linux下安装subversion出现libtool: link: only absolute run-paths are allowed
  7. Linux下静态库生成和使用
  8. C#获取文件的绝对路径
  9. UTC+0800是什么意思
  10. EntityFramwork6连接MySql错误