当前位置: 首页 > news >正文

A. Ambitious Kid

time limit per test

1 second

memory limit per test

256 megabytes

Chaneka, Pak Chanek's child, is an ambitious kid, so Pak Chanek gives her the following problem to test her ambition.

Given an array of integers [A1,A2,A3,…,AN][A1,A2,A3,…,AN]. In one operation, Chaneka can choose one element, then increase or decrease the element's value by 11. Chaneka can do that operation multiple times, even for different elements.

What is the minimum number of operations that must be done to make it such that A1×A2×A3×…×AN=0A1×A2×A3×…×AN=0?

Input

The first line contains a single integer NN (1≤N≤1051≤N≤105).

The second line contains NN integers A1,A2,A3,…,ANA1,A2,A3,…,AN (−105≤Ai≤105−105≤Ai≤105).

Output

An integer representing the minimum number of operations that must be done to make it such that A1×A2×A3×…×AN=0A1×A2×A3×…×AN=0.

Examples

Input

Copy

3
2 -6 5

Output

Copy

2

Input

Copy

1
-3

Output

Copy

3

Input

Copy

5
0 -1 0 1 0

Output

Copy

0

Note

In the first example, initially, A1×A2×A3=2×(−6)×5=−60A1×A2×A3=2×(−6)×5=−60. Chaneka can do the following sequence of operations:

  1. Decrease the value of A1A1 by 11. Then, A1×A2×A3=1×(−6)×5=−30A1×A2×A3=1×(−6)×5=−30
  2. Decrease the value of A1A1 by 11. Then, A1×A2×A3=0×(−6)×5=0A1×A2×A3=0×(−6)×5=0

In the third example, Chaneka does not have to do any operations, because from the start, it already holds that A1×A2×A3×A4×A5=0×(−1)×0×1×0=0

解题说明:水题,找到绝对值最小的数,然后将该数变成0即可。

#include<stdio.h>
int main()
{int n, x, ans = 1e5;scanf("%d", &n);for (int i = 0; i < n; ++i){scanf("%d", &x);if (abs(x) <= ans){ans = abs(x);}}printf("%d", ans);return 0;
}

相关文章:

  • 网络原理由浅到深
  • 打破云墙:多云环境中的DevOps实践指南
  • qt之开发大恒usb3.0相机一
  • MySQL初阶 | 表的增删查改
  • 关于聚簇索引
  • 利用Arcgis自己绘制shp文件
  • 基于MTF的1D-2D-CNN-BiLSTM-Attention时序图像多模态融合的故障分类识别(Matlab完整源码和数据),适合研究学习,附模型研究报告
  • 若干查找算法
  • 【漫话机器学习系列】224.双曲正切激活函数(Hyperbolic Tangent Activation Function)
  • Maven进阶
  • Myweb项目——面试题总结
  • 腾讯云物联网平台
  • ASP.NET Core自动事务ActionFilter
  • 数据预处理之特征选择 (Feature Selection)
  • 深入探究 MySQL 架构:从查询到硬件
  • 100个节点的部署,整合Docker、Kubernetes和Jenkins的详细设计
  • 安全生产知识竞赛宣传口号160句
  • OpenCV --- 图像预处理(七)
  • 科学养生,拥抱健康生活
  • RD电子实验记录本选用贴士A-B-C
  • 普京发表声明感谢协助俄军收复库尔斯克州的朝鲜军人
  • 美乌总统梵蒂冈会谈,外交部:望有关各方继续通过对话谈判解决危机
  • 脱发后怎么把头发养回来?脱发自救指南来了
  • 黄永年:说狄仁杰的奏毁淫祠
  • 2025上海车展的三个关键词:辅助驾驶、性价比,AI生态
  • 加拿大温哥华一车辆冲撞人群,造成多人伤亡