UVa10026 - Shoemaker's Problem
来源:互联网 发布:域名top 编辑:程序博客网 时间:2024/06/03 14:07
#include <stdio.h>#include <stdlib.h>#define N 1010int n;int t[N], s[N];int num[N];int cmp(const void *_p, const void *_q);int main(){ int iCase; int i;#ifndef ONLINE_JUDGE freopen("e:\\uva_in.txt", "r", stdin);#endif scanf("%d", &iCase); while (iCase--) { scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &t[i], &s[i]); num[i] = i; } qsort(num, n, sizeof(int), cmp); for (i = 0; i < n; i++) { if (i) printf(" "); printf("%d", num[i] + 1); } printf("\n"); if (iCase) printf("\n"); } return 0;}int cmp(const void *_p, const void *_q){ int *p = (int *)_p; int *q = (int *)_q; int ans; ans = s[*p] * t[*q] - s[*q] * t[*p]; if (ans > 0) return -1; else if (ans < 0) return 1; return *p - *q;}
- UVa10026 - Shoemaker's Problem
- uva10026 - Shoemaker's Problem
- uva10026 - Shoemaker's Problem
- [贪心]Shoemaker's Problem uva10026
- uva10026 - Shoemaker's Problem(贪心)
- Shoemaker's Problem
- 10026 - Shoemaker's Problem
- 10026 - Shoemaker's Problem
- UVaOJ10026 - Shoemaker's Problem
- Shoemaker's Problem
- Shoemaker's Problem
- 110405 Shoemaker's Problem
- UVA Shoemaker's Problem
- 10026 - Shoemaker's Problem
- UVa 10026 - Shoemaker's Problem
- uva 10026 - Shoemaker's Problem
- uva 10026 - Shoemaker's Problem
- uva 10026 - Shoemaker's Problem
- 状态栏SystemUI的启动过程
- C#调用C/C++ 动态链接库DLL(二)
- MyEclipse内存溢出问题
- Vim配置
- PHP学习之一:PHP脚本、类型和变量
- UVa10026 - Shoemaker's Problem
- VC++图形平移功能的实现
- REST架构之Apache Wink介绍
- 随机函数
- PHP提取emule下载ed2k链接
- 地图符号化-柱状图
- 黑马程序员——Java的基本构成元素
- Perl 引用变量传入函数中的行为
- C#调用C/C++ 动态链接库DLL(三)