MENU

第十四届"红旗杯"题解

October 11, 2020 • Read: 113 • 题解

第十四届"红旗杯"题解

题目链接:http://acm.hdu.edu.cn/

1.P1003 Function

image-20201011194339297

题解:

本题如果按照模拟来写程序,就是使用递归,但是按照这个时间复杂度来看,递归是绝对会超时的,所以我们可以先把每一个f(x)的值计算出来,然后我们会发现,在某一步以后,计算出的f(x)的值就都是相同的了,因此,我们可以将它化为迭代来减少计算次数

ACCode:

#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;

long long ten(int x)
{
    // 计算10的x次方
    int ans = 1;
    while (x--)
    {
        ans *= 10;
    }
    return ans;
}

long long func(long long x)
{
    // f(x)函数的实现
    if (x == 0) return 0;
    // x 为零时需要特判
    int len = log10(x) + 1;
    // 计算x的位数
    long long ans = 1;
    for (int i = 1; i <= len; i++)
    {
        ans *= (x % ten(i));
        ans %= (x + 1);
    }
    return ans;
}

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        long long ans = 0, used = 0, n, m;
        // used 变量用于求取有多少相同的fx
        cin >> n >> m;
        long long shadow = func(n);
        for (int i = 0; i < m; i++)
        {
            if (shadow != func(shadow))
            {
                // 当两次计算结果不同时,更新影子变量,答案增加
                ans += shadow;
                shadow = func(shadow);
                used ++;
            }
            else
            {
                used = i;
                break;
            }
        }
        ans += (m - used) * (shadow);
        // 一步计算相同的fx部分
        printf("%lld\n", ans);
    }

    return 0;
}

2.Color the blocks

image-20201011195804057

题解:

本题先尝试画出t==6时的情况,发现存在规律,然后画出t==5和t==4时的情况,发现:当t>=4时,答案都是4,同理,当t==3时,答案为32, 当t==2时,答案为16,当t==1时,答案为1

ACCode:

#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;

int main()
{
    int n;
    cin >> n;
    while (n--)
    {
        int l;
        scanf("%d", &l);
        if (l == 1)
        {
            printf("2\n");
        }
        else if (l == 2)
        {
            printf("16\n");
        }
        else if (l == 3)
        {
            printf("32\n");
        }
        else
        {
            printf("4\n");
        }
    }
    return 0;
}

3.Fall Guys

image-20201011200204042

image-20201011200258403

题解:

这题目翻译有问题,可以大致理解为几个糖豆人同时起跑,然后在到达终点并抓取到皇冠以后,再增加延迟量,然后比较耗时,耗时低者夺冠

要解决这个题,就要想办法计算出抓取到皇冠的耗时

ACCode:

#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
struct node
{
    int index, time;
} arrive[N];

int cost(int x, int h, int H)
{
    // 计算抓取皇冠耗时
    int c = x;
    c %= (H * 2);
    if ((c>=0 && c <= h)||(c <= 2 * H && c >= (2 * H - h)))
    {
        return x;
    }
    else
    {
        x -= c;
        x += (2 * H - h);
        return x;
    }
    return x;
}

bool cmp(node s1, node s2)
{
    if (s1.time != s2.time)
    {
        return s1.time < s2.time;
    }
    else
    {
        return s1.index < s2.index;
    }
}

int main()
{
    int n, h, H, t;
    cin >> t;
    while (t--)
    {
        scanf("%d%d%d", &n, &h, &H);
        memset(arrive, 0, sizeof(arrive));
        for (int i = 0; i < n; i++)
        {
            scanf("%d", &arrive[i].time);
            arrive[i].index = i;
            arrive[i].time = cost(arrive[i].time, h, H);
        }
        for (int i = 0; i < n; i++)
        {
            int x;
            scanf("%d", &x);
            arrive[i].time += x;
        }
        sort(arrive, arrive + n, cmp);
        printf("%d\n", arrive[0].index + 1);
    }

    return 0;
}

4.Hali Galli

image-20201011200826503

image-20201011200847039

image-20201011200857878

题解:

题目不是我写的

ACcode:

#include<bits/stdc++.h>
using namespace std;
struct node
{
    char color;
    int num;
}p[1025];
map<char,int>u;
int main()
{
    int t,n,k,num;
    char s;
    cin>>t;
    while(t--)
    {
        long long sum=0;
        memset(p,0,sizeof(p));
        u['A']=0;
        u['B']=0;
        u['G']=0;
        u['P']=0;
        cin>>n>>k;
        for(int i=0;i<n;i++)
        {
            cin>>s>>num;
            if(i<k)
            {
                p[i].color=s;
                p[i].num=num;
                u[s]+=num;
                //cout<<"pa"<<u[s]<<endl;
                if(u['A']==5)
                    sum++;
                if(u['B']==5)
                    sum++;
                if(u['G']==5)
                    sum++;
                if(u['P']==5)
                    sum++;
            }
            else
            {

                int c=i%k;
                //cout<<"pa"<<c<<endl;
                u[p[c].color]-=p[c].num;
                p[c].color=s;
                u[s]+=num;
                p[c].num=num;
                if(u['A']==5)
                    sum++;
                if(u['B']==5)
                    sum++;
                if(u['G']==5)
                    sum++;
                if(u['P']==5)
                    sum++;

            }
        }
        cout<<sum<<endl;
    }
    return 0;
}

5.Yiding Number

image-20201011201018390

题解:

遇事不决,打表就行,这里直接用python打了一个表,然后交了就行

ACCode:

