日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

AMAZING AUCTION (第三届省赛)

發(fā)布時(shí)間:2025/4/14 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 AMAZING AUCTION (第三届省赛) 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

AMAZING AUCTION

?

(這道麼。。。。英文題,,硬傷, 也是隊(duì)友寫(xiě)的;題意是 從數(shù)據(jù)中找到與眾不同的數(shù)據(jù), 且該價(jià)錢(qián)是最低的(也就是競(jìng)標(biāo)) ?代碼應(yīng)該不難);

?

?

題目描述

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. What an amazing thing! Now you could buy cool stuff with one penny. Your task is to write the software to automate this auction system. First the auctioneer puts an upper limit on bid price for each item. Only positive price less than or equal to this price limit is a valid bid. For example, if the price limit is 100, then 1 to 100, inclusive, are all valid bid prices. Bidder can not put more than one bid for the same price on a same item. However they can put many bids on a same item, as long as the prices are different. After all bids are set, the auctioneer chooses the winner according to the following rules: (1). If any valid price comes from only one bidder, the price is a "unique bid". If there are unique bids, then the unique bid with the lowest price wins. This price is the winning price and the only bidder is the winning bidder. (2). If there are no unique bids, then the price with fewest bids is the winning bid. If there are more than one price which has the same lowest bid count, choose the lowest one. This price is the winning price. The bidder who puts this bid first is the winning bidder. Given the price limit and all the bids that happen in order, you will determine the winning bidder and the winning price.

?

輸入

The first line contains two integers: U (1 <= U <= 1000), the price upper limit and M (1 <= M <= 100), the total number of bids. M lines follow, each of which presents a single bid. The bid contains the bidder's name (consecutive non-whitespace characters<=5) and the price P (1 <= P <= U), separated with a single space. All bids in the input are guaranteed to be valid ones.

?

輸出

Print the sentence "The winner is W" on the first line, and "The price is P" on the second.

?

樣例輸入

30 7 Mary 10 Mary 20 Mary 30 Bob 10 Bob 30 Carl 30 Alice 23

樣例輸出

The winner is Mary The price is 20







1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<ctype.h> 5 #define N 1010 6 #define max(a, b)(a > b ? a : b) 7 8 typedef struct node 9 { 10 char s[10]; 11 int p; 12 } node; 13 14 int cmp(const void *a, const void *b) 15 { 16 node *s1 = (node *)a, *s2 = (node *)b; 17 return s1->p - s2->p; 18 } 19 int main() 20 { 21 node node[N]; 22 int m, n, i, x, a[N]; 23 char str[N]; 24 while(scanf("%d%d", &m, &n) != EOF) 25 { 26 memset(a, 0, sizeof(a)); 27 for(i = 0 ; i < n ; i++) 28 { 29 scanf("%s%d", node[i].s, &node[i].p); 30 a[node[i].p]++; 31 } 32 qsort(node, n, sizeof(node[0]), cmp); 33 for(i = 0 ; i < n ; i++) 34 { 35 if(node[i].p <= m && a[node[i].p] == 1) 36 { 37 strcpy(str, node[i].s); 38 x = node[i].p; 39 break; 40 } 41 } 42 printf("The winner is %s\nThe price is %d\n", str, x); 43 } 44 return 0; 45 }

?

轉(zhuǎn)載于:https://www.cnblogs.com/yishilin/p/4476641.html

總結(jié)

以上是生活随笔為你收集整理的AMAZING AUCTION (第三届省赛)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 色婷婷香蕉在线一区二区 | 精品伦精品一区二区三区视频 | 电影中文字幕 | n0659极腔濑亚美莉在线播放播放 | 国产精品久久中文字幕 | 中文字幕欧美色图 | 97国产视频 | 成人夜色| 欧美日韩亚洲一区二区 | 天堂在线免费视频 | h部分肌肉警猛淫文 | 极品videosvideo喷水 | 欧美精品videos另类 | 亚洲免费区 | 黄瓜视频在线免费看 | 色婷婷综合在线 | 免费观看国产精品 | 香蕉精品在线 | 韩国午夜影院 | 99在线精品视频免费观看软件 | 日本免费一区二区三区四区 | 成人影片在线免费观看 | 中文字幕人成乱码熟女香港 | 在线观看视频一区 | 国产欧美二区 | 国产又黄又爽 | 国产在线观看成人 | 超碰97在线播放 | 免费在线不卡视频 | 97神马影院 | 四虎新网站 | av瑟瑟 | 大尺度网站在线观看 | 男同av在线观看一区二区三区 | 天堂视频一区二区 | 黄色网页网站 | 亚洲精品国产精品国自产 | 91成人免费版 | 日少妇的逼 | 日本在线中文字幕专区 | 国产精品秘入口18禁麻豆免会员 | 免费黄色小说视频 | 亚洲 欧美 视频 | 亚洲一区精品视频 | 亚洲 欧美 成人 | 五月婷婷,六月丁香 | 午夜精品亚洲 | 中文字幕第一页在线视频 | 天天操天天干天天插 | 男人天堂网站 | 你懂得在线 | 国产精品久久免费视频 | 初尝情欲h名器av | 伊人久久大香线蕉av色婷婷色 | 国产aaa| xxxxx色| 欧美性猛交99久久久久99按摩 | 中文字幕在线免费视频 | 国产国语性生话播放 | 日韩在线视频免费观看 | 黄色国产毛片 | bbbbbbbbb毛片大片按摩 | 国产又黄又粗又猛又爽 | 波多野结衣 久久 | 久久草国产 | 偷拍女澡堂一区二区三区 | 久久久久久天堂 | 美女av网站 | 性色av一区 | 天堂色综合 | 火影忍者羞羞漫画 | 哪个网站可以看毛片 | 中文在线а√在线 | www.色国产| 久久精品国产视频 | 韩国色网| 97久久久久久久 | 亚洲最大的黄色网 | 欧美大片黄 | 国产免费激情 | 日韩视频在线免费观看 | 欧美福利视频一区二区 | 亚洲激情视频在线播放 | 免费色网| 韩国成年人网站 | 亚洲天堂系列 | 91黄色片| 成人黄色动漫在线观看 | 蜜桃视频一区二区三区在线观看 | 91丨porny丨海角社区 | jzjzz成人免费视频 | 成人欧美一区二区三区小说 | 91黑人精品一区二区三区 | 911精品 | 久久看毛片 | 青草青在线 | 国产婷婷色一区二区在线观看 | 久久久国产精品x99av | 久久网站免费观看 |