CSUFT 1005 Coffin Tiles

Posted 树的种子

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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
****************************************************************/

 

 

以上是关于CSUFT 1005 Coffin Tiles的主要内容,如果未能解决你的问题,请参考以下文章

CSUFT 1003 All Your Base

CSUFT 1004 This is Halloween: Saving Money

CSUFT 编译原理实验二LL文法分析

tiles配置及标签使用

Tiles & SiteMesh

tiles页面body报错