#include <bits/stdc++.h>
using namespace std;
long long lst[5466] = {1, 573442, 114691, 8, 16392, 524298, 385033, 172043, 319502, 73744, 18, 65554, 524308, 147477, 303122, 786456, 32794, 27, 65564, 73754, 81947, 573468, 16418, 90147, 32804, 172067, 835622, 786466, 319528, 860202, 122923, 303148, 434221, 147503, 966707, 53, 81973, 434231, 393271, 122933, 65597, 90173, 172093, 835648, 393281, 614466, 368707, 622656, 221252, 860228, 622666, 335947, 458827, 77, 32846, 327757, 966733, 614476, 581706, 581716, 557142, 65623, 32856, 753752, 737372, 368733, 819294, 221278, 516192, 221281, 99, 213091, 335973, 843877, 103, 327783, 966757, 458853, 221291, 180331, 109, 213101, 843887, 819304, 557168, 753778, 778354, 163957, 368757, 180341, 155767, 737398, 122, 409722, 516218, 335997, 327807, 966783, 114817, 385159, 557192, 426122, 163983, 368783, 385169, 155793, 516242, 148, 409748, 303252, 336023, 327833, 573594, 114843, 82077, 16544, 786592, 450722, 557218, 426148, 90277, 573604, 164007, 835752, 155817, 16554, 868522, 516268, 975021, 303278, 114867, 434357, 82103, 975031, 786618, 172219, 450748, 377021, 860348, 65727, 393407, 164033, 90303, 49347, 458947, 172229, 155843, 377031, 835778, 622792, 614602, 958667, 868548, 114893, 434383, 565456, 581842, 786642, 958677, 32982, 65753, 393433, 565466, 49373, 458973, 737502, 622818, 614628, 229, 852197, 434407, 221417, 213227, 581868, 786668, 239, 33008, 172271, 852207, 393457, 180467, 164081, 24822, 737528, 172281, 622842, 164091, 252, 966909, 409852, 614652, 434433, 221443, 581892, 213253, 966919, 33032, 393483, 426252, 368909, 180493, 778344, 24848, 622868, 16661, 278, 336149, 327959, 368919, 409878, 221467, 614678, 90397, 213277, 16671, 336159, 327969, 33058, 581918, 327972, 180517, 450852, 426278, 557344, 860452, 516394, 557354, 868652, 803122, 516404, 221493, 975157, 90423, 213303, 811322, 327998, 164159, 180543, 155969, 450878, 860478, 49477, 377157, 459077, 868678, 164169, 115019, 155979, 426317, 958797, 803148, 975183, 811348, 115029, 172372, 426327, 958807, 565592, 346, 49503, 377183, 459103, 356, 852327, 90472, 975207, 786794, 24942, 172398, 852337, 565618, 372, 786804, 172407, 24952, 377207, 164217, 8572, 434559, 975233, 90498, 901506, 434569, 393609, 565642, 901516, 398, 172433, 24978, 393619, 377233, 164243, 8598, 16791, 614804, 622994, 623004, 582044, 614814, 90527, 33184, 16801, 565668, 868772, 328102, 582054, 172457, 33194, 164267, 311722, 221619, 803252, 213429, 90553, 811452, 221629, 180669, 213439, 328128, 868798, 172483, 311748, 164293, 647622, 180679, 803278, 426447, 811478, 172502, 426457, 156122, 647648, 482, 90602, 74222, 25072, 172528, 156148, 502, 33272, 25082, 508, 8702, 975359, 90628, 74248, 975369, 25098, 901642, 377359, 528, 33298, 532, 8728, 377369, 147997, 565794, 901668, 868902, 311852, 565804, 558, 66097, 811572, 148023, 819772, 901692, 868928, 172609, 164419, 311878, 778822, 647752, 172619, 66123, 336461, 164429, 811598, 597, 819798, 336471, 901718, 156252, 778848, 647778, 197222, 623, 74352, 25202, 8822, 156278, 574072, 33402, 17022, 197248, 909956, 74378, 82571, 25228, 909966, 8848, 574098, 33428, 82581, 17048, 172697, 148127, 684, 66227, 172723, 694, 8887, 811702, 148153, 819902, 8897, 66247, 778952, 66253, 811728, 901844, 336597, 727, 819928, 901854, 66273, 778978, 74472, 197352, 336623, 753, 33522, 8952, 574202, 557822, 17152, 74498, 197378, 410372, 336647, 516872, 312073, 33548, 910092, 8978, 312083, 82707, 852756, 574228, 860946, 557848, 17178, 172827, 434972, 860956, 852766, 156447, 410398, 336673, 516898, 910118, 115497, 451372, 82733, 459571, 172853, 820022, 434998, 9017, 156473, 721722, 459581, 910142, 779072, 9027, 115523, 82757, 115526, 451398, 787272, 66377, 49997, 115536, 820048, 721748, 910168, 779098, 82783, 787298, 66403, 50023, 74602, 623472, 574322, 33652, 17272, 582522, 557952, 74628, 410502, 623498, 312203, 517002, 91021, 33678, 574348, 222097, 17298, 172947, 582548, 312213, 91031, 557978, 181147, 852892, 861082, 435102, 336799, 410528, 156577, 517028, 336809, 222123, 115627, 172973, 328622, 451502, 861108, 181173, 852918, 820152, 17337, 435128, 459707, 156603, 721852, 705472, 246722, 17347, 779202, 115653, 115656, 328648, 451528, 787402, 861132, 852942, 50127, 115666, 820178, 459733, 721878, 910294, 705498, 246748, 82909, 238558, 779228, 910304, 996, 787428, 861158, 82919, 238568, 50153, 852968, 459757, 1006, 426993, 91122, 623602, 574452, 558072, 17402, 427003, 582652, 566272, 517122, 9222, 459783, 91148, 623628, 574478, 558098, 222227, 17428, 91157, 173077, 861206, 582678, 156697, 566298, 869396, 517148, 181277, 869406, 9248, 164897, 861216, 115747, 58404, 820256, 820266, 222253, 58414, 91183, 173103, 328752, 156723, 312372, 181303, 17467, 164923, 115773, 418881, 705602, 787522, 246852, 17477, 91207, 230472, 328778, 418891, 312398, 451667, 992347, 705628, 451677, 246878, 787548, 25696, 238688, 91233, 230498, 861284, 853094, 25706, 238698, 1132, 623722, 861294, 853104, 427123, 91252, 582772, 992373, 74872, 558202, 427133, 566402, 623748, 459909, 1158, 517252, 9352, 222347, 91278, 459919, 582798, 74898, 558228, 181397, 156827, 566428, 869532, 1182, 861342, 517278, 9378, 165027, 812196, 222373, 58534, 115877, 820392, 812206, 181423, 58544, 902322, 156853, 312502, 869558, 1208, 861368, 66747, 165053, 115903, 124097, 820418, 787652, 419017, 230602, 902348, 214222, 869582, 861392, 312528, 83156, 66773, 451797, 599256, 820442, 124123, 992477, 83166, 1247, 91359, 451807, 599266, 419043, 230628, 787678, 9446, 25832, 91369, 861418, 214248, 623852, 869608, 9456, 197872, 820468, 582902, 992503, 1273, 75002, 419067, 566522, 1282, 25858, 623878, 197898, 1292, 222477, 582928, 75028, 419093, 566548, 181527, 25882, 165147, 828706, 222503, 812332, 828716, 181553, 25908, 165173, 1334, 902452, 66877, 1344, 124227, 812358, 902478, 214352, 66903, 75096, 83292, 124253, 812382, 599392, 1377, 34146, 75106, 869734, 861544, 214378, 34156, 9582, 869744, 861554, 976243, 198002, 820594, 83318, 812408, 599418, 1403, 566652, 976253, 820604, 1412, 451972, 9608, 198028, 1422, 83342, 599442, 419219, 566678, 165277, 419229, 451998, 9632, 820646, 435622, 83368, 828842, 599468, 902572, 820656, 779696, 26034, 910772, 165303, 9658, 779706, 26044, 435648, 968131, 722372, 828868, 902598, 968141, 910798, 91606, 607706, 828892, 722398, 75232, 91616, 574946, 607716, 17896, 34282, 574956, 17906, 443893, 976373, 812534, 828918, 75258, 443903, 976383, 812544, 173571, 34308, 452102, 173581, 878097, 75282, 42518, 34332, 42528, 452128, 525858, 83494, 435752, 599594, 34347, 525868, 1581, 75308, 820782, 83504, 902702, 878123, 599604, 34358, 1591, 9784, 910902, 779832, 9794, 435778, 853572, 435781, 34373, 722502, 820808, 902728, 706122, 968267, 247372, 435791, 910928, 779858, 91742, 853598, 820832, 722528, 607842, 706148, 968293, 34406, 247398, 558696, 575082, 779882, 18032, 34416, 525936, 517746, 558706, 829044, 468597, 444023, 67192, 91768, 820858, 525946, 607868, 968317, 517756, 829054, 444033, 67202, 575108, 779908, 157321, 18058, 173707, 468623, 9872, 91792, 124561, 116371, 157331, 607892, 878227, 968343, 42648, 861847, 124571, 575132, 116381, 18082, 42658, 525988, 173733, 9898, 75434, 91818, 34477, 525998, 607918, 911022, 18097, 788146, 878253, 34484, 1717, 75444, 575158, 861873, 18108, 173757, 34494, 788156, 853702, 34503, 911048, 18123, 706252, 435917, 247502, 1743, 231122, 173783, 624346, 853728, 624356, 583396, 706278, 1767, 435943, 247528, 992997, 231148, 34542, 583406, 558832, 624372, 468727, 820984, 526072, 67322, 222971, 517882, 452347, 435967, 993023, 1793, 820994, 780034, 67332, 222981, 182021, 34568, 558858, 780044, 624398, 182031, 157457, 10002, 526098, 517908, 968469, 468753, 452373, 435993, 124697, 116507, 861977, 968479, 34592, 558882, 91944, 141097, 526122, 157483, 10028, 608044, 517932, 911152, 91954, 18227, 124723, 116533, 608054, 1847, 575284, 862003, 18234, 34618, 558908, 788282, 853822, 575294, 141123, 18244, 157507, 862022, 526148, 517958, 198472, 911178, 124747, 18253, 116557, 821072, 1873, 231252, 173909, 788308, 853848, 214872, 157533, 83806, 42847, 173919, 862048, 624482, 198498, 124773, 116583, 83816, 993127, 567146, 821098, 583532, 788332, 231278, 239472, 419697, 214898, 567156, 624502, 42873, 624508, 452477, 1919, 993153, 223107, 583558, 788358, 1929, 239498, 165771, 419723, 182157, 624528, 624532, 165781, 436119, 452503, 223133, 583582, 436129, 182183, 141227, 624558, 18351, 223157, 34744, 1977, 18361, 583608, 559034, 182207, 853952, 34754, 526274, 518084, 141253, 559044, 886722, 862152, 198602, 526284, 124877, 518094, 223183, 821202, 2003, 182233, 853978, 157659, 215002, 886748, 42977, 862178, 124899, 198628, 116709, 83942, 124903, 157669, 821228, 124909, 116719, 239602, 419827, 567282, 215028, 616442, 43003, 83968, 616452, 788484, 600072, 239628, 419853, 452622, 567308, 788494, 165907, 83992, 215067, 903196, 600098, 567332, 215077, 903206, 452648, 624684, 165933, 18481, 84018, 624694, 583734, 18491, 567358, 862272, 583744, 886852, 165957, 821322, 223309, 829522, 223319, 182359, 862298, 886878, 165983, 92256, 182369, 821348, 92266, 419947, 829548, 616572, 419973, 616582, 600202, 452752, 878747, 215197, 600228, 903332, 215207, 452778, 796847, 84144, 34997, 878773, 84154, 567484, 903358, 862402, 567494, 796873, 821452, 35023, 829652, 903382, 862428, 166109, 575713, 821478, 166119, 92392, 575723, 420077, 829678, 903408, 968947, 526586, 469243, 469247, 92418, 600322, 526596, 469253, 420103, 608522, 968973, 387347, 469273, 92442, 125211, 600348, 878877, 911646, 862497, 608548, 125221, 911656, 387373, 796977, 92468, 780597, 35127, 878903, 18747, 862523, 461131, 829772, 797003, 780623, 35153, 837972, 18773, 461141, 2397, 575843, 829798, 575853, 837998, 903534, 436597, 969077, 2423, 903544, 469373, 469377, 526722, 600452, 452997, 469383, 969097, 608652, 436623, 969103, 387477, 35222, 371097, 469403, 526748, 600478, 453023, 125347, 862627, 969123, 608678, 911782, 854446, 387503, 35248, 92594, 141747, 371123, 526772, 502198, 780727, 854456, 92604, 125373, 18877, 862653, 502208, 2497, 911808, 59847, 166347, 141773, 526798, 829902, 780753, 199122, 461267, 125397, 838102, 18903, 100823, 911832, 2523, 2527, 117216, 100833, 59873, 584163, 641506, 166373, 829928, 43497, 117226, 223722, 641516, 969197, 584173, 125423, 461293, 313841, 838128, 199148, 911858, 436727, 2553, 240122, 313851, 756222, 43523, 608772, 338437, 461317, 969223, 223748, 453127, 969227, 338447, 436753, 240148, 35352, 756248, 371227, 608798, 461343, 453153, 125477, 969253, 35378, 141877, 371253, 854582, 502328, 125503, 502338, 2627, 59977, 526924, 166477, 887372, 141903, 854608, 199252, 526934, 2647, 100953, 2653, 805472, 117346, 100963, 60003, 584293, 346722, 166503, 854632, 887398, 641642, 43627, 117356, 125549, 199278, 436847, 969327, 2673, 584303, 223852, 911984, 125559, 240248, 313977, 911994, 805498, 240252, 346748, 756352, 240258, 854658, 641668, 43653, 608902, 338567, 739972, 436873, 969353, 223878, 35472, 338577, 314003, 240278, 756378, 641692, 461469, 739998, 608928, 461479, 35498, 314027, 862896, 428722, 641718, 862906, 821946, 60094, 821956, 314053, 60104, 428748, 887502, 2777, 428761, 420571, 805602, 428771, 649956, 420581, 346852, 330472, 887528, 649966, 436977, 2803, 240378, 805628, 346878, 854784, 330498, 240388, 191238, 740102, 854794, 437003, 191248, 35602, 84768, 740128, 404256, 84778, 404266, 35628, 641844, 428852, 863032, 797497, 641854, 60224, 822082, 314179, 60234, 314189, 428878, 863058, 797523, 822108, 428897, 420707, 863082, 330602, 650092, 76656, 600946, 822132, 76666, 428923, 600956, 420733, 174972, 863108, 330628, 650118, 191368, 822158, 191378, 428947, 420757, 174998, 2972, 387997, 650142, 781217, 84898, 2982, 404392, 781227, 84908, 428973, 420783, 2998, 388023, 650168, 797627, 830396, 781247, 404418, 830406, 797653, 781273, 404442, 838622, 986097, 404468, 76792, 838648, 601082, 175102, 863234, 158722, 199688, 986123, 863244, 822284, 76818, 199698, 601108, 969747, 822294, 175128, 158748, 3102, 388127, 412706, 371747, 781347, 3112, 76842, 429099, 601132, 125997, 781357, 420909, 412716, 860322, 969773, 429109, 650294, 420919, 3128, 388153, 371773, 650304, 44097, 781377, 76868, 150597, 601158, 126023, 830532, 60497, 240722, 166997, 978011, 44123, 969821, 830558, 150623, 838752, 781403, 978021, 969831, 85097, 60523, 240748, 167023, 404594, 986227, 609396, 224372, 830582, 322681, 838778, 314491, 461947, 404604, 609406, 322691, 85123, 314501, 158852, 756872, 199818, 986253, 224398, 830608, 199828, 461973, 969877, 158878, 756898, 634018, 371877, 412842, 634028, 126127, 969903, 371903, 76994, 232643, 44227, 601284, 412868, 3271, 150727, 126153, 77004, 232653, 601294, 3281, 60627, 240852, 167127, 412892, 445661, 44253, 437471, 150753, 978147, 969957, 445671, 437481, 806122, 85227, 347372, 60653, 240878, 863472, 167153, 625906, 412918, 224502, 609532, 978173, 44286, 969983, 36096, 322817, 462077, 314627, 625916, 85253, 347398, 806148, 44296, 36106, 757002, 863498, 740622, 830734, 224528, 642322, 224531, 978197, 609558, 970007, 462103, 830744, 322843, 314653, 224541, 757028, 634148, 740648, 642348, 609582, 978223, 634158, 970033, 322867, 314677, 290103, 429372, 290113, 232773, 609608, 322893, 3407, 314703, 232783, 429398, 429411, 445797, 437607, 3433, 806252, 429421, 347502, 331122, 863602, 413044, 462197, 626042, 413054, 445823, 3457, 437633, 44422, 806278, 36232, 347528, 331148, 863628, 462223, 740752, 642452, 626068, 445847, 437657, 3483, 224667, 44448, 36258, 740778, 626092, 978349, 642478, 970159, 445873, 437683, 224693, 978359, 44472, 970169, 36282, 290233, 429502, 290243, 609734, 626118, 323019, 314829, 224717, 609744, 44498, 36308, 323029, 331222, 314839, 429528, 224743, 429547, 331248, 331252, 388597, 462327, 429573, 175622, 216588, 642572, 331278, 388623, 462353, 650772, 216598, 3609, 93722, 429597, 405023, 175648, 3619, 3622, 642598, 405033, 650798, 445999, 437809, 93748, 429623, 446009, 298553, 437819, 609851, 28222, 3648, 298563, 626244, 609861, 626254, 44624, 405072, 36434, 28248, 331352, 44634, 36444, 314972, 224869, 405098, 970347, 224879, 331378, 314998, 388727, 372347, 986747, 814722, 970373, 175752, 159372, 216718, 642702, 388753, 372373, 650902, 986773, 216728, 814748, 93852, 77472, 405153, 175778, 159398, 3752, 642728, 405163, 167597, 650928, 429749, 93878, 839353, 77498, 298683, 609981, 429759, 28352, 3778, 839363, 11972, 298693, 167623, 609991, 44747, 151247, 405202, 28378, 241372, 11998, 315102, 69347, 978661, 44773, 151273, 405228, 970477, 978671, 85747, 241398, 315128, 372477, 69373, 986877, 814852, 970503, 85773, 651022, 159502, 85782, 372503, 986903, 552729, 814878, 85792, 77602, 552739, 651048, 159528, 167727, 839483, 77628, 839493, 12102, 167753, 405322, 44877, 151377, 413522, 880472, 241502, 12128, 405348, 69477, 446311, 44903, 151403, 413548, 978797, 446321, 880498, 85877, 241528, 864122, 69503, 978823, 44936, 782222, 85903, 651152, 44946, 864148, 85912, 77722, 552859, 978847, 954273, 85922, 552869, 782248, 323497, 651178, 954283, 77748, 978873, 847803, 577472, 323523, 847813, 577481, 405452, 577491, 413652, 577498, 880602, 176097, 471011, 462821, 405478, 724972, 471021, 413678, 446447, 462831, 880628, 176123, 864252, 724998, 446473, 45072, 782352, 864278, 94232, 77852, 446497, 94242, 421923, 954403, 626722, 45098, 323627, 446506, 421933, 954413, 782378, 446516, 77878, 978999, 446523, 626748, 847933, 979009, 45122, 225347, 20548, 323653, 577602, 847943, 561222, 413772, 20558, 503888, 577617, 315472, 503898, 45148, 225373, 577628, 225376, 331872, 561248, 176227, 413798, 159847, 225386, 577643, 471147, 462957, 725102, 315498, 708722, 249972, 331898, 643196, 176253, 389247, 159873, 577667, 471173, 643206, 462983, 725128, 708748, 249998, 389273, 94362, 577693, 471197, 463007, 503966, 323747, 94372, 422053, 626852, 503976, 422063, 446642, 528562, 471223, 12472, 446649, 463033, 528572, 323773, 626878, 102591, 94398, 446659, 225477, 20678, 28872, 102601, 561352, 585931, 446668, 413902, 20688, 12498, 504018, 127187, 585941, 315602, 299222, 45274, 504028, 127197, 225503, 225506, 28898, 45284, 332002, 315622, 446692, 413928, 159977, 831722, 561378, 225516, 315628, 299248, 708852, 970997, 250102, 233722, 332028, 446718, 315648, 389377, 160003, 831748, 372997, 643332, 815372, 995597, 708878, 971023, 250128, 233748, 389403, 577819, 626972, 643358, 373023, 323877, 577829, 815398, 94502, 504102, 78122, 995623, 454956, 528692, 471349, 643382, 168247, 463159, 454966, 12602, 626998, 225597, 168254, 323903, 471359, 463169, 94528, 528702, 78148, 504128, 102727, 168264, 29002, 86347, 12622, 643408, 168273, 586067, 12628, 127317, 225623, 504152, 299352, 127327, 102753, 29028, 86373, 12648, 315752, 831852, 586093, 69997, 504178, 299378, 971127, 102777, 233852, 446844, 651646, 217472, 315778, 586117, 831878, 373127, 70023, 651656, 446854, 4493, 815502, 995727, 971153, 102803, 233878, 4503, 217498, 627102, 586143, 373153, 815528, 995753, 78252, 455092, 627128, 168377, 405946, 225727, 168384, 405956, 78278, 168394, 86477, 643534, 455118, 12752, 864722, 168403, 643544, 225753, 881122, 455142, 86503, 12778, 864748, 193006, 70127, 504304, 799222, 193016, 504314, 905722, 881148, 455168, 217602, 651782, 86536, 70153, 78346, 4623, 799248, 102929, 86546, 78356, 905748, 782872, 4633, 102939, 217628, 586269, 651808, 586279, 782898, 651832, 782907, 406082, 782917, 578122, 651858, 578131, 864852, 406108, 578141, 578148, 881252, 176747, 471661, 864878, 406132, 193142, 471671, 725622, 799352, 905852, 455294, 881278, 176773, 455304, 406158, 12943, 86672, 193168, 78482, 324241, 725648, 799378, 905878, 12953, 783002, 324251, 193192, 86698, 78508, 627372, 783028, 414396, 783037, 86722, 193218, 78532, 627398, 783047, 414406, 578252, 651984, 561872, 651994, 578267, 86748, 155641, 78558, 4831, 316122, 578278, 4841, 561898, 176877, 201456, 160497, 316148, 578293, 471797, 725752, 201466, 709372, 250622, 176903, 160523, 406284, 578317, 471823, 13073, 725778, 324371, 709398, 406294, 250648, 13083, 324381, 29472, 512806, 578343, 471847, 447273, 504616, 627502, 512816, 504626, 447283, 29498, 193344, 471873, 13122, 414532, 111431, 627528, 103241, 193354, 111441, 562002, 103251, 586581, 86874, 447322, 13148, 78684, 414558, 586591, 316252, 299872, 86884, 815972, 78694, 4967, 562028, 267119, 160627, 832372, 447348, 414582, 316278, 201592, 267129, 299898, 815998, 709502, 250752, 4993, 234372, 635786, 62347, 856972, 160653, 832398, 627596, 414608, 201618, 635796, 627606, 996247, 709528, 5017, 250778, 324507, 234398, 29602, 62373, 13222, 578469, 856998, 471977, 201642, 234411, 447403, 226221, 512942, 578479, 504752, 455597, 996273, 5043, 324533, 234421, 226231, 447413, 29628, 471999, 13248, 472003, 13252, 201668, 455623, 512968, 472009, 504778, 324557, 111567, 103377, 86997, 144347, 447452, 586717, 13278, 512992, 504802, 300002, 816102, 324583, 111593, 103403, 87023, 267249, 144373, 832502, 586743, 447478, 513018, 267259, 504828, 300028, 816128, 111617, 103427, 234502, 218122, 62477, 857102, 586767, 832528, 46097, 414734, 873491, 635922, 627732, 414744, 996377, 111643, 873501, 103453, 291871, 234528, 218148, 62503, 13352, 586793, 291881, 46123, 857128, 635948, 627758, 455727, 5169, 316467, 234547, 226357, 996403, 5179, 316477, 201794, 13378, 635972, 627782, 119881, 455753, 201804, 234573, 226383, 119891, 447572, 87127, 455772, 144477, 635998, 865372, 627808, 324709, 234597, 226407, 447598, 324719, 783472, 87153, 889972, 455798, 144503, 193656, 513144, 504954, 865398, 234623, 799872, 226433, 193666, 513154, 504964, 906372, 783498, 218252, 889998, 87186, 46227, 873621, 824472, 111769, 799898, 103579, 87196, 906398, 873631, 578722, 111779, 103589, 218278, 586919, 292007, 996523, 46253, 218288, 586929, 824498, 316597, 996533, 578748, 316607, 292033, 177347, 120017, 611541, 447702, 292057, 636124, 177373, 455902, 611551, 627934, 865502, 636134, 627944, 120043, 447728, 816369, 783602, 292083, 890102, 455928, 865528, 816379, 234749, 226559, 193792, 800002, 120067, 906502, 234759, 406791, 226569, 783628, 890128, 406801, 87322, 193818, 431387, 120093, 193822, 824602, 906528, 300321, 800028, 578852, 431397, 218408, 562472, 300331, 996653, 193842, 218418, 87348, 824628, 996663, 193848, 578878, 562498, 177477, 161097, 128331, 87372, 193868, 62798, 603472, 128341, 456022, 611671, 62808, 177503, 611681, 161123, 87398, 603498, 456048, 292209, 816499, 202106, 292219, 816509, 202116, 406927, 120219, 431517, 193952, 841121, 120229, 431527, 300457, 30122, 841131, 406953, 562602, 472497, 554419, 193978, 554429, 406977, 300483, 30148, 562628, 390597, 193994, 161227, 472523, 759247, 62928, 603602, 128467, 194004, 456152, 759257, 62938, 300507, 407003, 390623, 87524, 161253, 603628, 128493, 87534, 816622, 456178, 300533, 202242, 128517, 841222, 816648, 5647, 636436, 62997, 857622, 194072, 202268, 636446, 128543, 841248, 202272, 5673, 841257, 30252, 63023, 13872, 857648, 194098, 472627, 202292, 235061, 554549, 456247, 202298, 235071, 554559, 841283, 30278, 390727, 13898, 374347, 472653, 202318, 759377, 456273, 513622, 407129, 841307, 759387, 390753, 407139, 144997, 374373, 431722, 816752, 513648, 300659, 841333, 112247, 63097, 300669, 145023, 431748, 841352, 956041, 816778, 5777, 112273, 956051, 63123, 63127, 857752, 194202, 46747, 636572, 128669, 980637, 841378, 849571, 202402, 128679, 980647, 292521, 5803, 849581, 63153, 14002, 292531, 857778, 46773, 636598, 194228, 456377, 202428, 235197, 448196, 202444, 14028, 448206, 636622, 612048, 374477, 456403, 202454, 235223, 513752, 612058, 906972, 38631, 145127, 636648, 374503, 431852, 235247, 38641, 210673, 841459, 513778, 906998, 235256, 112377, 227066, 210683, 63227, 841469, 890622, 784122, 145153, 235266, 227076, 431878, 5897, 235273, 423691, 956177, 808722, 112403, 349972, 423701, 63253, 784148, 890648, 202522, 46877, 448287, 980767, 825122, 5923, 448297, 980777, 849707, 22316, 956203, 579372, 349998, 808748, 292657, 202548, 22326, 46903, 825148, 46912, 956227, 849733, 579398, 46922, 292683, 448332, 177997, 513872, 612178, 612188, 849757, 956253, 907102, 292707, 448358, 178023, 636774, 38761, 513898, 38767, 636784, 112497, 38771, 210803, 849783, 907128, 120697, 227196, 210813, 292733, 448382, 235392, 890752, 784252, 227206, 235399, 38793, 6027, 112523, 415631, 235409, 407441, 423827, 120723, 808852, 350102, 784278, 448408, 415641, 235418, 407451, 202652, 333722, 890778, 448417, 38817, 825252, 6053, 448427, 300971, 423853, 579502, 808878, 350128, 235442, 563122, 22452, 300981, 202678, 333748, 620472, 38843, 825278, 47042, 423877, 456646, 579528, 47052, 235468, 22478, 178127, 456656, 563148, 620498, 161747, 514002, 169944, 604122, 956379, 423903, 169954, 956389, 22502, 47081, 178153, 514028, 161773, 47091, 112627, 849909, 604148, 243706, 120827, 292859, 849919, 22528, 243716, 292869, 112653, 120853, 448534, 415767, 407577, 333852, 448544, 841771, 415793, 301107, 407603, 841781, 563252, 333878, 38969, 620602, 38979, 415817, 235594, 407627, 301133, 6222, 456782, 563278, 391247, 620628, 161877, 235604, 170074, 604252, 424029, 415843, 170084, 301157, 407653, 424039, 6248, 456808, 391273, 858222, 161903, 47217, 120947, 6261, 604278, 129147, 22654, 6271, 301183, 456832, 243842, 22664, 858248, 194696, 47243, 120973, 841872, 194706, 129173, 456858, 383131, 243868, 47267, 989347, 383141, 841898, 841907, 243892, 47293, 989373, 841933, 243918, 6352, 391377, 374997, 334043, 415969, 407779, 334053, 841957, 6378, 415979, 391403, 407789, 375023, 858352, 432372, 121077, 6397, 129277, 841983, 301309, 63747, 301319, 858378, 432398, 121103, 194832, 964881, 842002, 956691, 6423, 129303, 456984, 964891, 956701, 63773, 366881, 456994, 383267, 989477, 194858, 325931, 366891, 850221, 842028, 6447, 325941, 850231, 47419, 383293, 989503, 194882, 47429, 6473, 244044, 162131, 383317, 244054, 375127, 194908, 162141, 334173, 874847, 907622, 334183, 383343, 375153, 129397, 432502, 14711, 6521, 31097, 825722, 874873, 842109, 907648, 14721, 6531, 63877, 842119, 203146, 129423, 432528, 432531, 31123, 424341, 203156, 825748, 965017, 956827, 809372, 432541, 391581, 424351, 63903, 350622, 391591, 367017, 326061, 326067, 31156, 850357, 22966, 956853, 965043, 326071, 350648, 809398, 31166, 22976, 514496, 367043, 6599, 514506, 965067, 326093, 956877, 850383, 6609, 195034, 162267, 367067, 113121, 874977, 195044, 326117, 965093, 850407, 956903, 907752, 858597, 113131, 383469, 162293, 367093, 383479, 129527, 31227, 825852, 875003, 14847, 326143, 6657, 850433, 907778, 858623, 268809, 580107, 162317, 129553, 449041, 268819, 203282, 31253, 580117, 39447, 825878, 14873, 973331, 6683, 432667, 424477, 449051, 809502, 350752, 973341, 375331, 334372, 391717, 473637, 162343, 236072, 203308, 375341, 473647, 14897, 39473, 6707, 604722, 432693, 424503, 809528, 350778, 31292, 23102, 391743, 334398, 621122, 236098, 203332, 514632, 14923, 604748, 6733, 432717, 424527, 170581, 31318, 391767, 23128, 645722, 621148, 203358, 170591, 514658, 965219, 957029, 432743, 858727, 424553, 113257, 965229, 31342, 957039, 23152, 391793, 367219, 645748, 514682, 326269, 367229, 850559, 14977, 858753, 113283, 326279, 31368, 850569, 23178, 268939, 580237, 514708, 268949, 580247, 39577, 449177, 15003, 113307, 973467, 162469, 334502, 473767, 236202, 375467, 875181, 162479, 473777, 39603, 449203, 113333, 604852, 875191, 973493, 416447, 334528, 621252, 375493, 236228, 15049, 6859, 449227, 973517, 604878, 15059, 6869, 6872, 416473, 645852, 170717, 375517, 621278, 203484, 506592, 121571, 432869, 449253, 424679, 203494, 973543, 506602, 121581, 432879, 391919, 424689, 6898, 645878, 170743, 375543, 391929, 858872, 6911, 105217, 31494, 23304, 6921, 105227, 588557, 170767, 31504, 39697, 23314, 858898, 514834, 588567, 47897, 514844, 236322, 170793, 244522, 39723, 989997, 875311, 47923, 113459, 875321, 236348, 113469, 416577, 244548, 990023, 7002, 416603, 506722, 449379, 973669, 121707, 506732, 449389, 973679, 7028, 375669, 859002, 375679, 105347, 121733, 7047, 818059, 105357, 588687, 998291, 39827, 818069, 859028, 408472, 588697, 48027, 121757, 998301, 7073, 236452, 170919, 244652, 39853, 990127, 170929, 408498, 48053, 121783, 7097, 416697, 236478, 244678, 990153, 383947, 7123, 416723, 130021, 383973, 875497, 130031, 80881, 80891, 793597, 15361, 31747, 826372, 875523, 883722, 15371, 818189, 48147, 818199, 793623, 408602, 998427, 31773, 826398, 244772, 883748, 48173, 195632, 408628, 121909, 64566, 998453, 195642, 416827, 244798, 121919, 64576, 965697, 89162, 384077, 998477, 7249, 367697, 89172, 416853, 7259, 326747, 965723, 384103, 998503, 760937, 367723, 875627, 130157, 859247, 760947, 326773, 859256, 81017, 793727, 859266, 162947, 777347, 31877, 826502, 130183, 875653, 15497, 859273, 883852, 81043, 48277, 457881, 793753, 449691, 162973, 777373, 130207, 31903, 826528, 15523, 457891, 449701, 244902, 883878, 81067, 48303, 195762, 130233, 15547, 195772, 605372, 64702, 244928, 433347, 965827, 384197, 81093, 89292, 392397, 367827, 629972, 15573, 89302, 605398, 64728, 433373, 326877, 384223, 965853, 31972, 998629, 646372, 392423, 761067, 367853, 629998, 998639, 64752, 859377, 89331, 761077, 326903, 89341, 31998, 646398, 859392, 318722, 163077, 777477, 64778, 15627, 859403, 859418, 318748, 163103, 777503, 458017, 449827, 15653, 204082, 859442, 130359, 220472, 965947, 204092, 449853, 458043, 605502, 130369, 81219, 974147, 433477, 384327, 367947, 752972, 81229, 859468, 392527, 220498, 15699, 376147, 326997, 965973, 449877, 458067, 605528, 630102, 15709, 974173, 433503, 384353, 367973, 32102, 646502, 752998, 392553, 376173, 458093, 327023, 449903, 630128, 867706, 89467, 163197, 32128, 40321, 646528, 867716, 171397, 318852, 64904, 302472, 40331, 64914, 236946, 89493, 163223, 834972, 236956, 318878, 171423, 302498, 89517, 204212, 834998, 613816, 220602, 433597, 204222, 966077, 613826, 974277, 24006, 392647, 89543, 859594, 638412, 368077, 753102, 24016, 736722, 220628, 376277, 638422, 433623, 327127, 966103, 212441, 859604, 32222, 974303, 392673, 212451, 368103, 753128, 458219, 81388, 237037, 450029, 376303, 736748, 327153, 458229, 81398, 237047, 32248, 450039, 163327, 425472, 867842, 40451, 171527, 40457, 810506, 302602, 40461, 810516, 163353, 425498, 237082, 867868, 998941, 835102, 171553, 409122, 40483, 302628, 998951, 417321, 417331, 237108, 867892, 835128, 40507, 409148, 974397, 433727, 613952, 89669, 392777, 7756, 376397, 24142, 89679, 638542, 237132, 867918, 736852, 40533, 7766, 974423, 638552, 433753, 613978, 32352, 212577, 294497, 392803, 237158, 376423, 24168, 294507, 81518, 237167, 736878, 614002, 81528, 237177, 32378, 212603, 171647, 24192, 425602, 48771, 794247, 614028, 48781, 810642, 212627, 245396, 884372, 171673, 24218, 425628, 245406, 794273, 409252, 999077, 802472, 810668, 212653, 884398, 417457, 73406, 999103, 65216, 409278, 802498, 974527, 810692, 32456, 73416, 65226, 417483, 171722, 868044, 376527, 32466, 40659, 7892, 868054, 999127, 974553, 40669, 810718, 294627, 417507, 171748, 237284, 376553, 294637, 7918, 89838, 237294, 999153, 89848, 417533, 171777, 7942, 794377, 614154, 48907, 818956, 777997, 614164, 818966, 884502, 24344, 778006, 171803, 245532, 7968, 81697, 24354, 778016, 794403, 48933, 778023, 802602, 212779, 884528, 384821, 212789, 245558, 81723, 646972, 48957, 384831, 802628, 73542, 65352, 409417, 573256, 171852, 16206, 245582, 32592, 155472, 573266, 409427, 646998, 48983, 16216, 810844, 630622, 73568, 65378, 302947, 810854, 171878, 245608, 171881, 32618, 155498, 302957, 999279, 89968, 171891, 73592, 999289, 65402, 89978, 417659, 630648, 32642, 417669, 524168, 319372, 778127, 524178, 73618, 65428, 147347, 819092, 32668, 8094, 778142, 81827, 319398, 8104, 122793, 860072, 966571, 778153, 147373, 819118, 122803, 966581, 778168, 368571, 384957, 81853, 647102, 221122, 335811, 860098, 327621, 368581, 819142, 458697, 409547, 335821, 557006, 327631, 573392, 778192, 155602, 49109, 16342, 384983, 409557, 647128, 753622, 516056, 221148, 557016, 49119, 819168, 630752, 516066, 843747, 458723, 303077, 245734, 573418, 778218, 155628, 163821, 843757, 385007, 16368, 303087, 172017, 155631, 753648, 245744, 163831, 114681, 630778};
// Python 牛逼!!!
int main()
{
    int t,num;
    cin >> t;
    while (t--)
    {
        scanf("%d", &num);
        int in = num;
        int flag = 0;
        for (int i= 0; i < 5465; i++)
        {
            if (in == lst[i])
            {
                printf("Yes\n");
                flag = 1;
                break;
            }
        }
        if (flag == 0)
        {
            printf("No\n");
        }

    }
    return 0;
}
Archives Tip
QR Code for this page
Tipping QR Code