uva 11078 - Open Credit System(水题)
来源:互联网 发布:linux网络命令大全 编辑:程序博客网 时间:2024/06/06 04:25
题目链接:uva 11078 - Open Credit System
题目大意:给出n个数,找出两个数之间差的最大值,要求num[i] - num[j](i < j)
解题思路:维护最大值Max,每次读取一个数时用Max - c,维护ans。
#include <stdio.h>#include <algorithm>using namespace std;const int INF = 0x3f3f3f3f;int main() {int cas, n;scanf("%d", &cas);while (cas--) {scanf("%d", &n);int ans = -INF, Max = -INF, c;for (int i = 0; i < n; i++) {scanf("%d", &c);ans = max(ans, Max - c);Max = max(Max, c);}printf("%d\n", ans);}return 0;}
0 0
- uva 11078 - Open Credit System(水题)
- UVA 11078 Open Credit System (水题)
- Open Credit System - UVa 11078 水题
- UVA 11078 Open Credit System
- Uva-11078-Open Credit System
- UVA 11078 - Open Credit System
- uva 11078 Open Credit System
- UVa 11078 - Open Credit System
- UVA 11078 Open Credit System
- UVA 11078 Open Credit System
- UVa:11078 Open Credit System
- UVA - 11078 Open Credit System
- Open Credit System UVa 11078
- UVA 11078 Open Credit System
- UVA 11078 - Open Credit System
- uva 11078 Open Credit System
- UVA 11078 Open Credit System
- UVA - 11078 Open Credit System
- CGContextDrawImage使用和分析
- 一些S3cmd命令
- 双阱CMOS工艺流程动画
- preorder-postorder- tree - via stack
- [leet code] Longest Common Prefix
- uva 11078 - Open Credit System(水题)
- uva 1377 - Ruler(BFS)
- linux c语言字符串函数replace,indexOf,substring等的实现
- Ideas on Reporting a bug
- 第十一章:使用Virgo开发OSGi应用程序-工程篇
- uva 1316 - Supermarket(贪心)
- poj1006中国剩余定理
- uva 11462 - Age Sort(计数排序+输入外挂)
- [leet code] Path Sum II