codeforces 610A Pasha and Stick

团体程序设计天梯赛-练习集 L2-2. 链表去重 数组模拟链表 L2-2. 链表去重 时间限制 300 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 给定一个带整数键值的单链表L,本题要求你编写程序,删除那些键值的绝对值有重复的结点。即对任意键值K,只有键值或其绝对值等于K的第一个 阅读详情

A. Pasha and Stick
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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.

Examples
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.



#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int n;
	scanf("%d", &n);

	//必须要是偶数才能组成长方形
	if (n % 2 == 0) {
		/*
		根据hint很容易得出规律
		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能被4整除,则要去掉一个相等的一对,例如{5, 5},否则的话不用去
		因为例如{4, 6} {6, 4}每种情况算了两边,所以最后除以2
		*/
		int ans = (n / 2 - (n % 4 ? 0 : 1)) / 2;
		printf("%d\n", ans);
	}
	else {
		puts("0");
	}
	return 0;
}




Kylin V10 ARM64离线安装ffmpeg实战指南 在国产化替代浪潮下,基于银河麒麟V10和ARM架构(如飞腾、鲲鹏)的内网服务器部署音视频处理服务成为常态。由于系统默认软件源缺乏aarch64包且无法连接外网,常规yum安装方式难以奏效。本文从离线安装的通用概念出发,剖析了在Kylin V10上安装ffmpeg的三大路线及其原理,重点介绍了源码编译法,包括依赖梳理、工具链准备、编译参数配置、常见错误排查等关键环节。同时,将这套依赖管理与离线部署方法论延伸至nginx、node.js、Python库及docker等场景,帮助读者建立一套可复用的国产化系统离线 阅读详情

相关推荐

抖音批量取消关注神器:5行JS代码搞定,告别手动操作(附详细步骤)

本文介绍了一种利用JS脚本在抖音创作者平台批量取消关注的高效方法。通过浏览器开发者工具执行简单的JavaScript代码,即可自动化模拟点击操作,快速清理大量关注列表,告别繁琐的手动操作。文中提供了详细的步骤和核心代码,适合有一定技术基础的用户参考。

weixin_29009971的博客 650

CodeForces - 610A. Pasha and Stick

点击打开链接 A. Pasha and Stick time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Pasha has a wooden stick of some positive integer length n.

pomake的博客 428

FPGA数字下变频实战:用Vivado DDS IP核实现IQ采样与频率校正(附MATLAB仿真对比)

本文提供了一份基于Vivado DDS IP核实现FPGA数字下变频(DDC)的完整工程指南。详细阐述了IQ采样的原理、DDC链路构建、DDS频率校正的工程实现,并重点介绍了如何利用MATLAB搭建黄金参考模型进行全链路仿真与对比验证,分享了关键的调试技巧与性能优化建议。

t1u2v的博客 814

【CodeForces】[610A]Pasha and Stick

可把数n当做由两个不同的偶数组合而成 问有多少种组合可知当为奇数或n==2时无解 对于组合n的数必定是一个小于n/2一个大于n/2 所以可把n/2来求种类 而在1~n/2的范围里有n/4个偶数 当n/2位偶数,则最后结果不能为自身 当其为奇数,则最后结果为(n/2-1)/2

BoilTask Talk Show 461

生产环境下oracle19c rac恢复节点2

现状:目前节点1数据库集群服务处于正常,节点2服务器由于系统故障无法恢复,确认系统重装。目标:不影响业务的情况下,重新把节点2添加回集群中。

sqlora的专栏 885

激光打标轴坐标计算分析

‌:基于坐标差的平方和开方运算,勾股定理将几何关系转化为代数计算,从而实现了从坐标到距离的精确转换‌12。直角三角形的应用从上图可以看到A,B,P三个点连起来就是一个直角三角形了。用勾股定理计算距离 C#有相关的方法直接传参数就可以了。很方便。

StevenChen的博客 319

【CodeForces 610A】Pasha and Stick

Pasha and StickDescription 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

楚江枫 564

无线通信技术及其在机器人中的应用

本文系统阐述了无线通信技术在机器人领域的应用框架与技术选型。首先构建了无线通信的三层理论架构:物理层解决信号传输问题,链路层处理接入控制,网络层实现组网管理。随后详细分析了主流无线技术的特性与适用场景:BLE适用于低功耗传感器节点,Wi-Fi适合高带宽视频传输,5G专网满足工业AGV的广域覆盖需求,星闪技术凭借20μs超低时延和4096台并发连接能力,为高端机器人应用提供突破性解决方案。通过鄂尔多斯隆基5G专网等典型案例,验证了5G在工业AGV规模化部署中的优势,并展望了通感算智融合、星闪+5G协同等未来发

