zoukankan      html  css  js  c++  java
  • 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
    ",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
    ",a[n-1]);
                }
            }
     
     
        }
        return 0;
    }
     
     
     
     
     
    /**************************************************************
        Problem: 1005
        User: YinJianZuiShuai
        Language: C++
        Result: Accepted
        Time:0 ms
        Memory:1700 kb
    ****************************************************************/
  • 相关阅读:
    Luogu3952 NOIP2017D1T2 时间复杂度
    Luogu4933 大师
    Luogu1966 火柴排队
    Luogu2881 排名的牛Ranking the Cows
    Luogu1439 最长公共子序列(LCS)
    Liferay7 BPM门户开发之20: 理解Asset Framework
    提高Liferay7的启动和运行速度
    liferay中jsonws的认证方法
    让Liferay的Service Builder连接其他数据库
    Liferay表结构介绍(四):Portlet相关表
  • 原文地址:https://www.cnblogs.com/TreeDream/p/6057647.html
Copyright © 2011-2022 走看看