当前位置:网站首页>AtCoder B - Pizza
AtCoder B - Pizza
2022-07-23 18:29:00 【MITBlick】
Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 200200 points
Problem Statement
We have a circular pizza.
Takahashi will cut this pizza using a sequence AA of length NN, according to the following procedure.
- First, make a cut from the center in the 1212 o'clock direction.
- Next, do NN operations. The ii-th operation is as follows.
- Rotate the pizza A_iAi degrees clockwise.
- Then, make a cut from the center in the 1212 o'clock direction.
For example, if A=(90,180,45,195)A=(90,180,45,195), the procedure cuts the pizza as follows.

Find the center angle of the largest pizza after the procedure.
Constraints
- All values in input are integers.
- 1 \le N \le 3591≤N≤359
- 1 \le A_i \le 3591≤Ai≤359
- There will be no multiple cuts at the same position.
Input
Input is given from Standard Input in the following format:
NN A_1A1 A_2A2 \dots… A_NAN
Output
Print the answer as an integer.
Sample Input 1 Copy
Copy
4 90 180 45 195
Sample Output 1 Copy
Copy
120
This input coincides with the example in the Problem Statement.
The center angle of the largest pizza is 120120 degrees.
Sample Input 2 Copy
Copy
1 1
Sample Output 2 Copy
Copy
359
Sample Input 3 Copy
Copy
10 215 137 320 339 341 41 44 18 241 149
Sample Output 3 Copy
Copy
170
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3, "Ofast", "inline")
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
using namespace std;
inline int read()
{
int x = 0, y = 1;
char c = getchar();
while(c < '0' || c > '9')
{
if(c == '-') y = -1;
c = getchar();
}
while(c >= '0' && c <= '9')
x = x * 10 + c - '0', c = getchar();
return x * y;
}
typedef unsigned long long LL;
typedef pair<LL, LL> PII;
const int N = 1e6 + 10;
int n, q, res, m, cnt, maxm;
bool f[N];
signed main()
{
n = read();
f[0] = true;
for(int i = 1; i <= n; i ++ )
{
int x;
x = read();
res += x; res %= 360;
f[res] = true;
}
for(int i = 0; i <= 360; i ++ )
{
if(f[i % 360])
{
maxm = max(maxm, cnt);
cnt = 0;
}
cnt ++;
}
cout << maxm << endl;
}边栏推荐
- R language filters the data columns specified in dataframe, and R language excludes (deletes) the specified data columns (variables) in dataframe
- Robot decision-making system based on self-learning (daki technology, Zhao kaiyong)
- 20. Valid Parentheses有效的括号
- Understand chisel language. 21. Chisel sequential circuit (I) -- detailed explanation of chisel register
- What are offline data and real-time data
- GPS北斗时钟服务器(NTP网络时钟系统)施工部署方案
- [interview: concurrent Article 22 multithreading: reentrantlock]
- 我在代码里面故意留个漏洞,违法吗?
- [Luogu p6656] [LOJ 173] [template] runs (string) (Lyndon string)
- PowerCLi 管理VMware vCenter 一键批量部署OVF
猜你喜欢
![Codeworks round 805-808 [partial solution]](/img/02/6fb3a963eac165cbae64cdfc0735e1.png)
Codeworks round 805-808 [partial solution]

Powercli moves virtual machines from host01 host to host02 host

简历上写的电商,那请问Redis 如何实现库存扣减操作和防止被超卖?

White paper on adaptive robot interaction

ACM mm 2022 oral | dig: the new framework of self-monitoring character recognition refreshes the recognition performance of 11 public scene character data sets, with an average improvement of 5%

《自适应机器人交互白皮书》

PowerCLi 导入 LicenseKey 到esxi

编译器LLVM-MLIR-Intrinics-llvm backend-instruction

Why do you get confused when you ask JVM?

PC performance monitoring tool is an indispensable helper for software testers
随机推荐
Redux求和案例详解版教程
selenium中元素定位正确但是操作失败,6种解决办法全稿定
20. Valid Parentheses有效的括号
(干货)结合Scikit-learn介绍几种常用的特征选择方法
R language mapping: coordinate axis setting
Compiler llvm MLIR introductions llvm backend instruction
三维点云课程(六)——三维目标检测
详谈双亲委派机制(面试常问)[通俗易懂]
Energy principle and variational method note 14: summary + problem solving
攻防世界web题-fakebook
能量原理與變分法筆記19:最小餘能原理+可能功原理
R语言ggpubr包的ggarrange函数多幅图像组合起来、annotate_figure组合图像添加注释、注解、标注信息、使用top参数在可视化图像顶部添加注解信息(自定义字体颜色、大小、样式)
【无标题】
Brief analysis of compiling principle of.Net CLR R2R
Energy principle and variational method note 15: solution of differential element method
PC性能监测工具,软件测试人员不可或缺的好帮手
PowerCLi 将虚拟机从Host01主机移动到Host02主机
Construction deployment scheme of GPS Beidou clock server (NTP network clock system)
PowerCLi 导入 LicenseKey 到esxi
3D point cloud course (VII) -- feature point description