UVA Open Credit System Uva 11078
题目大意:给长度N的A1.....An 求(Ai-Aj)MAX 枚举n^2 其实动态维护最大值就好了 #include<iostream>
#include<cstdio>
using namespace std;
int t,a[],n,ans,MAX;
int main()
{
scanf("%d",&t);
while (t--)
{
scanf("%d",&n);
for (int i=;i<=n;i++) scanf("%d",&a[i]);
MAX=a[n];ans=-;
for (int i=n-;i>=;i--)
{
ans=max(ans,a[i]-MAX);
MAX=min(MAX,a[i]);
}
printf("%d\n",ans);
}
}
UVA Open Credit System Uva 11078的更多相关文章
- 【UVA 11078】BUPT 2015 newbie practice #2 div2-A -Open Credit System
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102419#problem/A In an open credit system, the ...
- UVA 11078 Open Credit System(扫描 维护最大值)
Open Credit System In an open credit system, the students can choose any course they like, but there ...
- Open Credit System(UVA11078)
11078 - Open Credit System Time limit: 3.000 seconds Problem E Open Credit System Input: Standard In ...
- Open Credit System
Open Credit SystemInput: Standard Input Output: Standard Output In an open credit system, the studen ...
- Uva----------(11078)Open Credit System
Open Credit System Input:Standard Input Output: Standard Output In an open credit system, the studen ...
- UVa 11549 Open Credit System
题意:给出n个数,找出两个整数a[i],a[j](i < j),使得a[i] - a[j]尽量大 从小到大枚举j,在这个过程中维护a[i]的最大值 maxai晚于ans更新, 可以看这个例子 1 ...
- UVa 11400 - Lighting System Design(线性DP)
链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- 【线性结构上的动态规划】UVa 11400 - Lighting System Design
Problem F Lighting System Design Input: Standard Input Output: Standard Output You are given the tas ...
- UVa 11400 Lighting System Design(DP 照明设计)
意甲冠军 地方照明系统设计 总共需要n不同类型的灯泡 然后进入 每个灯电压v 相应电压电源的价格k 每一个灯泡的价格c 须要这样的灯泡的数量l 电压低的灯泡能够用电压高的灯泡替换 ...
随机推荐
- 返回值是TEXT的阿贾克斯方法
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- c语言的学习秘籍之链表
刚翻出来的作品,有点低级,但希望能起到作用: #include<stdio.h>#include<stdlib.h>#include<time.h>#include ...
- Python爬虫爬取糗事百科段子内容
参照网上的教程再做修改,抓取糗事百科段子(去除图片),详情见下面源码: #coding=utf-8#!/usr/bin/pythonimport urllibimport urllib2import ...
- jquery parent() parents() closest()区别
分类: 前端开发 parent是找当前元素的第一个父节点,不管匹不匹配都不继续往下找 parents是找当前元素的所有父节点 closest() 是找当前元素的所有父节点 ,直到找到第一个匹配的父节 ...
- mysql 表迁移
http://blog.csdn.net/evan_endian/article/details/8652528 mysql中把一个表的数据批量导入另一个表中 不管是在网站开发还是在应用程序开发 ...
- logstash读取redis数据
类型设置: logstash中的redis插件,指定了三种方式来读取redis队列中的信息. list=>BLPOP (相当 ...
- Web 播放声音 — AMR(Audio) 篇
本文主要介绍 AMR(Aduio) 播放 AMR 格式 Base64码 音频. 1.必备资料 github AMR 开源库 :https://github.com/jpemartins/amr.js用 ...
- How to install flashplugin on ubuntu
sudo apt-get install flashplugin-installer
- [原创] Gradle DSL method not found: 'android()' 和 buildToolsVersion is not specified 的解决办法。
今天在用Android Studio 2.0 打开别人的较早版本生成的工程时, 提示: Gradle DSL method not found: 'android()'. 解决办法为,打开根目录下面的 ...
- MySQL的create table as 与 like区别
对于MySQL的复制相同表结构方法,有create table as 和create table like 两种,区别是什么呢? ? 1 create table t2 as select * fro ...