青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

ACM___________________________

______________白白の屋
posts - 182, comments - 102, trackbacks - 0, articles - 0
<2010年12月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

常用鏈接

留言簿(24)

隨筆分類(332)

隨筆檔案(182)

FRIENDS

搜索

積分與排名

最新隨筆

最新評論

閱讀排行榜

評論排行榜

HDOJ 1070 HDU 1070 Milk ACM 1070 IN HDU

Posted on 2010-09-18 11:29 MiYu 閱讀(1896) 評論(2)  編輯 收藏 引用 所屬分類: ACM ( 水題 )

MiYu原創, 轉帖請注明 : 轉載自 ______________白白の屋    

 

題目地址:

  http://acm.hdu.edu.cn/showproblem.php?pid=1070

題目描述:

Milk

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4483    Accepted Submission(s): 983


Problem Description
Ignatius drinks milk everyday, now he is in the supermarket and he wants to choose a bottle of milk. There are many kinds of milk in the supermarket, so Ignatius wants to know which kind of milk is the cheapest.

Here are some rules:
1. Ignatius will never drink the milk which is produced 6 days ago or earlier. That means if the milk is produced 2005-1-1, Ignatius will never drink this bottle after 2005-1-6(inclusive).
2. Ignatius drinks 200mL milk everyday.
3. If the milk left in the bottle is less than 200mL, Ignatius will throw it away.
4. All the milk in the supermarket is just produced today.

Note that Ignatius only wants to buy one bottle of milk, so if the volumn of a bottle is smaller than 200mL, you should ignore it.
Given some information of milk, your task is to tell Ignatius which milk is the cheapest.
 

Input
The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case starts with a single integer N(1<=N<=100) which is the number of kinds of milk. Then N lines follow, each line contains a string S(the length will at most 100 characters) which indicate the brand of milk, then two integers for the brand: P(Yuan) which is the price of a bottle, V(mL) which is the volume of a bottle.
 

Output
For each test case, you should output the brand of the milk which is the cheapest. If there are more than one cheapest brand, you should output the one which has the largest volume.
 

Sample Input
2 2 Yili 10 500 Mengniu 20 1000 4 Yili 10 500 Mengniu 20 1000 Guangming 1 199 Yanpai 40 10000
 

Sample Output
Mengniu Mengniu
Hint
In the first case, milk Yili can be drunk for 2 days, it costs 10 Yuan. Milk Mengniu can be drunk for 5 days, it costs 20 Yuan. So Mengniu is the cheapest.In the second case, milk Guangming should be ignored. Milk Yanpai can be drunk for 5 days, but it costs 40 Yuan. So Mengniu is the cheapest.
 

 

題目分析 :

  SHIT!!!!

  很簡單的一道水題!!   竟然 讓我 WA 7 次.  日了 .    

  沒仔細看清題目啊 ,  以為是水題就大意了..............    注意輸出的 后面有一點  TIP :   

    If there are more than one cheapest brand, you should output the one which has the largest volume.

   其他的就是 算出 平均每天的 花費 排個序就OK了 .  但是這里又 讓我 惡心了 :

    對DOUBLE 型排序 用  :

       if ( a.wei - b.wei > 1e-7 )

        return true;

      else if ( a.wei - b.wei < 1e-7 )

        return false;

      else return a.vol > b.vol;

    竟然是 WA  !!!!!!  硬是改用:

       if ( a.wei != b.wei )  //  double  這樣比不會有精度問題 ???

              return a.wei < b.wei;

          else return a.vol > b.vol; 

    就AC 了 !!! ....做了這么久的題才發現 原來 DOUBLE  是這樣比的?!?!??!?!?   

    求 解釋.............. 

 

AC  代碼如下 :

 /*

Coded By  : MiYu

Link      : Link      : http://www.cnblogs.com/MiYu  || http://www.shnenglu.com/MiYu

Author By : MiYu

Test      : 1

Program   : 1070

*/

//#pragma warning( disable:4789 )

#include <iostream>

#include <algorithm>

#include <string>

#include <set>

