CSUFT 1005 Coffin Tiles

1005: Coffin Tiles

Time Limit: 1 Sec    Memory Limit: 128 MB
Submit: 2    Solved: 2

Description

The Pumpkin King has a great idea for this Christmas: Personalized coffins for all the good little boys and girls! To make them extra special, Jack has ordered that the coffins have various designs based upon the interests of the children (This was of course determined by what Google searches the children do most often. The Clown with the Tear-Away face has mad hacking skills).

Most little girls, and some of the boys (Bronies) happen to be really into My Little Pony: Friendship is Magic, and so a large number of Twilight Sparkle themed coffins have been ordered (Twilight is of course, the most awesome pony on the show). These coffins are decorated by affixing alternating tiles in a rectangle up the middle of the coffin lid (They're flat). Now, all the children are different sizes and shapes. Some lids will need a rectangle 3 tiles wide, some less, and some more. In order to keep from ordering too many tiles from the.. ummm... coffin tile factory (Just go with it). The Mayor wants to know how many tiles he needs to order, based upon how many dimensionally unique rectangles can be made using tiles of a certain number.

So, the mayor has asked you to write a program that will, for each given integer, "n", output the minimal number of tiles (The tiles are square) that can be arranged into exactlynunique rectangles. For example, if the number two was given, the minimal number of tiles required to make 2 unique rectangles is 4. With 4 you can make a1x4and a2x2rectangle.

Input

Input consists of a single integer indicating the number of integers to read and a sequence of positive integers separated by whitespace.

Output

For each input integernyour program should output either a single line containing the minimal number of unit squares that can be arranged into exactlynrectangles, or "Too big" if the number of needed unit squares is bigger than 1000000.

Sample Input

5
1 4 19 48 71

Sample Output

1
24
786432
27720
Too big

HINT

 

Source

 

 
题目又臭又长,我还是连蒙带猜出的结果。
打表大法真开心!!!
/*
#include <bits/stdc++.h>
 
using namespace std;
 
bool judge(int n,int m)
{
    int cnt = 0;
    int k = (int)sqrt(m*1.0);
    for(int i=1; i<=k; i++)
    {
        if(m%i==0)
            cnt++;
    }
    if(cnt==n)
        return true;
    else return false;
 
}
 
int calc(int n)
{
 
    for(int i=n*n; i<=1000000; i++)
    {
        if(judge(n,i))
            return i;
    }
    return -1;
 
}
 
int main()
{
    freopen("out.txt","w",stdout);
    for(int i=1;i<=1000;i++)
        printf("%d\n",calc(i));
 
    return 0;
}
*/
 
#include <bits/stdc++.h>
 
int a[120] = {1,
4,
12,
24,
36,
60,
192,
120,
180,
240,
576,
360,
1296,
900,
720,
840,
9216,
1260,
786432,
1680,
2880,
15360,
3600,
2520,
6480,
61440,
6300,
6720,
-1,
5040,
-1,
7560,
46080,
983040,
25920,
10080,
-1,
32400,
184320,
15120,
44100,
20160,
-1,
107520,
25200,
-1,
-1,
27720,
233280,
45360,
-1,
430080,
129600,
50400,
414720,
60480,
-1,
-1,
921600,
55440,
-1,
-1,
100800,
83160,
-1,
322560,
-1,
176400,
-1,
181440,
-1,
110880,
-1,
-1,
226800,
-1,
-1,
-1,
-1,
166320,
352800,
-1,
-1,
221760,
-1,
-1,
-1,
967680,
-1,
277200,
-1,
-1,
-1,
-1,
705600,
332640,
-1,
-1,
-1,
498960,
-1,
-1,
-1,
-1,
907200,
-1,
-1,
554400,
-1,
-1,
-1,
665280,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
720720};
 
int main()
{
    int t;
    scanf("%d",&t);
    while(t--) {
        int n;
        scanf("%d",&n);
        if(n>120)
            puts("Too big");
        else {
            if(a[n-1]==-1)
                puts("Too big");
            else {
                printf("%d\n",a[n-1]);
            }
        }
 
 
    }
    return 0;
}
 
 
 
 
 
/**************************************************************
    Problem: 1005
    User: YinJianZuiShuai
    Language: C++
    Result: Accepted
    Time:0 ms
    Memory:1700 kb
****************************************************************/

 

 

转载于:https://www.cnblogs.com/TreeDream/p/6057647.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值