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

ACM___________________________

______________白白の屋
posts - 182, comments - 102, trackbacks - 0, articles - 0
<2010年9月>
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

常用鏈接

留言簿(24)

隨筆分類(332)

隨筆檔案(182)

FRIENDS

搜索

積分與排名

最新隨筆

最新評(píng)論

閱讀排行榜

評(píng)論排行榜

HDOJ 1070 HDU 1070 Milk ACM 1070 IN HDU

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

MiYu原創(chuàng), 轉(zhuǎn)帖請(qǐng)注明 : 轉(zhuǎn)載自 ______________白白の屋    

 

題目地址:

  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!!!!

  很簡(jiǎn)單的一道水題!!   竟然 讓我 WA 7 次.  日了 .    

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

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

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

    對(duì)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  這樣比不會(huì)有精度問題 ???

              return a.wei < b.wei;

          else return a.vol > b.vol; 

    就AC 了 !!! ....做了這么久的題才發(fā)現(xiàn) 原來 DOUBLE  是這樣比的?!?!??!?!?   

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

 

AC  代碼如下 :

 /*

Coded By  : MiYu

Link      : Link      : http://www.cnblogs.com/MiYu  || http://m.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  回復(fù)  更多評(píng)論   

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

# re: HDOJ 1070 HDU 1070 Milk ACM 1070 IN HDU  回復(fù)  更多評(píng)論   

2010-09-25 20:27 by MiYu
很水的題, 就是那個(gè) cmp 函數(shù) 害我錯(cuò) 7次, 不知道為什么, 以前一直哪有寫的沒錯(cuò), 這題就錯(cuò)了 ................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>
            国产精品久久久一区二区| 欧美成人福利视频| 精品成人在线| 性久久久久久久久| 欧美高清影院| 国产婷婷色一区二区三区| 亚洲国语精品自产拍在线观看| 亚洲欧洲中文日韩久久av乱码| 日韩视频不卡中文| 久久成人羞羞网站| 亚洲精品美女| 久久都是精品| 国内成人精品2018免费看| 亚洲欧美日韩综合| 99精品欧美一区二区三区综合在线| 欧美中文日韩| 影音先锋久久资源网| 午夜精品视频一区| 欧美一区网站| 国产精品天天看| 欧美国产丝袜视频| 国产精品高潮呻吟久久av黑人| 欧美一级播放| 欧美日韩喷水| 亚洲丰满少妇videoshd| 国产精品国产三级国产| 久久本道综合色狠狠五月| 亚洲国产日韩欧美| 欧美人成在线| 欧美在线观看视频一区二区三区| 免费观看久久久4p| 欧美一级大片在线观看| 欧美日韩亚洲一区二区三区| 男人插女人欧美| 麻豆九一精品爱看视频在线观看免费| 亚洲区一区二| 亚洲一区二区不卡免费| 日韩视频在线播放| 亚洲最新在线视频| 午夜亚洲视频| 亚洲免费电影在线| 亚洲砖区区免费| 亚洲区一区二区三区| 午夜精品视频网站| 一本久久青青| 久久久精品久久久久| 一区二区三区不卡视频在线观看| 欧美一区二区三区免费观看视频| 亚洲免费观看| 久久久青草婷婷精品综合日韩 | 亚洲欧美在线aaa| 嫩模写真一区二区三区三州| 国产精品二区在线| 国产精品v欧美精品v日韩精品| 免费在线播放第一区高清av| 欧美日韩亚洲三区| 亚洲精品激情| 在线看视频不卡| 久久午夜电影| 美女国内精品自产拍在线播放| 狠狠色丁香久久婷婷综合丁香 | 亚洲欧美中文在线视频| 久久黄色影院| 亚洲激情网址| 欧美日韩中文字幕在线视频| 亚洲欧美综合| 欧美 日韩 国产在线| 亚洲永久免费| 欧美激情国产日韩精品一区18| 一区二区三区欧美| 亚洲破处大片| 激情综合视频| 亚洲日本中文字幕区| 国产真实乱子伦精品视频| 另类酷文…触手系列精品集v1小说| 亚洲欧美激情四射在线日 | 夜夜爽www精品| 激情av一区二区| 一区二区三区国产在线| 亚洲国产岛国毛片在线| 一本一道久久综合狠狠老精东影业 | 亚洲精选久久| 久久狠狠一本精品综合网| 99www免费人成精品| 久久久久久一区二区| 性久久久久久久久久久久| 欧美精品一区二区视频| 欧美国产第二页| 国产亚洲精品aa午夜观看| 一区二区三区视频在线播放| 亚洲伦理网站| 欧美aⅴ一区二区三区视频| 久久亚洲国产精品一区二区 | 久久精品视频免费| 国产一区二区激情| 国产精品www网站| 欧美日韩福利在线观看| 欧美1区2区视频| 久久综合婷婷| 欧美成人黑人xx视频免费观看| 久久成人免费| 亚洲欧美日本日韩| 亚洲综合欧美| 欧美亚洲三级| 老牛嫩草一区二区三区日本| 欧美一区二区三区四区视频| 亚洲综合不卡| 欧美高清视频| 久久综合狠狠综合久久综青草| 激情欧美一区二区三区| 一区二区三区.www| 亚洲午夜精品久久久久久浪潮| 亚洲综合成人在线| 久久成人18免费观看| 欧美日韩成人在线播放| 亚洲第一在线视频| 久久久最新网址| 欧美gay视频激情| 亚洲国产精品久久久久秋霞蜜臀 | 欧美亚洲综合久久| 久久精品一区四区| 在线看日韩欧美| 欧美另类99xxxxx| 亚洲午夜免费视频| 久久久午夜精品| 亚洲高清免费| 欧美日本亚洲| 亚洲欧美日韩在线综合| 久久亚洲国产精品一区二区| 亚洲韩国青草视频| 欧美视频官网| 久久av一区二区三区漫画| 欧美激情一区二区三级高清视频| 99热在线精品观看| 国产精品一区二区你懂得| 欧美在线精品一区| 欧美高清不卡| 香蕉精品999视频一区二区| 在线成人h网| 国产精品红桃| 久久综合导航| 一区二区三区国产精品| 麻豆国产精品一区二区三区| 日韩亚洲欧美精品| 国产情人节一区| 欧美激情国产日韩精品一区18| 亚洲一区二区高清| 91久久久亚洲精品| 亚洲一区二区三区视频播放| 国产中文一区| 国产精品v欧美精品v日韩精品| 久久精品视频在线免费观看| 一区二区三区高清在线观看| 免费的成人av| 欧美一区二区在线看| 日韩视频一区二区三区在线播放| 国产精品一区二区在线| 欧美精品一区视频| 久久久精品tv| 亚洲一区二区三| 亚洲精品看片| 欧美国产激情二区三区| 午夜国产一区| 一本大道av伊人久久综合| 国产夜色精品一区二区av| 国产精品久久久久久亚洲调教| 欧美va天堂| 久久成人免费| 欧美在线播放高清精品| 亚洲视频图片小说| 99在线视频精品| 亚洲人久久久| 亚洲高清视频在线| 蜜臀久久久99精品久久久久久| 欧美一进一出视频| 亚洲男人的天堂在线aⅴ视频| 亚洲黄色av| 欧美日韩一区二区三区在线| 欧美精品久久99久久在免费线| 一区二区在线观看视频| 亚洲区国产区| 精品av久久707| 亚洲一区影院| 日韩手机在线导航| 美脚丝袜一区二区三区在线观看| 亚洲你懂的在线视频| 模特精品在线| 久久精品导航| 中文亚洲字幕| 一本大道久久a久久精二百| 亚洲啪啪91| 亚洲精品视频一区| 亚洲日本一区二区三区| 亚洲风情亚aⅴ在线发布| 樱桃视频在线观看一区| 在线观看一区| 亚洲精品欧美| 亚洲精品自在久久| 99在线|亚洲一区二区| 99热在线精品观看|