新聞| | PChome| 登入
2012-09-02 12:17:05| 人氣2,210| 回應22 | 上一篇 | 下一篇

[UVA] 1237 - Expert Enough?

推薦 0 收藏 0 轉貼0 訂閱站台

Auto-mobile Charting & Manufacturing (ACM) is a company that specializes in manufacturing automobile spare parts. Being one of the leading automotive companies in the world, ACM are sure to keep up the latest information in that world. In the 100-year anniversary of the company, ACM compiled a huge list of range of prices of any automobiles ever recorded in the history. ACM then wants to develop a program that they called Automobile Expert System or AES for short.

The program receives a price P as an input, and searches through the database for a car maker in which P falls in their range of lowest price L and highest price H of car they ever made. The program then output the car maker name. If the database contains no or more than one car maker that satisfies the query, the program produce output ``UNDETERMINED" (without quotes). Not so expert, huh? You are about to develop that program for ACM.

Input 

The input begins with a line containing an integer T (T$ le$10) , the number of test cases follow. Each case begins with the size of the database D (D < 10000) . The next each of D lines contains M , L and H (0 < L < H < 1000000) which are the name of the maker (contains no whitespace and will never exceeds 20 characters), the car's lowest price the maker ever made, and the car's highest price the maker ever made respectively. Then there is the number of query Q (Q < 1000) . follows. Each of the next Q lines contains an integer P (0 < P < 1000000) , the query price.

Output 

Output for each query should be one line containing the name of the maker, or the string ``UNDETERMINED" (without quotes) if there is no maker or more than one maker that satisfies the query. You should separate output for different case by one empty line.

Sample Input 

1 
4 
HONDA 10000 45000 
PEUGEOT 12000 44000 
BMW 30000 75900 
CHEVROLET 7000 37000 
4 
60000 
7500 
5000 
10000

Sample Output 

BMW 
CHEVROLET 
UNDETERMINED 
UNDETERMINED


#include <stdio.h>

int main() {
int t;
scanf("%d", &t);
while(t--) {
int n, m, p;
int l[10000], h[10000];
int i;
char name[10000][25];
scanf("%d", &n);
for(i = 0; i < n; i++)
scanf("%s %d %d", name[i], &l[i], &h[i]);
scanf("%d", &m);
while(m--) {
scanf("%d", &p);
int cnt = 0, mi;
for(i = 0; i < n; i++) {
if(l[i] <= p && p <= h[i])
cnt++, mi = i;
if(cnt > 1) break;
}
if(cnt == 1)
puts(name[mi]);
else
puts("UNDETERMINED");
}
if(t)
puts("");
}
return 0;
}
 

台長: Morris
人氣(2,210) | 回應(22)| 推薦 (0)| 收藏 (0)| 轉寄
全站分類: 不分類 | 個人分類: UVA |
此分類下一篇:[UVA] 927 - Integer Sequences from Addition of Terms
此分類上一篇:[UVA] 10365 - Blocks

