A. Pasha and Stick
 

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 test(s)
input
6
output
1
input
20
output
4
Note

There is only one way to divide the stick in the first sample {1, 1, 2, 2}.

Four ways to divide the stick in the second sample are {1, 1, 9, 9}, {2, 2, 8, 8}, {3, 3, 7, 7} and {4, 4, 6, 6}. Note that {5, 5, 5, 5} doesn't work.

题意:给你一个n,让你将它分成  {a,a,b,b} a!=b 有多少方案

题解:  n要能除尽2,答案就是n/2,如果n能除4 答案-1

//meek///#include<bits/stdc++.h>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include<iostream>
#include<bitset>
#include<vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
using namespace std ;
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define fi first
#define se second
#define MP make_pair
typedef long long ll; const int N = ;
const int M = ;
const int inf = 0x3f3f3f3f;
const int MOD = ;
const double eps = 0.000001; ll a[N],n,ans;
int main() { scanf("%I64d",&n);
if(n%!=) cout<<<<endl;
else {
n/=;
ans = n/;
if(n%==) ans--;
cout<<ans<<endl;
} return ;
}

代码

Codeforces Round #337 (Div. 2) A. Pasha and Stick 水题的更多相关文章

  1. Codeforces Round #337 (Div. 2) A. Pasha and Stick 数学

    A. Pasha and Stick 题目连接: http://www.codeforces.com/contest/610/problem/A Description Pasha has a woo ...

  2. Codeforces Round #311 (Div. 2)B. Pasha and Tea 水题

    B. Pasha and Tea Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/prob ...

  3. Codeforces Round #337 (Div. 2) B. Vika and Squares 水题

    B. Vika and Squares   Vika has n jars with paints of distinct colors. All the jars are numbered from ...

  4. Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题

    Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  ...

  5. Codeforces Round #290 (Div. 2) A. Fox And Snake 水题

    A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...

  6. Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题

    A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...

  7. Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题

    B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...

  8. Codeforces Round #368 (Div. 2) A. Brain's Photos 水题

    A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...

  9. Codeforces Round #359 (Div. 2) A. Free Ice Cream 水题

    A. Free Ice Cream 题目连接: http://www.codeforces.com/contest/686/problem/A Description After their adve ...

随机推荐

  1. Mac下如何显示隐藏文件/文件夹_百度经验

    在应用程序里打开终端, cd 你的文件夹名 ls -a 即可显示该文件夹下的所有隐藏文件   如果你想打开整个系统的隐藏文件可以在终端下输入以下命令: defaults write com.apple ...

  2. 【EF Code First】Migrations数据库迁移

    1,打开工具->NuGet程序管理器->程序包管理器控制台 默认项目中要选择  数据访问上下文类  所在的项目 我的DB是在命名空间CodeFirst.UI下的所以选择CodeFirst. ...

  3. MVC4.0 利用HandleErrorAttribute和log4net实现记录异常日志功能

    1.MVC4.0中HandleErrorAttribte已经帮我们处理了异常问题,当我们新建一个非空的MVC项目时候,在FilterConfig中会发现这样的代码 public class Filte ...

  4. ubuntu中安装Rstdio无法切换中文输入法

    安装了RStudio,发现没法切换出中文输入法,搜索了一下 具体参考这里:https://support.rstudio.com/hc/en-us/articles/205605748-Using-R ...

  5. 华硕电脑安装ubuntu出现问题及决方案

    问 题 一:华硕电脑安装ubuntu时无线网络禁用解决方案:打开终端(Ctrl+alt+t)运行命令sudo rmmod acer-wmi,然后开启无线,连接上后便可以上网(附上ubuntu论坛上讨论 ...

  6. 2.Modelsim打开时出现的Error

    Modelsim之error “unable to check out a viewer license necessary for use of the modelsim graph.Vsim is ...

  7. CentOS安装Git实现多人同步开发

    描 述 要开发一个"cms系统",有2个人分别是:晓飞, 盈月.要求使用Git来进行版本控制. 项目信息 版本控制:Git 项目名称:cms 开发人员:xiaofei,yingyu ...

  8. SQL SERVER完整、差异和事务日志备份及还原(脚本和GUI实现) [原创]

    一.完整备份.差异备份和事务日志备份的脚本 --完整备份数据库 BACKUP DATABASE Test_Bak TO DISK = 'E:\20150609_75\bak\Test_bak_full ...

  9. Notes of the scrum meeting(11/2)

    meeting time:13:00~13:30p.m.,November 2nd,2013 meeting place:3号公寓楼一层 attendees: 顾育豪                  ...

  10. Retry Pattern

    Retry Pattern https://msdn.microsoft.com/en-us/library/dn589788.aspx https://msdn.microsoft.com/en-u ...