河南省第十一届ACM大学生程序设计竞赛
nyoj-1365-山区修路
内存限制:128MB 时间限制:3000ms 特判: No
通过数:4 提交数:4 难度:3
题目描述:
SNJ位于HB省西部一片群峰耸立的高大山地,横亘于A江、B水之间,方圆数千平方公里,相传上古的神医在此搭架上山采药而得名。景区山峰均在海拔3000米以上,堪称"华中屋脊"。SNJ是以秀绿的亚高山自然风光,多样的动植物种,人与自然和谐共存为主题的森林生态区。
SNJ处于中国地势第二阶梯的东部边缘,由大巴山脉东延的余脉组成中高山地貌,区内山体高大,高低不平。 交通十分不便。
最近,HB省决定修一条从YC市通往SNJ风景区的高速公路。经过勘测分析,途中需要经过高度分别为H1,H2,……,Hn的N个山区。由于高低不平,除正常的修路开支外,每段还要多出高度差|Hi - Hi-1|*X万元的斜坡费用。Dr. Kong 决定通过填高一些区域的高度来降低总的费用。当然填高也是需要一些费用的。每填高Y单位,需要付出Y2万元费用。
你能否帮Dr. Kong做出一个规划,通过部分填高工程改造,使得总的费用降下来。
输入描述:
第一行: T 表示以下有T组测试数据( 1≤ T ≤8 )
对每组测试数据,
第一行:N X(2 ≤ N ≤100,000 1≤ X ≤100)
第二行:N个整数,分别表示N个区域的高度Hi( 1<=Hi<=100 , i=1…. n)
输出描述:
对每组测试数据,输出占一行,一个整数,即经过部分填高工程改造后的最少费用。
样例输入:
1
5 2
2 3 5 1 4
样例输出:
15
提示:
上传者:root
比赛时候想到正解,没敢写,真不知道100亿的复杂度0ms,真是醉了= =
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
int f[][];
int a[];
int main(){
int t,n,X,m,i,j,k;
cin>>t;
while(t--){
int maxh=;
cin>>n>>X;
for(i=;i<=n;++i) scanf("%d",a+i),maxh=max(maxh,a[i]);
memset(f,inf,sizeof(f));
for(i=a[];i<=maxh;++i) f[][i]=(i-a[])*(i-a[]);
for(i=;i<=n;++i){
for(j=a[i];j<=maxh;++j){
for(k=a[i-];k<=maxh;++k){
f[i][j]=min(f[i][j],f[i-][k]+(j-a[i])*(j-a[i])+abs(j-k)*X);
}
}
}
int ans=inf;
for(i=;i<=maxh;++i)ans=min(ans,f[n][i]);
cout<<ans<<endl;
}
return ;
}
1370-Attack City and Capture Territory
内存限制:128MB 时间限制:3000ms 特判: No
通过数:1 提交数:1 难度:2
题目描述:
The Three Kingdoms period was a relatively famous period in the history of China. From the Battle of Chibi (AD 211) to the reunification of China in the Western Jin Dynasty(AD 280). During the period, Cao's Wei State, Liu's Shu State, and Sun's Wu Guo's Three Kingdoms stood together. Therefore, it was called the Three Kingdoms period.
In the last years of the Eastern Han Dynasty, Dong_ Z specialized in power , the coalition forces of the world's princes crusade against each other. Among them, Liu_B and Sun_Q, who are school students, also participated in the crusade.
In AD 215 , Liu_B and Sun_Q simultaneously attacked JingZhou and directly threatened Dong Z's city. There were N firepower points on the high wall, each fire point with different s trength Xi . Liu_B and Sun_Q looked at the high walls and the strong gates, they did not attack the city traightaway. They negotiate to attack firepower point alternately. Who breaks through the last firepower point, he will win the city.
Because of limited weaponry, weapons of each side can only attack one firepower at a time. But they can control whether completely destroy this firepower point or weaken the strength of firepower point.
Liu_B has a strong think-tank. After calculation, he finds out who will attack first , who will more likely win the city .
输入描述:
The first line of the input contains one integer T, which is the number of test cases (1<=T<=10). Each test case specifies: * Line 1: N ( 1 ≤ N ≤ 100 ) * Line 2: X1 X2… Xn ( 1 <= Xi<=1000 i=1…. n)
输出描述:
For each test case , print “Liu_B is sure to win.” Or “Liu_B is not sure to win.” , suppose Liu_B first attacks.
样例输入:
3
2
1 3
2
3 3
5
1 2 3 4 5
样例输出:
Liu_B is sure to win.
Liu_B is not sure to win.
Liu_B is sure to win.
提示:
#include<bits/stdc++.h>
using namespace std;
int main(){
int t,n,m,i,j,k;
cin>>t;
while(t--){
int ans=;
cin>>n;
for(i=;i<=n;++i){
scanf("%d",&k);
ans^=k;
}
ans?puts("Liu_B is sure to win."):puts("Liu_B is not sure to win.");
}
return ;
}
河南省第十一届ACM大学生程序设计竞赛的更多相关文章
- 【河南省第十一届ACM大学生程序设计竞赛-D】.求XF+闭包
如何设计一个好的数据库不仅仅是一个理论研究问题,也是一个实际应用问题.在关系数据库中不满足规范化理论的数据库设计会存在冗余.插入异常.删除异常等现象. 设R(U)是一个关系模式,U={ A1,A ...
- Alice and Bob(2013年山东省第四届ACM大学生程序设计竞赛)
Alice and Bob Time Limit: 1000ms Memory limit: 65536K 题目描述 Alice and Bob like playing games very m ...
- 2013年山东省第四届ACM大学生程序设计竞赛-最后一道大水题:Contest Print Server
点击打开链接 2226: Contest Print Server Time Limit: 1 Sec Memory Limit: 128 MB Submit: 53 Solved: 18 [Su ...
- 山东省第四届ACM大学生程序设计竞赛解题报告(部分)
2013年"浪潮杯"山东省第四届ACM大学生程序设计竞赛排名:http://acm.upc.edu.cn/ranklist/ 一.第J题坑爹大水题,模拟一下就行了 J:Contes ...
- [2012山东省第三届ACM大学生程序设计竞赛]——n a^o7 !
n a^o7 ! 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2413 Time Lim ...
- angry_birds_again_and_again(2014年山东省第五届ACM大学生程序设计竞赛A题)
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2877 题目描述 The problems ca ...
- 第八届山东省ACM大学生程序设计竞赛个人总结
因为省赛,从开学紧张到5月7号.心思也几乎全放在ACM的训练上.因为我还是校台球协会的会长,所以台协还有一些事情需要忙,但是我都给延迟了.老会长一直在催我办校赛,但我一直说 等等吧,因为校赛只能在周六 ...
- sdut Mountain Subsequences 2013年山东省第四届ACM大学生程序设计竞赛
Mountain Subsequences 题目描述 Coco is a beautiful ACMer girl living in a very beautiful mountain. There ...
- ZZUOJ-1195-OS Job Scheduling(郑州大学第七届ACM大学生程序设计竞赛E题)
1195: OS Job Scheduling Time Limit: 2 Sec Memory Limit: 128 MB Submit: 106 Solved: 35 [id=1195&quo ...
随机推荐
- 如何加固linux NFS 服务安全的方法
NFS(Network File System)是 FreeBSD 支持的一种文件系统,它允许网络中的计算机之间通过 TCP/IP 网络共享资源.不正确的配置和使用 NFS,会带来安全问题. 概述 N ...
- Linux启动vi编辑器时提示E325: ATTENTION解决方案
Linux启动vi编辑器时提示E325: ATTENTION解决方案 Vi编辑器是Linux的文本编辑器,在Linux系统的运用非常广泛,不少朋友在打开Vi编辑器的时候提示E325: ATTENTIO ...
- 20145101《Java程序设计》第一周学习总结
20145101 <Java程序设计>第1周学习总结 教材学习内容总结 开学的第一周,通过课上老师的介绍和课下阅读教材我简单的了解java的发展历程,了解了JVM.JRE.JDK分别是什么 ...
- 2018-2019-1 20189218《Linux内核原理与分析》第四周作业
构造简单的Linux内核 显然用实验楼配好的环境做这个实验太简单了,按照没有困难制造困难也要上的原则,在自己的64位虚拟机上做这个实验. 按照课本(视频)上的步骤一直做下去,到编译生成init时出现了 ...
- 20145212罗天晨 逆向及Bof基础实践
20145212罗天晨<网络对抗>第1周学习总结--逆向及Bof基础实践 逆向及Bof基础实践 一.实践目标 1.运行原本不可访问的代码片段 2.强行修改程序执行流 3.以及注入运行任意代 ...
- Splay简介
Splay树,又叫伸展树,可以实现快速分裂合并一个序列,几乎可以完成平衡树的所有操作.其中最重要的操作是将指定节点伸展到指定位置, 目录 节点定义 旋转操作 伸展操作 插入操作 删除操作 lower_ ...
- windows下如何获取系统已存在的盘符 【c++】
#include <iostream> #include "classAh.h" #include <atlstr.h> using namespace s ...
- AP聚类算法
一.算法简介 Affinity Propagation聚类算法简称AP,是一个在07年发表在Science上的聚类算法.它实际属于message-passing algorithms的一种.算法的基本 ...
- 加强树状数组luogu3368
暴力树状数组30分,这该怎么办: 知识点回顾 差分数组中 开头结尾改变了值之后 求他的前缀,发现区间内所有数都改变 然后我们做差分树状数组 #include<cstdio> using n ...
- Mysql相关问题收集
1.查询每个班级的前三名 DROP TABLE IF EXISTS `sc`; CREATE TABLE `sc` ( `id` ) NOT NULL AUTO_INCREMENT, `name` v ...