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

ACM___________________________

______________白白の屋
posts - 182, comments - 102, trackbacks - 0, articles - 0
<2010年10月>
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

常用鏈接

留言簿(24)

隨筆分類(332)

隨筆檔案(182)

FRIENDS

搜索

積分與排名

最新隨筆

最新評論

閱讀排行榜

評論排行榜

HDOJ 1070 HDU 1070 Milk ACM 1070 IN HDU

Posted on 2010-09-18 11:29 MiYu 閱讀(1884) 評論(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>
            欧美日韩中文字幕精品| 免费观看不卡av| 欧美日韩亚洲国产精品| 一区二区免费在线观看| 亚洲另类视频| 国产精品久久久99| 久久精品人人做人人综合| 久久精品视频在线| 亚洲国产一区二区a毛片| 亚洲欧洲一级| 欧美天天影院| 久久久久国内| 欧美福利精品| 午夜欧美精品| 麻豆av一区二区三区| 在线亚洲精品| 欧美在线高清| 最新国产の精品合集bt伙计| 国产精品99久久久久久人| 国产日韩一区欧美| 亚洲日韩成人| 国产专区欧美专区| 亚洲人成免费| 海角社区69精品视频| 亚洲黄色在线看| 国际精品欧美精品| 一本色道久久综合亚洲精品不卡| 国产人成精品一区二区三| 亚洲成在人线av| 国产精品一国产精品k频道56| 欧美国产日本韩| 国产日产欧美一区| 亚洲三级视频| 亚洲福利视频一区| 亚洲免费小视频| 亚洲视频综合在线| 免费一级欧美在线大片| 久久精品免费| 国产精品日本| 亚洲精品国产精品国自产在线| 国产一区视频观看| 亚洲一二区在线| 亚洲精品影视在线观看| 欧美中文字幕在线播放| 欧美一区二区大片| 欧美日韩成人网| 欧美国内亚洲| 尤物九九久久国产精品的分类| 亚洲一区中文| 亚洲色图自拍| 欧美日韩国产专区| 亚洲精品女av网站| 亚洲第一精品夜夜躁人人爽 | 欧美一区1区三区3区公司| 欧美aⅴ99久久黑人专区| 久久亚洲视频| 国产一区二区三区精品欧美日韩一区二区三区 | 久久精品国产v日韩v亚洲 | 亚洲伊人伊色伊影伊综合网| 欧美大片专区| 亚洲国产精品一区二区www| 亚洲二区视频在线| 久久综合国产精品台湾中文娱乐网 | 欧美成人蜜桃| 亚洲电影天堂av| 亚洲国产日韩欧美在线99| 蜜桃av噜噜一区| 欧美电影在线播放| 91久久精品国产91久久性色| 美日韩精品免费| 最新日韩中文字幕| 亚洲一区二区三区四区五区黄| 欧美人与性禽动交情品| 亚洲美女诱惑| 香蕉久久夜色精品| 国产日韩欧美一区二区三区四区| 亚洲一区中文字幕在线观看| 久久成年人视频| 影音先锋国产精品| 免费欧美视频| 日韩视频在线永久播放| 亚洲欧美日韩另类| 国内一区二区三区在线视频| 久久久水蜜桃| 99综合视频| 久久精品在线观看| 亚洲国产一区二区精品专区| 欧美日韩免费在线| 亚洲欧美制服中文字幕| 美女日韩欧美| 制服丝袜激情欧洲亚洲| 国产香蕉97碰碰久久人人| 美女久久一区| 中文无字幕一区二区三区| 久久久久成人精品| 亚洲精品社区| 国产欧美日韩另类视频免费观看| 久久先锋资源| 99成人在线| 久热精品视频| 亚洲欧美韩国| 亚洲片在线资源| 国产视频观看一区| 欧美精品在线一区| 久久久久五月天| 亚洲一区二区久久| 欧美激情免费在线| 久久成人精品| 国产精品99久久久久久久女警| 禁断一区二区三区在线| 国产精品成人av性教育| 另类春色校园亚洲| 性欧美videos另类喷潮| 亚洲精品国产精品国产自| 欧美1区2区| 久久男女视频| 久久av一区二区三区亚洲| 亚洲一区精彩视频| 亚洲精品资源| 亚洲第一区色| 国产欧美在线看| 国产精品午夜av在线| 欧美日韩国产精品一区二区亚洲 | 一区二区成人精品| 亚洲第一福利视频| 久久综合一区二区| 久久av一区二区三区| 亚洲欧美在线另类| 亚洲欧美精品伊人久久| 亚洲美女在线观看| 国产精品成人免费视频| 欧美精品久久一区二区| 亚洲国产日韩综合一区| 欧美精品一区二区视频| 久久免费偷拍视频| 久久精品日韩欧美| 久久国产色av| 欧美影片第一页| 欧美一区二区视频网站| 欧美一区1区三区3区公司| 亚洲尤物在线| 欧美一区二区播放| 欧美一区精品| 久久久www成人免费精品| 久久久国产91| 久久综合网络一区二区| 狂野欧美一区| 欧美激情一区二区三区四区| 欧美国产一区二区| 欧美日韩国产精品自在自线| 欧美日韩视频在线第一区| 国产精品大片wwwwww| 国产精品久久毛片a| 国产毛片一区| 在线日韩中文字幕| 亚洲精品社区| 亚洲欧美电影院| 久久精品视频在线播放| 巨胸喷奶水www久久久免费动漫| 免费久久99精品国产自| 91久久精品一区二区别| 亚洲精品乱码久久久久久黑人| 99在线热播精品免费| 午夜精品亚洲| 免费成人美女女| 欧美午夜免费影院| 黑人中文字幕一区二区三区| 亚洲黄色在线看| 亚洲午夜激情| 久久久人成影片一区二区三区| 欧美电影在线观看| 一区二区三欧美| 久久久无码精品亚洲日韩按摩| 欧美精品久久一区二区| 国产亚洲成年网址在线观看| 91久久国产综合久久91精品网站| 亚洲专区在线| 蜜臀a∨国产成人精品| 亚洲日本欧美日韩高观看| 午夜一区二区三视频在线观看| 女生裸体视频一区二区三区| 国产精品videosex极品| 亚洲国产毛片完整版| 亚洲欧美日韩在线高清直播| 欧美成人中文字幕| 亚洲永久免费| 欧美精品偷拍| 亚洲第一在线综合在线| 亚洲综合视频在线| 亚洲国产人成综合网站| 久久se精品一区精品二区| 欧美日韩一级大片网址| 亚洲高清在线视频| 欧美专区在线| 亚洲乱码视频| 嫩草国产精品入口| 一区免费视频| 久久精品国产清自在天天线 | 欧美日韩成人精品| 在线日韩欧美视频|