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

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 閱讀(1895) 評論(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 次.  日了 .    

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

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

   其他的就是 算出 平均每天的 花費(fèi) 排個序就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>
            国产精品一区久久久久| 久久午夜国产精品| 鲁鲁狠狠狠7777一区二区| 亚洲一区二区三区国产| 久久久综合香蕉尹人综合网| 亚洲午夜精品在线| 欧美成人官网二区| 老巨人导航500精品| 国产精品视频精品| aa级大片欧美| 日韩视频永久免费| 免费日本视频一区| 欧美成人午夜剧场免费观看| 国产综合在线看| 欧美亚洲视频在线观看| 亚洲欧美电影在线观看| 欧美日韩美女一区二区| 亚洲黄一区二区| 亚洲肉体裸体xxxx137| 免费观看不卡av| 欧美大片在线看| 亚洲第一在线| 欧美aa国产视频| 亚洲大片在线观看| 亚洲精品欧美激情| 欧美激情在线狂野欧美精品| 亚洲国产精品久久久久秋霞不卡| 1000部国产精品成人观看| 久久久久久有精品国产| 久久综合给合久久狠狠色 | 在线日韩欧美视频| 久久九九免费| 欧美电影在线观看完整版| 亚洲第一精品夜夜躁人人爽 | 欧美日韩国产色站一区二区三区| 亚洲国产精品成人久久综合一区| 91久久精品日日躁夜夜躁国产| 另类综合日韩欧美亚洲| 亚洲激情视频网站| 中文精品99久久国产香蕉| 国产精品久久久久久久浪潮网站| 亚洲一二三区在线| 久久一区中文字幕| 亚洲人成毛片在线播放| 欧美视频在线一区二区三区| 亚洲网址在线| 免费成人黄色| 一区二区久久久久| 国产欧美日本一区二区三区| 久久精品国产999大香线蕉| 欧美国产三区| 亚洲主播在线| 狠狠综合久久| 欧美男人的天堂| 欧美一区=区| 亚洲第一在线| 欧美在线视频导航| 亚洲激情av| 国产精品网站视频| 久久伊伊香蕉| 亚洲专区一二三| 欧美激情国产精品| 欧美一区二区三区视频免费| 亚洲第一精品福利| 国产精品美女| 欧美不卡福利| 欧美一级大片在线观看| 亚洲精品1234| 久久夜色精品国产欧美乱| 亚洲视频电影图片偷拍一区| 激情一区二区| 国产精品欧美日韩一区二区| 蜜臀久久99精品久久久久久9 | 久久先锋资源| 亚洲深爱激情| 亚洲国产成人在线| 国产亚洲精品一区二区| 欧美日韩色一区| 另类春色校园亚洲| 欧美一区二区在线免费播放| 日韩亚洲视频| 亚洲福利视频二区| 久久艳片www.17c.com| 亚洲欧美综合一区| 一区二区三区国产在线观看| 伊人影院久久| 国际精品欧美精品| 国产乱人伦精品一区二区| 欧美精品一区二区三区视频| 久久综合久久久久88| 午夜精品久久久久久久99黑人| 亚洲精品国精品久久99热一| 欧美成人tv| 久久伊人精品天天| 久久久久久久欧美精品| 性高湖久久久久久久久| 亚洲午夜一区二区三区| 夜夜嗨av色一区二区不卡| 91久久精品国产91久久| 亚洲福利在线观看| 在线视频国内自拍亚洲视频| 国产日韩av高清| 国产日韩欧美视频在线| 国产精品自拍在线| 国产精品网站在线| 国产日韩欧美综合| 国产亚洲精久久久久久| 国产片一区二区| 国产一区91| 狠狠色狠色综合曰曰| 伊人狠狠色j香婷婷综合| 在线日本成人| 亚洲精品久久久久| 亚洲精品视频在线观看免费| 亚洲经典自拍| 99国产精品久久久久久久| 日韩亚洲欧美在线观看| 中文精品在线| 亚洲综合精品| 久久爱www久久做| 久久一区二区三区四区| 亚洲成色777777在线观看影院| 欧美高清不卡| 亚洲精选中文字幕| 亚洲一区二区三区乱码aⅴ蜜桃女 亚洲一区二区三区乱码aⅴ | 狠狠干综合网| 精品51国产黑色丝袜高跟鞋| 在线免费观看视频一区| 亚洲国产一区二区a毛片| 一本色道久久综合狠狠躁篇怎么玩| 在线欧美福利| 99re亚洲国产精品| 香蕉久久精品日日躁夜夜躁| 欧美伊人影院| 欧美激情国产日韩| 一道本一区二区| 欧美一区二区观看视频| 蜜桃av久久久亚洲精品| 欧美日韩中文另类| 国产午夜精品理论片a级探花 | 国产视频观看一区| 在线日韩一区二区| 亚洲视频专区在线| 久久久中精品2020中文| 亚洲精品乱码久久久久| 午夜精品福利在线观看| 欧美成人国产| 国产婷婷色一区二区三区在线| 亚洲高清影视| 亚洲欧美中文在线视频| 久久人91精品久久久久久不卡| 欧美激情视频在线播放| 国产欧美精品日韩精品| 日韩视频免费在线| 久久久久中文| 一区二区三区你懂的| 久久婷婷麻豆| 国产精品亚洲综合一区在线观看| 亚洲国产综合91精品麻豆| 欧美一级日韩一级| 亚洲人成人77777线观看| 欧美一区视频在线| 欧美色中文字幕| 亚洲国产一区二区视频| 久久精品1区| 一区二区三区精密机械公司 | 久久国产精品久久精品国产| 欧美日韩免费网站| 亚洲大片在线| 久久久久天天天天| 亚洲永久免费观看| 欧美三区在线| 99re热这里只有精品免费视频| 久久伊人亚洲| 欧美一级黄色录像| 免费观看成人| 亚洲男人天堂2024| 欧美手机在线视频| 一区二区三区高清视频在线观看| 猛男gaygay欧美视频| 欧美有码在线视频| 国产欧美1区2区3区| 亚洲一区二区日本| 一区二区三区鲁丝不卡| 欧美精品高清视频| 亚洲免费av观看| 亚洲人成人一区二区在线观看| 久久性天堂网| 在线观看日韩| 你懂的视频欧美| 久久久久一区| 亚洲国产精品成人综合| 蜜臀久久99精品久久久画质超高清| 欧美一区二区三区四区在线观看地址| 国产精品女人毛片| 性视频1819p久久| 亚洲欧美日韩国产一区二区| 国产美女精品免费电影| 欧美一区二区三区精品| 亚洲欧美日韩国产成人|