HDU-1034 Candy Sharing Game 模拟问题(水题)
题目链接:https://cn.vjudge.net/problem/HDU-1034
水题
代码
#include <cstdio>
#include <algorithm>
int n;
long long stu[10000+5], max, min;
int func(void){
int tmp[2]={stu[0]/=2, 0};
for (int i=0; i<n; i++){
tmp[1]=stu[i+1]/=2;
stu[(i+1)%n]+=tmp[0];
tmp[0]=tmp[1];
if (stu[(i+1)%n]%2) stu[(i+1)%n]+=1;
if (i==0) max=min=stu[(i+1)%n];
max=std::max(stu[(i+1)%n], max);
min=std::min(stu[(i+1)%n], min);
}
return min!=max;
}
int main(void){
while (scanf("%d", &n)==1 && n){
for (int i=0; i<n; i++){
scanf("%d", &stu[i]);
if (i==0) {min=max=stu[i];}
max=std::max(stu[i], max);
min=std::min(stu[i], min);
}
int cnt=0;
if (min!=max) while (func()) cnt++;
printf("%d %d\n", cnt+1, max);
}
return 0;
}
HDU-1034 Candy Sharing Game 模拟问题(水题)的更多相关文章
- HDU 1034 Candy Sharing Game (模拟)
题目链接 Problem Description A number of students sit in a circle facing their teacher in the center. Ea ...
- hdu 1034 Candy Sharing Game
Candy Sharing Game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- HDU 5867 Water problem ——(模拟,水题)
我发这题只是想说明:有时候确实需要用水题来找找自信的~ 代码如下: #include <stdio.h> #include <algorithm> #include <s ...
- HDU 5832 A water problem(某水题)
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...
- Candy Sharing Game(模拟搜索)
Candy Sharing Game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- hdu 2393:Higher Math(计算几何,水题)
Higher Math Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- <hdu - 3999> The order of a Tree 水题 之 二叉搜索的数的先序输出
这里是杭电hdu上的链接:http://acm.hdu.edu.cn/showproblem.php?pid=3999 Problem Description: As we know,the sha ...
- HDOJ/HDU 1256 画8(绞下思维~水题)
Problem Description 谁画8画的好,画的快,今后就发的快,学业发达,事业发达,祝大家发,发,发. Input 输入的第一行为一个整数N,表示后面有N组数据. 每组数据中有一个字符和一 ...
- hdu 1164:Eddy's research I(水题,数学题,筛法)
Eddy's research I Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
随机推荐
- P1776 宝物筛选_NOI导刊2010提高(02)(背包的二进制优化)
题目描述 终于,破解了千年的难题.小FF找到了王室的宝物室,里面堆满了无数价值连城的宝物……这下小FF可发财了,嘎嘎.但是这里的宝物实在是太多了,小FF的采集车似乎装不下那么多宝物.看来小FF只能含泪 ...
- RabbitMq笔记()
RabbitMq 就是类似于一个数据库样式的操作工具. rabbit解释 有用户名登录密码之类的,还可以创建用户名,创建作用文件之类的. 2. 3.
- 命令行神器 cmder
下载地址:http://cmder.net/ 修改命令提示符λ为$ 进入解压后的 cmder 的目录,进入 vendor,打开 clink.lua 文件. 修改 local cmder_prompt ...
- 用SqlDataReader返回多个结果集
using System; using System.Data; using System.Data.SqlClient; namespace Northwind { class Program { ...
- 【BZOJ1014】【JSOI2008】火星人prefix
题意: Description 火星人最近研究了一种操作:求一个字串两个后缀的公共前缀.比方说,有这样一个字符串:madamimadam,我们将这个字符串的各个字符予以标号:序号: 1 2 3 4 5 ...
- FFT&NTT学习笔记
具体原理就不讲了qwq,毕竟证明我也不太懂 FFT(快速傅立叶变换)&NTT(快速数论变换) FFT //求多项式乘积 //要求多项式A和多项式B的积多项式C //具体操作就是 //DFT(A ...
- Mean, Median, Mode, Range, and Standard Deviation
Descriptive statistics tell you about the distribution of data points in data set. The most common m ...
- 2015 Multi-University Training Contest 1 y sequence
Y sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total ...
- leetCode(38):Lowest Common Ancestor of a Binary Search Tree
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS ...
- pchip和spline差别