uva 1344
来源:互联网 发布:澳门 一等功 知乎 编辑:程序博客网 时间:2024/05/16 19:33
这本来是暑假集训做过的一个题 现在做来
就三种情况
1.田忌最快的比齐王最快的快 就用最快的比最快的
2.田忌最慢的比齐王最慢的快 就用最慢的比最慢的
3.上两种情况都不符合 用田忌最慢的去比齐王最快的
#include <cstdio>#include <cstdlib>#include <cmath>#include <map>#include <set>#include <queue>#include <stack>#include <vector>#include <sstream>#include <string>#include <cstring>#include <algorithm>#include <iostream>#define maxn 110#define INF 0x7fffffff#define inf 10000000#define MOD 1000000007#define ull unsigned long long#define ll long longusing namespace std;int a[1010], b[1010];int main(){ int n; while(scanf("%d",&n) && n) { for(int i = 0 ; i < n; i++) scanf("%d",&a[i]); for(int i = 0 ; i < n; i++) scanf("%d",&b[i]); sort(a, a+n); sort(b, b+n); int tjmin = 0, tjmax = n-1, qwmin = 0, qwmax = n-1; int sum = 0; while(tjmin <= tjmax) { if(a[tjmax] > b[qwmax]) { ++ sum; -- tjmax; -- qwmax; } else if(a[tjmin] > b[qwmin]) { ++ sum; ++ tjmin; ++ qwmin; } else { if(a[tjmin] < b[qwmax]) -- sum; -- qwmax; ++ tjmin; } } printf("%d\n",sum*200); } return 0;}
0 0
- uva 1344
- UVa 1556 1344
- uva
- UVA
- UVA
- UVA
- uva
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- A+B for Input-Output Practice (IV)
- LeetCode(21)Merge Two Sorted Lists
- android系统服务研究
- nodejs学习(二)
- ajax刷新ASP.NET Repeater控件的数据
- uva 1344
- Debian iptables
- Android开发入门之Action Bar用户交互
- G-BLASTN: Accelerating Nucleotide Alignment by Graphics Processors论文提供下载
- 今日之温故知新之判断素数
- 1001 A + B Problem II(C语言 大数加法模板)
- jsp中判断list为空(null或size==0)
- android图片视频缩略图显示
- 游戏特效-亮子