码迷,mamicode.com
首页 > 其他好文 > 详细

CSUFT 1005 Coffin Tiles

时间:2016-11-12 23:27:14      阅读:387      评论:0      收藏:0      [点我收藏+]

标签:++   ack   ber   nbsp   rectangle   pos   different   problem   href   

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

标签:++   ack   ber   nbsp   rectangle   pos   different   problem   href   

原文地址:http://www.cnblogs.com/TreeDream/p/6057647.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!