博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
POJ 2584 T-Shirt Gumbo
阅读量:4322 次
发布时间:2019-06-06

本文共 3030 字,大约阅读时间需要 10 分钟。

T-Shirt Gumbo
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 3689   Accepted: 1755

Description

Boudreaux and Thibodeaux are student volunteers for this year's ACM South Central Region's programming contest. One of their duties is to distribute the contest T-shirts to arriving teams. The T-shirts had to be ordered in advance using an educated guess as to how many shirts of each size should be needed. Now it falls to Boudreaux and Thibodeaux to determine if they can hand out T-shirts to all the contestants in a way that makes everyone happy.

Input

Input to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets. 
A single data set has 4 components: 
  1. Start line - A single line: 
    START X 
    where (1 <= X <= 20) is the number of contestants demanding shirts. 
  2. Tolerance line - A single line containing X space-separated pairs of letters indicating the size tolerances of each contestant. Valid size letters are S - small, M - medium, L - large, X - extra large, T - extra extra large. Each letter pair will indicate the range of sizes that will satisfy a particular contestant. The pair will begin with the smallest size the contestant will accept and end with the largest. For example: 
    MX 
    would indicate a contestant that would accept a medium, large, or extra large T-shirt. If a contestant is very picky, both letters in the pair may be the same. 
  3. Inventory line - A single line: 
    S M L X T 
    indicating the number of each size shirt in Boudreaux and Thibodeaux's inventory. These values will be between 0 and 20 inclusive. 
  4. End line - A single line: 
    END 
After the last data set, there will be a single line: 
ENDOFINPUT 

Output

For each data set, there will be exactly one line of output. This line will reflect the attitude of the contestants after the T-shirts are distributed. If all the contestants were satisfied, output: 
T-shirts rock! 
Otherwise, output: 
I'd rather not wear a shirt anyway... 

Sample Input

START 1ST0 0 1 0 0ENDSTART 2SS TT0 0 1 0 0ENDSTART 4SM ML LX XT0 1 1 1 0ENDENDOFINPUT

Sample Output

T-shirts rock!I'd rather not wear a shirt anyway...I'd rather not wear a shirt anyway... 思路:二分图多重匹配,把输入转化一下建图就好了,没什么坑 实现代码:
#include
#include
using namespace std;const int M = 25;struct node{ int s,e;}c[M];//S M L X Tint g[M][M],v[M][M],vis[M],n,m,cnt[M],b[10];string a[M];int fx(char s1){ if(s1 == 'S') return 0; else if(s1 == 'M') return 1; else if(s1 == 'L') return 2; else if(s1 == 'X') return 3; else if(s1 == 'T') return 4;}void fu(){ for(int i=0;i
>s; int ans = 0; if(s=="START"){ cin>>n; for(int i=0;i
>a[i]; int sum = 0; for(int i=0;i<5;i++){ cin>>b[i]; } cin>>s4; fu(); //cout<<21<

 

转载于:https://www.cnblogs.com/kls123/p/7778635.html

你可能感兴趣的文章
c# 字段、属性get set
查看>>
td内容超出隐藏
查看>>
Spring CommonsMultipartResolver 上传文件
查看>>
Settings app简单学习记录
查看>>
SQLAlchemy
查看>>
多线程
查看>>
使用缓存的9大误区(下)转载
查看>>
appium键值对的应用
查看>>
MyEclipse 8.X 通用算法
查看>>
selenium.Phantomjs设置浏览器请求头
查看>>
分布式数据库如何选择,几种分布式数据库优缺点一览
查看>>
BZOJ 4443: 小凸玩矩阵【二分图】
查看>>
苹果 OS X制作u盘启动盘
查看>>
Jquery便利对象
查看>>
MVC: Connection String
查看>>
idea常用设置汇总
查看>>
Node.SelectNodes
查看>>
Lambda表达式语法进一步巩固
查看>>
Vue基础安装(精华)
查看>>
Git 提交修改内容和查看被修改的内容
查看>>