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

ACM___________________________

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

常用鏈接

留言簿(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原創(chuàng), 轉(zhuǎn)帖請注明 : 轉(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!!!!

  很簡單的一道水題!!   竟然 讓我 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 了 !!! ....做了這么久的題才發(fā)現(xiàn) 原來 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  回復(fù)  更多評論   

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

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

2010-09-25 20:27 by MiYu
很水的題, 就是那個 cmp 函數(shù) 害我錯 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>
            国产精品毛片在线| 久久久亚洲精品一区二区三区 | 欧美日韩国产页| 久久久久国色av免费看影院| 欧美日韩日本国产亚洲在线| 欧美激情在线观看| 国产一区二区三区黄| 亚洲一区二区在| 亚洲性图久久| 欧美日本在线播放| 欧美a级理论片| 伊人久久大香线蕉av超碰演员| 亚洲在线第一页| 亚洲欧美日韩国产中文在线| 欧美日韩亚洲在线| 亚洲区欧美区| 亚洲黄色毛片| 美女视频黄免费的久久| 久久综合九色综合欧美就去吻| 国产中文一区| 欧美在线视频在线播放完整版免费观看 | 亚洲欧洲日产国产综合网| 久久国产色av| 久久久精品2019中文字幕神马| 国产精品成人一区二区艾草| 夜夜嗨av一区二区三区四季av| 一本不卡影院| 欧美性猛交视频| 亚洲视频第一页| 亚洲男人的天堂在线| 国产精品盗摄久久久| 亚洲手机成人高清视频| 亚洲欧美日韩中文在线制服| 国产精品入口66mio| 香港久久久电影| 免费成人高清在线视频| 亚洲国产一区在线| 欧美激情一区三区| 日韩一级在线观看| 先锋影音一区二区三区| 国产日韩在线不卡| 久久精品在线播放| 欧美韩日视频| 亚洲午夜久久久久久久久电影网| 国产精品高潮呻吟久久av无限| 亚洲欧美日韩系列| 毛片av中文字幕一区二区| 亚洲激情一区二区三区| 欧美另类极品videosbest最新版本 | 欧美在线一二三区| 国产在线观看91精品一区| 久久久伊人欧美| 亚洲精品中文字幕女同| 小黄鸭精品aⅴ导航网站入口 | 国产精品一区免费视频| 久久久97精品| 日韩一级裸体免费视频| 久久精品成人一区二区三区| 亚洲国产精品一区二区第一页| 欧美日韩国产综合视频在线观看中文| 亚洲伊人久久综合| 欧美成人免费在线观看| 亚洲综合久久久久| 在线看片第一页欧美| 欧美日韩一区二区三区在线观看免| 亚洲中字黄色| 亚洲激情第一页| 欧美综合二区| 一级日韩一区在线观看| 国内成人精品2018免费看| 欧美片在线观看| 久久久久久久国产| 亚洲视屏在线播放| 亚洲国产另类久久久精品极度| 久久疯狂做爰流白浆xx| 日韩视频在线一区| 激情久久久久| 国产欧美日韩精品丝袜高跟鞋| 欧美成人精品不卡视频在线观看| 午夜久久一区| 国产精品99久久久久久久vr| 亚洲福利视频三区| 久久男女视频| 欧美一级播放| 亚洲天堂av电影| 亚洲精品欧美日韩专区| 曰本成人黄色| 国户精品久久久久久久久久久不卡 | 欧美日韩成人在线| 老**午夜毛片一区二区三区| 性欧美xxxx大乳国产app| 一区二区毛片| 夜夜嗨一区二区三区| 亚洲黄色免费网站| 欧美 日韩 国产 一区| 久久精品国产免费看久久精品| 亚洲在线免费视频| 日韩视频三区| 亚洲精品视频在线观看网站| 亚洲国产精品va在线观看黑人| 悠悠资源网亚洲青| 国产在线精品二区| 国产一区二区三区的电影| 国产精品日日摸夜夜添夜夜av| 国产精品护士白丝一区av| 欧美视频不卡| 欧美视频日韩视频在线观看| 欧美日韩一区精品| 欧美日本不卡视频| 欧美日韩国产系列| 欧美日韩亚洲免费| 欧美性大战xxxxx久久久| 欧美日韩免费视频| 欧美丝袜第一区| 国产精品vvv| 国产精品一区二区在线| 国产亚洲欧美日韩在线一区| 国产一区二区| 曰本成人黄色| 亚洲精一区二区三区| 国产精品99久久久久久人| 亚洲欧美日韩国产一区二区| 欧美自拍偷拍| 欧美高清成人| 日韩视频在线一区二区三区| 国产精品99久久久久久白浆小说| 午夜精品久久| 久久一区二区视频| 欧美精品在线观看| 国产精品乱码妇女bbbb| 国产日韩欧美一区二区三区在线观看 | 亚洲狠狠丁香婷婷综合久久久| 亚洲欧洲一二三| 亚洲女性喷水在线观看一区| 久久国产婷婷国产香蕉| 免费黄网站欧美| 亚洲欧洲综合另类| 亚洲永久免费视频| 久久久av网站| 欧美日韩在线一二三| 国产亚洲精品美女| 亚洲精品久久视频| 亚洲欧美成人网| 欧美不卡一卡二卡免费版| 日韩一区二区久久| 久久爱www| 欧美日韩另类字幕中文| 国产一区二区三区无遮挡| 亚洲精品无人区| 欧美在线首页| 亚洲精品乱码久久久久久按摩观| 亚洲欧美在线观看| 欧美r片在线| 国内精品伊人久久久久av影院| 亚洲美女视频| 久久久久久亚洲精品不卡4k岛国| 亚洲人成免费| 久久精品国产久精国产爱| 欧美日韩国产丝袜另类| 激情久久久久久| 欧美亚洲免费电影| 亚洲精品一二| 老司机成人在线视频| 国产日韩欧美一区| 亚洲视频免费在线观看| 欧美国产大片| 久久黄色影院| 国产久一道中文一区| 宅男噜噜噜66一区二区| 欧美**人妖| 久久成人人人人精品欧| 国产精品成人免费视频 | 亚洲激情一区二区| 久久精品成人一区二区三区蜜臀| 一区二区三区视频观看| 欧美黄色小视频| 亚洲国产精品一区二区www在线| 久久九九精品| 午夜精品一区二区三区电影天堂 | 国产精品男gay被猛男狂揉视频| 日韩亚洲一区二区| 亚洲第一天堂av| 久久这里有精品15一区二区三区 | 99热在这里有精品免费| 欧美成年人视频| 久久婷婷丁香| 亚洲国产精品一区二区www在线| 久久综合一区二区三区| 欧美一区精品| 国户精品久久久久久久久久久不卡| 欧美亚洲在线观看| 亚洲欧美一区在线| 国产欧美在线看| 久久久午夜视频| 久久综合狠狠综合久久综合88| 在线成人激情黄色| 欧美黄色日本| 欧美精品观看| 亚洲视频福利| 亚洲欧美视频在线观看视频|