(悄悄話)
2025-10-06 19:38:21
seo
Fantastic Put up, I'm sure a giant believer through post feed-back concerning webpages towards allow the blog page consultants recognise that they’ve further a specific thing positive towards the web! IPTV GERMAN http://beste-iptv.de/
2025-10-07 22:32:33
dfdfs
I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work... Cooking Oil Fires http://www.lifesafetechnologies.com/
2025-10-23 20:01:01
sdfsfd
Awesome and interesting article. Great things you've always shared with us. Thanks. Just continue composing this kind of post.ictoto http://www.ictoto.com
2025-10-25 17:10:19
seo
In fact My partner and i examine that last night yet I needed several feelings regarding it and after this I desired to learn that once more due to the fact it is extremely well written. Comment créer un appel d'offres pour un site web http://www.ganeo.ca/masterclass-ganeo/reussir-votre-appel-d-offres-site-web
2025-10-27 19:08:17
sdgfdsf
Whenever I have some free time, I visit blogs to get some useful info. Today, I found your blog with the help of Google. Believe me; I found it one of the most informative blog. https://sarynprime.com/fr/code-promo-1xbet-le-code-promotionnel-bonus/ http://sarynprime.com/fr/code-promo-1xbet-le-code-promotionnel-bonus/
2025-10-27 20:11:59
seo
I just got here onto your blog page whereas keeping solely to some degree submits. Decent strategy for following that, I will be bookmarking without delay grab a accomplish soars. best places for investment properties http://www.best-places-for-investment-properties.com/
2025-10-27 21:18:05
JimmySEO
This is exactly for that reason fabulous and additionally extremely creative. I simply absolutely love all the different shades and additionally anyone can get the software on the deliver would be happy. gamdom giriş http://gamdomgirisadresi.com
2025-10-29 17:53:13
JimmySEO
I did experience checking articles or reviews shared here. They are simply exceptional there are a large amount of advantageous knowledge. خرید دستگاه تصفیه آب خانگی http://digipakab.com/product-category/دستگاه-تصفیه-آب-خانگی/
2025-10-29 17:55:03
sdafdsfsdd
Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks pool automatic cover http://poolcover.co.za/
2025-10-30 17:12:44
JimmySEO
Superb blog post. Any place strikes numerous pressing obstacles of your modern culture. People can not be uninvolved that will those obstacles. The place delivers guidelines together with thoughts. Rather interesting together with handy. pool covers automatic http://cleverpoolcovers.co.za/
2025-10-30 18:42:41
JimmySEO
Superb blog post. Any place strikes numerous pressing obstacles of your modern culture. People can not be uninvolved that will those obstacles. The place delivers guidelines together with thoughts. Rather interesting together with handy. pool covers automatic http://cleverpoolcovers.co.za/
2025-10-30 18:43:07
seo
Thanks a lot pertaining to putting up a real wonderful content! I ran across your web site ideal for our requires. Its content has amazing along with valuable blogposts. Carry on the excellent operate! bridal underwear http://www.amazon.com/dp/B0B4WSLZL5
2025-11-01 19:23:05
seo
That is the amazing piece of writing, Thanks a lot for the purpose of rendering everybody this. Have post. iptv abonnement http://iptv-holland.com/
2025-11-04 18:59:51
dfdfd
Thanks for sharing the post.. parents are worlds best person in each lives of individual..they need or must succeed to sustain needs of the family. https://xtremehd-iptv.co.uk/ http://xtremehd-iptv.co.uk/
2025-11-11 20:59:57
seo
That is the amazing piece of writing, Thanks a lot for the purpose of rendering everybody this. Have post. nagad-88.bet/ http://nagad-88.bet/
2025-11-13 19:29:43
seo
This approach is an excellent content Document personally seen merit to present the software. Propose being very careful the things I needed to work out intend for long term future you should maintain just for stating a very remarkable content. homeowners talking about puroair helping morning allergies http://su77.blogolize.com/review-of-puroair-filtration-and-allergen-removal-system-76840596
2025-11-13 21:19:13
seo
I'd personally declare that will this is the a terrific article of an wonderful man or woman, i am just very happy to discover this specific. phenq weight loss supplement http://duromineaustralia.com/phenq-review/
2025-11-15 19:17:25
seo
Regards for the purpose of post this amazing piece of writing! I recently came across yuor web blog perfect for your preferences. It includes marvelous not to mention advantageous items. Cultivate monetary management give good results! 犀利士哪裡買 https://cialisbuy.com.tw
2025-11-30 00:15:38
seo
Invalid Code : Check the code’s validity by visiting the 1xbet promo code page and reviewing the code details. how to use promo code on 1xbet http://www.nota79.cat/articles/kak_pomochy_rebenku_bystro_vyzdorovety__1.html
2025-11-30 20:40:24
seo
Customized Deposit Tiers in the 1xBet Welcome Offer 1xbet deposit bonus code http://www.lnrprecision.com/news/1xbet_promo_code_free_bet_bonus.html
2025-12-01 21:10:25
seo
Wonderful article. The actual publish impacts lots of immediate problems in our culture. All of us cannot be uninvolved in order to these types of problems. This particular publish provides plans as well as ideas. Really educational as well as useful. best user rated air filter for allergies comparing puroair http://sampa0201.shotblogs.com/review-of-home-filtration-system-by-puroair-51869144
2025-12-09 21:39:58
是 (若未登入"個人新聞台帳號"則看不到回覆唷!)
* 請輸入識別碼:
請輸入圖片中算式的結果(可能為0) 
(有*為必填)
TOP
詳全文