河南省第十一届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 ...
随机推荐
- 检测u盘是否挂载上方法
打开内核log:echo "8" > /proc/sys/kernel/printk 关闭内核log:echo "1" > /proc/sys/ke ...
- java.lang.NoClassDefFoundError: org/apache/http/client/config/RequestConfig
java 错误.java.lang.NoClassDefFoundError: org/apache/http/client/config/RequestConfig 本质上是httpClient的j ...
- ES6学习--对象属性的可枚举性( enumerable)
可枚举性(enumerable)用来控制所描述的属性,是否将被包括在for...in循环之中.具体来说,如果一个属性的enumerable为false,下面三个操作不会取到该属性.* for..in循 ...
- SNMP学习笔记之Linux服务器SNMP常用OID
收集整理一些Linux下snmp常用的OID,用做服务器监控很不错. 应用示例 查看服务器1分钟平均负载: snmpwalk -v1 -c public 127.0.0.1 .1.3.6.1.4.1. ...
- Linux slab分配器【转】
本文转载自:https://www.ibm.com/developerworks/cn/linux/l-linux-slab-allocator/ 良好的操作系统性能部分依赖于操作系统有效管理资源的能 ...
- QT学习资源
http://www.qter.org/portal.php?mod=view&aid=26
- IE6里样式表不起作用解决方法
写的html页面引用外部css文件的时候在IE7,IE8和FF中能正常作用,即能正常显示,可在IE6中却完全没有作用到,即css文件里的样式根本未被解析到我们的html页面,这是什么原因? 开 始把c ...
- java的Date() 转换符
本字段下均转自 csdn 阿念1989 本文是学习网络上的文章时的总结,感谢大家无私的分享. System.out.printf()方法可以对日期做处理输出. 对应列表 转换符 类型 举例 c 完整的 ...
- 51nod 1463 找朋友(线段树+离线处理)
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1463 题意: 思路: 好题! 先对所有查询进行离线处理,按照右区间排序, ...
- LA 3644 易爆物
https://vjudge.net/problem/UVALive-3644 简单的并查集题目. #include<iostream> using namespace std; + ; ...