ZOJ 3202: Second-price Auction

ZOJ 3202: Second-price Auction

///@author Sycamore, ZJNU
///@date 2017-02-09
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
    int T,N;
    cin >> T;
    while (T--)
    {
        cin >> N;
        vector<int>v(N);
        for (auto &e : v)cin >> e;
        cout << max_element(v.begin(), v.end()) - v.begin()+1 << ‘ ‘;
        sort(v.begin(), v.end(), greater<int>());
        cout << v[1] << endl;
    }
    return 0;
}
时间: 2024-10-10 05:04:40

ZOJ 3202: Second-price Auction的相关文章

ZOJ 3202 Second-price Auction (A)

Second-price AuctionTime Limit: 1 Second Memory Limit: 32768 KBDo you know second-price auction? It's very simple but famous. In a second-price auction, each potential buyer privately submits, perhaps in a sealed envelope or over a secure connection,

Codeforces 513C Second price auction 概率dp 求期望

题目链接:点击打开链接 题意: 有n个人去竞拍一件商品,下面给出n个区间表示每个人出的价是区间中随机的一个数(概率均等) 则第一名需要付的钱是第二名的竞拍价格(允许并列第一名) 求支付的钱的期望. 思路: 枚举付的钱,然后求付这个钱的概率,相乘后求和即可. 对于确定支付x元 分类讨论一下: 1.第一名出价大于x 枚举第一名,然后剩下来的人至少一个人出x元,其他人出<=x, P(剩下来的人一个人出x元,其他人出<=x) = P(剩下来的人出价<=x) - P(剩下的人出价<x) 2.

AMAZING AUCTION (第三届省赛)

AMAZING AUCTION (这道麽....英文题,,硬伤, 也是队友写的:题意是 从数据中找到与众不同的数据, 且该价钱是最低的(也就是竞标)  代码应该不难): 题目描述 Recently the auction house has introduced a new type of auction, the lowest price auction. In this new system, people compete for the lowest bid price, as oppos

河南省第三届acm省赛 AMAZING AUCTION

AMAZING AUCTION 时间限制:3000 ms  |  内存限制:65535 KB 难度:4 描述 Recently the auction house has introduced a new type of auction, the lowest price auction. In this new system, people compete for the lowest bid price, as opposed to what they did in the past. Wh

浙江省第6届程序设计竞赛结题报告汇总 zoj3202-3212

zoj 3202 Second-price Auction 水题,不解释了,直接贴代码 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; struct node{ int x; int y; }; struct node number[105]; int cmp(struct node a,struct node b){

Rockethon 2015

A Game题意:A,B各自拥有两堆石子,数目分别为n1, n2,每次至少取1个,最多分别取k1,k2个, A先取,最后谁会赢. 分析:显然每次取一个是最优的,n1 > n2时,先手赢. 代码: 1 #include <bits/stdc++.h> 2 #define pb push_back 3 #define mp make_pair 4 #define esp 1e-14 5 #define lson l, m, rt<<1 6 #define rson m+1, r,

百度是否会金卡身份卡是否

http://www.ebay.com/cln/yuus_impgrcdt/auction/158168378014/20150131 http://www.ebay.com/cln/yuus_impgrcdt/auction/158168384014/20150131 http://www.ebay.com/cln/yuus_impgrcdt/auction/158168388014/20150131 http://www.ebay.com/cln/yuus_impgrcdt/auction/

ZOJ 3333 Guess the price

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3758 题面: Guess the Price Time Limit: 1 Second      Memory Limit: 32768 KB In the television program "Shopping Street" of CCTV-2, two people, A and B are guessing price of a given it

zoj 1503 - One Person &quot;The Price is Right&quot;

题目:有一个数字让你猜,你有k次机会,并且有k个保险如果猜的低了会高度你低了, 高了会告诉你高了,并且失去一k保险(k=0时猜高了就会失败),现在问你能猜的数字范围. 分析:dp,二维动态规划.按保险k和猜的机会n递增的方向dp. 状态:f(G,L)为有G次猜的机会,L个保险时确定的数字范围(1~N): 转移方程:F(G,L)= G(G-1,L)+ 1 + F(G-1,L-1){ 猜低 + 猜中 + 猜高 }: 边界条件:如果没有失败机会的话,只能从1开始向后猜: 说明:(2011-10-03