#include <map>

#include <utility>

#include <queue>

#include <stack>

#include <list>

#include <vector>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <cmath>

using namespace std;

typedef struct milk {

       char name[110];

       int pay;

       int vol; 

       double wei;    

}ML;

ML M;

bool cmp ( const ML &a, const ML &b ){

     if ( a.wei != b.wei )

        return a.wei < b.wei;

     else return a.vol > b.vol;  

int main ()

{

    int T;

    cin >> T; 

    while ( T -- ){

          int N;

          vector <ML> vec;

          cin >> N;

          for ( int i = 0; i < N; ++ i ){

               cin >> M.name >> M.pay >> M.vol;

               int d = 0;

               int t = M.vol;

               while ( t >= 200 && d <= 4 ){

                     d ++;

                     t -= 200;  

               }

               if ( d ) {

                   M.wei = M.pay * 1.0 / d; 

                   vec.push_back ( M );

               }

          }       

          sort ( vec.begin(), vec.end(), cmp );

          cout << vec[0].name << endl;

    }

    return 0;

}


 

 

 

Feedback

# re: HDOJ 1070 HDU 1070 Milk ACM 1070 IN HDU  回復  更多評論   

2010-09-24 12:19 by Tanky Woo
代碼這么少,我等會也去做做。

# re: HDOJ 1070 HDU 1070 Milk ACM 1070 IN HDU  回復  更多評論   

2010-09-25 20:27 by MiYu
很水的題, 就是那個 cmp 函數 害我錯 7次, 不知道為什么, 以前一直哪有寫的沒錯, 這題就錯了 ................double 還能用 != 比較, 0rz............
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲视频在线观看免费| 久久久福利视频| 欧美精品v日韩精品v韩国精品v | 你懂的网址国产 欧美| 国模 一区 二区 三区| 欧美在线播放| 欧美一二三区在线观看| 国产一区三区三区| 久久久天天操| 久久综合久久美利坚合众国| 亚洲国产成人精品久久| 亚洲第一级黄色片| 欧美日韩大片一区二区三区| 亚洲欧美日韩国产另类专区| 午夜精品久久久久| 在线成人av.com| 亚洲精品欧美日韩| 国产精品久久国产精麻豆99网站| 亚洲欧美色婷婷| 久久福利精品| 亚洲精选91| 亚洲欧洲av一区二区| 狠狠色狠狠色综合日日五| 亚洲国产va精品久久久不卡综合| 欧美麻豆久久久久久中文| 亚洲欧美日韩在线综合| 久久黄金**| 一本色道久久综合| 午夜视频在线观看一区二区| 影音先锋另类| 亚洲视频1区| 亚洲国产一区视频| 亚洲欧美在线一区| 日韩午夜电影av| 欧美一区视频在线| 日韩午夜免费| 久久精品官网| 亚洲欧美国产精品桃花| 久久影音先锋| 久久都是精品| 欧美日韩成人在线播放| 久久久久久久91| 久久久久se| 欧美美女喷水视频| 久久精品欧美日韩| 欧美高清视频免费观看| 欧美亚洲综合久久| 欧美xx视频| 久久久久网站| 国产精品福利网| 亚洲激情一区二区三区| 国产一区二区高清不卡| 中文av字幕一区| 亚洲大片av| 午夜日韩在线观看| 亚洲性视频网址| 欧美成人综合在线| 免费观看欧美在线视频的网站| 欧美特黄视频| 日韩网站免费观看| 欧美一区精品| 免费亚洲电影在线| 国产精品免费视频观看| 亚洲国产精品成人精品| 精品成人一区二区三区| 亚洲免费在线| 亚洲永久免费av| 欧美日韩国产一级| 亚洲片区在线| 亚洲精品少妇网址| 欧美成人一区二区在线| 欧美护士18xxxxhd| ●精品国产综合乱码久久久久| 午夜在线一区| 欧美综合国产精品久久丁香| 欧美性天天影院| 一区二区三区久久网| 亚洲一区在线播放| 国产精品久久久久天堂| 亚洲影院免费| 久久狠狠亚洲综合| 国产在线成人| 久久久久青草大香线综合精品| 欧美日韩一区二区在线观看视频| 亚洲国产91| 夜夜嗨av一区二区三区网页| 欧美日韩福利视频| 一区二区三区四区国产| 亚洲欧美久久久| 国产三级欧美三级| 久久精品国产综合| 欧美国产日韩亚洲一区| 日韩视频一区二区三区在线播放免费观看 | 久久久美女艺术照精彩视频福利播放 | 亚洲精品国久久99热| 一区二区三区四区五区视频| 亚洲国产精品va在线看黑人 | 黄色成人在线网站| 久久精品欧美日韩| 欧美激情一区二区三区四区| 亚洲精品一区二区在线观看| 欧美日韩美女在线| 欧美有码在线视频| 欧美黄在线观看| 午夜精品久久久久久久99樱桃| 国产一区二区三区无遮挡| 欧美成人激情视频| 午夜一区二区三视频在线观看| 蜜桃av久久久亚洲精品| 亚洲无线视频| 亚洲激情不卡| 国产农村妇女精品一二区| 美日韩精品视频免费看| 亚洲一区三区视频在线观看| 亚洲第一免费播放区| 欧美自拍偷拍| 一区二区三区成人精品| 亚洲成人在线网站| 欧美黄色小视频| 欧美国产日韩一区二区三区| 亚洲午夜国产成人av电影男同| 国产精品一区在线观看你懂的| 美女网站在线免费欧美精品| 亚洲男人第一网站| 亚洲欧洲综合另类| 久久午夜羞羞影院免费观看| 新狼窝色av性久久久久久| 亚洲美女黄色| 亚洲日本免费电影| 亚洲成色www久久网站| 国产美女精品免费电影| 欧美天天在线| 欧美精品xxxxbbbb| 女人香蕉久久**毛片精品| 久久精品国产亚洲精品 | 亚洲免费在线| 亚洲精品久久久久中文字幕欢迎你 | 久久久xxx| 欧美一区二区播放| 午夜国产精品视频| 亚洲一区二区三区四区在线观看| 亚洲国产激情| 欧美激情免费在线| 欧美国产视频日韩| 欧美a级理论片| 久久在线视频在线| 老司机精品久久| 欧美mv日韩mv亚洲| 美女福利精品视频| 嫩草影视亚洲| 欧美大片一区二区三区| 欧美大片在线观看一区二区| 欧美激情1区2区| 亚洲激情啪啪| 亚洲美女av在线播放| 一区二区高清视频在线观看| 99re国产精品| 亚洲免费在线视频| 亚洲欧美一区二区三区极速播放| 亚洲一区二区免费看| 亚洲欧美日韩一区二区在线| 性色av一区二区三区| 欧美专区福利在线| 美女脱光内衣内裤视频久久影院| 母乳一区在线观看| 欧美精品免费在线观看| 欧美日韩中文字幕在线| 国产精品最新自拍| 精品不卡一区| 一区二区三区精品| 久久xxxx| 欧美激情亚洲另类| 9色精品在线| 先锋影音国产精品| 欧美成人激情在线| 国产精品久久久久久久久久久久 | 美女日韩在线中文字幕| 欧美精品999| 国产欧美一区二区精品婷婷| 精品白丝av| 亚洲一区免费| 美女网站在线免费欧美精品| 亚洲国产美女| 亚洲欧美一区二区三区久久| 久久综合九色九九| 国产精品美女久久久浪潮软件| 伊大人香蕉综合8在线视| 一区二区不卡在线视频 午夜欧美不卡' | 噜噜噜久久亚洲精品国产品小说| 欧美精品三级日韩久久| 国产在线欧美| 中文日韩在线| 欧美成人有码| 亚洲一区二区精品在线| 欧美精品成人一区二区在线观看 | 国产精品99一区| 亚洲成人在线观看视频| 午夜精品久久久久久久99热浪潮| 欧美激情一区二区三区蜜桃视频 | 亚洲精品一区二区三区樱花|