weiyvyy的博客 1124

CodeForces 610A Pasha and Stick

F - Pasha and Stick Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Pasha has a wooden stick of some positive integer length n.

Calm微笑 420

【proteus】模拟串口和物理串口通讯

proteus提供了两种串口,一种是模拟的串口,还有一张是用软件仿真到硬件的物理串口。他们的区别就是:模拟串口只能在proteus内部进行通讯,但是物理可以通过软件映射到硬件上和单机或者串口软件通讯。 物理串口在元器件搜索COMPIM即可找到。 模拟串口在这里: PROTEUS仿真图: 物理串口COMPIM的设置: 模拟串口的设置: VSPD是一款虚拟串口软件,VSPD下载链接: 链接:https://pan.baidu.com/s/1AZygJCeWZfQTnxdCb_3TPg 提取码:12pm

阿蛋的博客 8942

OpenCV入门(一)Python环境的搭建

因为有点Python基础,并且Python是比较好入门的编程语言,所以,机器视觉后面打算在Python这个平台下进行。

小幽余生不加糖 8133

Codeforces 610A Pasha and Stick

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 t

WOLF的博客 347

JavaSwing_4.2: JDialog、JOptionPane(对话框)

JDialog,对话框。使用 JDialog 类可以创建自定义有的对话框,或者调用 JOptionPane 中的多个静态方法快速创建各种标准的对话框。JOptionPane是 JavaSwing 内部已实现好的,以静态方法的形式提供调用,能够快速方便的弹出要求用户提供值或向其发出通知的标准对话框。

谢TS的博客 7万+

Codeforces 610A Pasha and Stick 【水题】

A. Pasha and Stick time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has a wooden stick of some positive

世界很大 996

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

【CodeForces】610A - Pasha and Stick(水)

点击打开题目 A. Pasha and Stick time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has a woode

wyg1997 502

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

CodeForces - 610A-G - Pasha and Stick-思维

题目链接: http://codeforces.com/problemset/problem/610/A题目大意: 给定一个长度L,将其分为4段,要求能组成一个矩形,不能组成正方形,有多少种方案分析: 首先奇数肯定不能切隔组成矩形,需要特判,偶数中,若同时为4的倍数,说明矩形的长与宽之和为偶数,可能出现长与宽相等,所以总情况数减少一种代码:#include <cstdio>int main(

SD_Stjean的博客 484

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

CodeForces 610A Pasha and Stick (水)

A. Pasha and Stick time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has a wooden stick of some positive

Benjamin_Z的博客 471

CodeForces 610A Pasha and Stick (拆数字组成长方形)

A. Pasha and Stick time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has a wooden stick of some positive

Shyazhut 416

【codeforces】-610A-Pasha and Stick(水)

点击打开题目链接 A. Pasha and Stick time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has a wooden st

Bear1998的博客 389

CodeForces 610 A. Pasha and Stick(水~)

Description 问构造一个长度为n的长方形(不包括正方形)有多少种方案 Input 一个整数n(1<=n<=2*10^9) Output 输出构造一个长度为n的长方形(不包括正方形)的方案数,长方形边长需为正整数 Sample Input 6 Sample Output 1 Solution 水题,n为奇ans=0,n为偶ans=(n/2-1)/2 Code#incl

ZSQ 693

CodeForces 610APasha and Stick(数学)

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

菜鸟的自我修养 393

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 wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four part...

weixin_30352191的博客 119

Codeforces Round #337 (Div. 2) A Pasha and Stick B Vika and Squares

http://codeforces.com/contest/610/problem/A A题 很简单,就是给出n 然后n分成四段,能组成长方形而不能组成正方形的情况数 #include #include using namespace std; int main() { int n; while(cin >> n) { int ans ;

Pilgrim 623

hdu计算机学院大学生程序设计竞赛 2015’11 1002 投币洗衣机

投币洗衣机 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5966    Accepted Submission(s): 1495 Problem Description   如今大学生的生活条件越来越好了,近期

EventQueue的博客 1440
上一篇: hdu2795 Billboard 线段树单点更新区间最值
下一篇: hdu5652 India and China Origins 深搜+二分
Daemoonn
博客等级 码龄11年 42粉丝 198原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值