Patterns and Pictures

Description

  Fabrics often have repeating patterns on them, such as a tessellation of carrots and bats.
  A given image, such as a carrot in the above example, takes up a certain number of square inches on the fabric. In addition, a piece of fabric with more than one image will have those images in some sort of simple integral ratio, such as 3 carrots for every 2 bats. One instance of images in the given ratio is considered a full set.
  Fabrics are sold by the square yard (and, for those of you who have forgotten, there are 36 inches to the yard). Given a collection of images, their sizes, and the ratios in which they occur, what is the maximum number of full sets that could possibly appear on one, two, and three square yards of patterned fabric?
  (Note that this maximum implies totally arbitrary shapes and placements for the images, which may be different for the three lengths of fabric; the particulars of the layout are irrelevant for the purposes of the problem.)

Input

  Input to this problem will begin with a line containing a single integer N (1 ≤ N ≤ 100) indicating the number of data sets. Each data set consists of the following components:
  A line containing a single integer I (1 ≤ I ≤ 10) indicating the number of images in a particular pattern.
  A series of I lines, each with two integers S, R (1 ≤ S ≤ 1000; 1 ≤ R ≤ 100) separated by spaces representing the images. S is the number of square inches that the image occupies; R is the count of the images contained in a full set.

Output

  For each data set, print “A B C”, where A is the maximum number of full sets that could possibly appear on one square yard of fabric, B is the maximum number of full sets that could possibly appear on two square yards of fabric, and C is the maximum number of full sets that could possibly appear on three square yards of fabric.

Sample Input

1
2
15 3
17 2

Sample Output

16 32 49

HINT
Source

2008 ACM ICPC South Central USA Regional Programming Contest
题意:问题写的超级复杂,感觉有病,这是在考我语文和英语嘛
问题是:1平方的庭院有36*36平方英寸,全部的Si×Ri的和构成一个整体,问一平方的庭院能包含多少个这样的整体,二平方呢,三平方呢?

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<queue>
#include<map>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
map<string,int>mp;
const int Max=3e3+10;
int pre[Max],n,m;
int main()
{
    int N,a,b;
    scanf("%d",&N);
    int all=36*36;
    while(N--)
    {
        int sum=0;
        scanf("%d",&n);
        for(int i=0;i<n;i++)
        {
            scanf("%d%d",&a,&b);
            sum+=a*b;
        }
        printf("%d %d %d\n",all/sum,all*2/sum,all*3/sum);
    }
    return 0;
}```

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值