ZOJ 3202 Second-price Auction
来源:互联网 发布:象神佛牌禁忌知多少 编辑:程序博客网 时间:2024/06/05 01:51
注意排序函数的参数,从1开始,即s+1.。。。
#include<stdio.h>
#include<stdlib.h>
struct node{
int num;
int pos;
}s[100];
int cmp(const void *a, const void *b)
{
struct node *c = (struct node *)a;
struct node *d = (struct node *)b;
return d->num > c->num;
}
int main()
{
int t,n,i;
while(scanf("%d",&t)!=EOF)
{
while(t--){
memset(s,0,sizeof(s));
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&s[i].num);
s[i].pos=i;
}
qsort(s+1,n,sizeof(s[1]),cmp);
printf("%d %d\n",s[1].pos,s[2].num);
}
}
system("pause");
return 0;
}
- zoj 3202 Second-price Auction
- ZOJ 3202 Second-price Auction
- zoj 3202 Second-price Auction
- ZOJ#3202:Second-price Auction
- ZOJ 3202 Second-price Auction
- ZOJ 3202 Second-price Auction
- ZOJ 3202 Second-price Auction (模拟)
- ZOJ 3202Second-price Auction(排序)
- ZOJ-3202-Second-price Auction【6th浙江省赛】
- Second-price Auction
- Second-price Auction
- Codeforces386A. Second-Price Auction
- codeforces Second-Price Auction
- Second-price Auction
- zoj3202 Second-price Auction
- ZOJ3202-Second-price Auction
- A. Second-price Auction
- Codeforces 513C Second price auction (bruteforce)
- 1 ORB test实验代码
- struts全局结果集
- Solr 4.0: Realtime GET
- IP地址转换函数——inet_ntop(),inet_pton(),htonl(),ntohl()
- hdu1016 (素数环)(深度优先搜索)另附:http://acm.nyist.net/JudgeOnline/problem.php?pid=488
- ZOJ 3202 Second-price Auction
- 【hdu 2660】Accepted Necklace 二维费用01背包
- Socket编程中需要用到的头文件
- 【二分】划分数列
- n 个数中最小的 k 个数
- 三极管基础知识
- sicily--1930. 排序
- struts.xml详解
- jquery tabs使用最简化实例