这题如果全部打表的话,文件大小会有65kb,超了,所以只打出一半,前一半用程序算就可以了,并不会超时。

如果算法优化的好,其实可以打的更少。

#include <bits/stdc++.h>
using namespace std; const int maxn=1e5+10;
// const int N=1e4+10;
const int N=5e3+10;
int vis[maxn],p[maxn],cnt=0,f[maxn];
int a[maxn]={94353,94353,94353,94623,94623,94623,94623,94623,94623,94865,94865,95111,95111,95111,95111,95111,95111,95111,95111,95111,95111,95336,95336,95620,95620,95620,95620,95620,95620,95620,95620,95620,95620,95620,95620,95620,95620,95620,95620,95818,95818,95818,95818,95818,95818,95818,95818,95818,95818,95818,95818,96074,96074,96074,96074,96074,96074,96074,96074,96321,96321,96321,96321,96321,96321,96321,96321,96321,96321,96321,96321,96321,96321,96321,96321,96321,96321,96585,96585,96585,96585,96819,96819,96819,96819,96819,96819,97088,97088,97088,97088,97088,97088,97088,97088,97088,97088,97088,97088,97352,97352,97570,97570,97570,97570,97570,97570,97862,97862,97862,97862,97862,97862,98163,98163,98163,98163,98163,98163,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98394,98663,98663,98663,98663,98663,98663,98932,98932,98932,98932,98932,98932,98932,98932,98932,98932,98932,98932,98932,98932,99218,99218,99218,99218,99475,99475,99475,99475,99475,99475,99475,99475,99706,99706,99706,99706,99706,99706,99706,99706,99706,99706,99968,99968,99968,99968,99968,99968,99968,99968,100275,100275,100275,100275,100275,100275,100275,100275,100275,100275,100275,100275,100558,100558,100558,100558,100558,100558,100558,100558,100558,100558,100558,100558,100558,100558,100558,100558,100558,100558,100798,100798,100798,100798,101019,101019,101336,101336,101336,101336,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101610,101895,101895,101895,101895,101895,101895,101895,101895,101895,101895,101895,101895,102194,102194,102194,102194,102194,102194,102420,102420,102687,102687,102687,102687,102687,102687,102687,102687,102687,102687,102687,102687,102687,102687,102687,102687,102969,102969,102969,102969,102969,102969,103249,103249,103249,103249,103249,103249,103502,103502,103502,103502,103502,103502,103502,103502,103502,103502,103502,103502,103502,103502,103801,103801,103801,103801,103801,103801,103801,103801,103801,103801,104089,104089,104089,104089,104089,104089,104089,104089,104089,104089,104089,104089,104089,104089,104370,104370,104370,104370,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104613,104865,104865,104865,104865,104865,104865,105195,105195,105195,105195,105195,105195,105536,105536,105536,105536,105536,105536,105803,105803,105803,105803,105803,105803,105803,105803,106104,106104,106104,106104,106104,106104,106399,106399,106399,106399,106644,106644,106871,106871,106871,106871,106871,106871,106871,106871,106871,106871,106871,106871,107143,107143,107143,107143,107143,107143,107484,107484,107484,107484,107702,107702,108016,108016,108016,108016,108016,108016,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108311,108597,108597,108597,108597,108597,108597,108924,108924,109154,109154,109154,109154,109456,109456,109456,109456,109456,109456,109456,109456,109456,109456,109456,109456,109456,109456,109456,109456,109456,109456,109694,109694,109993,109993,109993,109993,110284,110284,110284,110284,110284,110284,110284,110284,110284,110284,110284,110284,110572,110572,110838,110838,110838,110838,110838,110838,111194,111194,111194,111194,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111421,111699,111699,111699,111699,111699,111699,112002,112002,112002,112002,112002,112002,112282,112282,112282,112282,112583,112583,112583,112583,112583,112583,112583,112583,112825,112825,112825,112825,112825,112825,112825,112825,112825,112825,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113077,113376,113376,113376,113376,113376,113376,113376,113376,113376,113376,113376,113376,113376,113376,113376,113376,113669,113669,113925,113925,113925,113925,113925,113925,114245,114245,114245,114245,114501,114501,114802,114802,114802,114802,115107,115107,115373,115373,115373,115373,115373,115373,115373,115373,115373,115373,115613,115613,115613,115613,115613,115613,115613,115613,115613,115613,115613,115613,115613,115613,115870,115870,115870,115870,115870,115870,116108,116108,116108,116108,116397,116397,116397,116397,116397,116397,116397,116397,116712,116712,116712,116712,116712,116712,116712,116712,116712,116712,116978,116978,116978,116978,116978,116978,117317,117317,117317,117317,117317,117317,117317,117317,117317,117317,117317,117317,117317,117317,117317,117317,117317,117317,117317,117317,117675,117675,117675,117675,117927,117927,118268,118268,118268,118268,118268,118268,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118523,118804,118804,118804,118804,119082,119082,119082,119082,119082,119082,119082,119082,119341,119341,119341,119341,119341,119341,119341,119341,119341,119341,119593,119593,119593,119593,119593,119593,119917,119917,119917,119917,119917,119917,120235,120235,120235,120235,120235,120235,120235,120235,120522,120522,120522,120522,120522,120522,120870,120870,120870,120870,120870,120870,120870,120870,120870,120870,120870,120870,121123,121123,121123,121123,121424,121424,121424,121424,121424,121424,121734,121734,121997,121997,121997,121997,121997,121997,122279,122279,122279,122279,122526,122526,122526,122526,122526,122526,122801,122801,123081,123081,123081,123081,123081,123081,123081,123081,123081,123081,123362,123362,123617,123617,123617,123617,123617,123617,123617,123617,123617,123617,123617,123617,123617,123617,123617,123617,123937,123937,123937,123937,123937,123937,124237,124237,124237,124237,124237,124237,124237,124237,124237,124237,124237,124237,124237,124237,124237,124237,124237,124237,124237,124237,124546,124546,124546,124546,124850,124850,124850,124850,124850,124850,124850,124850,124850,124850,124850,124850,125123,125123,125123,125123,125123,125123,125123,125123,125123,125123,125123,125123,125123,125123,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125475,125774,125774,125774,125774,125774,125774,126099,126099,126099,126099,126099,126099,126099,126099,126099,126099,126099,126099,126099,126099,126099,126099,126099,126099,126099,126099,126428,126428,126428,126428,126687,126687,126687,126687,126687,126687,126687,126687,126687,126687,126687,126687,126687,126687,126687,126687,126687,126687,126970,126970,126970,126970,126970,126970,126970,126970,127294,127294,127294,127294,127294,127294,127597,127597,127597,127597,127916,127916,127916,127916,127916,127916,128204,128204,128204,128204,128204,128204,128204,128204,128204,128204,128204,128204,128204,128204,128532,128532,128532,128532,128532,128532,128868,128868,128868,128868,128868,128868,129151,129151,129151,129151,129151,129151,129151,129151,129151,129151,129433,129433,129708,129708,129708,129708,129708,129708,129708,129708,129708,129708,130014,130014,130014,130014,130014,130014,130014,130014,130014,130014,130014,130014,130351,130351,130351,130351,130351,130351,130351,130351,130636,130636,130636,130636,130636,130636,130636,130636,130636,130636,130913,130913,131242,131242,131242,131242,131242,131242,131242,131242,131242,131242,131561,131561,131561,131561,131561,131561,131561,131561,131850,131850,131850,131850,131850,131850,131850,131850,131850,131850,131850,131850,132201,132201,132201,132201,132201,132201,132201,132201,132201,132201,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132534,132847,132847,133131,133131,133131,133131,133449,133449,133449,133449,133449,133449,133449,133449,133726,133726,133726,133726,133726,133726,134053,134053,134053,134053,134325,134325,134325,134325,134325,134325,134325,134325,134609,134609,134609,134609,134609,134609,134609,134609,134609,134609,134609,134609,134609,134609,134609,134609,134609,134609,134946,134946,134946,134946,134946,134946,134946,134946,134946,134946,135265,135265,135265,135265,135265,135265,135613,135613,135613,135613,135613,135613,135906,135906,136183,136183,136183,136183,136183,136183,136477,136477,136477,136477,136477,136477,136477,136477,136477,136477,136798,136798,136798,136798,136798,136798,136798,136798,136798,136798,136798,136798,137080,137080,137326,137326,137326,137326,137326,137326,137326,137326,137326,137326,137656,137656,137656,137656,137656,137656,138009,138009,138009,138009,138009,138009,138310,138310,138310,138310,138310,138310,138575,138575,138575,138575,138575,138575,138575,138575,138872,138872,138872,138872,138872,138872,139191,139191,139191,139191,139191,139191,139191,139191,139191,139191,139515,139515,139515,139515,139515,139515,139801,139801,140104,140104,140104,140104,140104,140104,140478,140478,140478,140478,140478,140478,140849,140849,140849,140849,140849,140849,141141,141141,141141,141141,141141,141141,141141,141141,141141,141141,141432,141432,141432,141432,141432,141432,141432,141432,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,141767,142055,142055,142055,142055,142055,142055,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142382,142665,142665,143001,143001,143001,143001,143001,143001,143001,143001,143001,143001,143001,143001,143001,143001,143001,143001,143001,143001,143269,143269,143269,143269,143600,143600,143600,143600,143600,143600,143600,143600,143872,143872,143872,143872,143872,143872,143872,143872,143872,143872,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144166,144486,144486,144486,144486,144486,144486,144486,144486,144786,144786,144786,144786,144786,144786,144786,144786,144786,144786,144786,144786,144786,144786,144786,144786,144786,144786,145101,145101,145101,145101,145367,145367,145699,145699,145699,145699,145699,145699,145699,145699,145699,145699,146051,146051,146051,146051,146051,146051,146353,146353,146649,146649,146649,146649,146649,146649,147021,147021,147021,147021,147321,147321,147321,147321,147321,147321,147321,147321,147321,147321,147321,147321,147321,147321,147321,147321,147321,147321,147610,147610,147610,147610,147610,147610,147610,147610,147914,147914,147914,147914,147914,147914,147914,147914,147914,147914,147914,147914,148231,148231,148231,148231,148231,148231,148231,148231,148231,148231,148231,148231,148231,148231,148231,148231,148231,148231,148552,148552,148552,148552,148552,148552,148552,148552,148552,148552,148552,148552,148552,148552,148552,148552,148946,148946,148946,148946,148946,148946,149220,149220,149539,149539,149539,149539,149539,149539,149539,149539,149539,149539,149539,149539,149879,149879,149879,149879,149879,149879,150197,150197,150197,150197,150197,150197,150197,150197,150197,150197,150514,150514,150817,150817,150817,150817,150817,150817,150817,150817,150817,150817,151104,151104,151480,151480,151480,151480,151480,151480,151776,151776,151776,151776,151776,151776,151776,151776,151776,151776,152067,152067,152067,152067,152067,152067,152067,152067,152067,152067,152067,152067,152067,152067,152415,152415,152415,152415,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,152804,153101,153101,153452,153452,153452,153452,153452,153452,153452,153452,153452,153452,153452,153452,153452,153452,153452,153452,153784,153784,154085,154085,154085,154085,154085,154085,154085,154085,154085,154085,154374,154374,154726,154726,154726,154726,154726,154726,154726,154726,154726,154726,155054,155054,155054,155054,155054,155054,155054,155054,155054,155054,155054,155054,155054,155054,155054,155054,155054,155054,155054,155054,155431,155431,155431,155431,155744,155744,156062,156062,156062,156062,156407,156407,156407,156407,156407,156407,156407,156407,156718,156718,156718,156718,156718,156718,156718,156718,156718,156718,156718,156718,156718,156718,156718,156718,157086,157086,157086,157086,157086,157086,157440,157440,157440,157440,157440,157440,157724,157724,158045,158045,158045,158045,158045,158045,158045,158045,158045,158045,158045,158045,158409,158409,158409,158409,158409,158409,158409,158409,158409,158409,158409,158409,158409,158409,158409,158409,158725,158725,158725,158725,158725,158725,158725,158725,159049,159049,159049,159049,159345,159345,159345,159345,159345,159345,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,159696,160076,160076,160376,160376,160376,160376,160376,160376,160376,160376,160376,160376,160687,160687,161011,161011,161011,161011,161011,161011,161360,161360,161360,161360,161693,161693,161693,161693,161693,161693,162055,162055,162055,162055,162055,162055,162428,162428,162428,162428,162428,162428,162428,162428,162732,162732,162732,162732,162732,162732,163118,163118,163118,163118,163426,163426,163426,163426,163426,163426,163426,163426,163426,163426,163426,163426,163767,163767,163767,163767,163767,163767,164030,164030,164030,164030,164030,164030,164030,164030,164387,164387,164387,164387,164387,164387,164387,164387,164387,164387,164387,164387,164698,164698,164698,164698,165076,165076,165076,165076,165076,165076,165076,165076,165076,165076,165076,165076,165076,165076,165406,165406,165406,165406,165406,165406,165406,165406,165406,165406,165406,165406,165728,165728,165728,165728,165728,165728,165728,165728,165728,165728,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166023,166410,166410,166410,166410,166410,166410,166762,166762,166762,166762,166762,166762,166762,166762,166762,166762,166762,166762,167091,167091,167091,167091,167091,167091,167463,167463,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,167769,168087,168087,168087,168087,168087,168087,168087,168087,168361,168361,168361,168361,168361,168361,168361,168361,168361,168361,168361,168361,168361,168361,168361,168361,168361,168361,168708,168708,168708,168708,168708,168708,168708,168708,168708,168708,169051,169051,169051,169051,169051,169051,169441,169441,169441,169441,169441,169441,169441,169441,169441,169441,169441,169441,169441,169441,169814,169814,169814,169814,170137,170137,170518,170518,170518,170518,170518,170518,170843,170843,170843,170843,170843,170843,170843,170843,170843,170843,171132,171132,171132,171132,171132,171132,171132,171132,171470,171470,171470,171470,171470,171470,171819,171819,171819,171819,172177,172177,172177,172177,172177,172177,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172546,172970,172970,172970,172970,172970,172970,172970,172970,172970,172970,172970,172970,172970,172970,173344,173344,173344,173344,173344,173344,173344,173344,173344,173344,173747,173747,174057,174057,174057,174057,174057,174057,174057,174057,174057,174057,174057,174057,174364,174364,174364,174364,174364,174364,174364,174364,174364,174364,174673,174673,175038,175038,175038,175038,175038,175038,175038,175038,175038,175038,175038,175038,175038,175038,175038,175038,175332,175332,175649,175649,175649,175649,175649,175649,175649,175649,175649,175649,175649,175649,175649,175649,175649,175649,175649,175649,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,175972,176331,176331,176331,176331,176331,176331,176331,176331,176331,176331,176331,176331,176331,176331,176331,176331,176331,176331,176642,176642,176642,176642,176642,176642,177055,177055,177055,177055,177055,177055,177055,177055,177055,177055,177055,177055,177055,177055,177055,177055,177450,177450,177450,177450,177450,177450,177450,177450,177450,177450,177450,177450,177450,177450,177450,177450,177450,177450,177771,177771,177771,177771,177771,177771,178094,178094,178456,178456,178456,178456,178456,178456,178456,178456,178456,178456,178456,178456,178456,178456,178456,178456,178456,178456,178828,178828,178828,178828,179150,179150,179150,179150,179150,179150,179564,179564,179877,179877,179877,179877,179877,179877,179877,179877,179877,179877,180210,180210,180210,180210,180210,180210,180210,180210,180623,180623,180623,180623,180623,180623,180623,180623,180623,180623,180985,180985,180985,180985,180985,180985,181337,181337,181337,181337,181337,181337,181671,181671,181671,181671,181671,181671,181671,181671,182056,182056,182056,182056,182380,182380,182380,182380,182380,182380,182754,182754,183103,183103,183103,183103,183103,183103,183103,183103,183103,183103,183414,183414,183724,183724,183724,183724,183724,183724,183724,183724,183724,183724,183724,183724,184086,184086,184086,184086,184477,184477,184477,184477,184477,184477,184840,184840,184840,184840,184840,184840,185150,185150,185481,185481,185481,185481,185481,185481,185481,185481,185481,185481,185481,185481,185849,185849,185849,185849,186201,186201,186201,186201,186201,186201,186201,186201,186201,186201,186201,186201,186201,186201,186536,186536,186536,186536,186536,186536,186536,186536,186536,186536,186536,186536,186536,186536,186536,186536,186536,186536,186849,186849,186849,186849,187198,187198,187198,187198,187198,187198,187514,187514,187514,187514,187514,187514,187514,187514,187514,187514,187514,187514,187514,187514,187514,187514,187514,187514,187514,187514,187854,187854,187854,187854,188231,188231,188231,188231,188231,188231,188231,188231,188563,188563,188563,188563,188563,188563,188939,188939,188939,188939,189254,189254,189254,189254,189254,189254,189254,189254,189596,189596,189596,189596,190041,190041,190041,190041,190041,190041,190041,190041,190041,190041,190041,190041,190041,190041,190434,190434,190434,190434,190434,190434,190802,190802,190802,190802,191160,191160,191160,191160,191160,191160,191160,191160,191160,191160,191160,191160,191160,191160,191502,191502,191502,191502,191502,191502,191502,191502,191502,191502,191502,191502,191931,191931,191931,191931,192287,192287,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192631,192943,192943,192943,192943,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193343,193725,193725,193725,193725,193725,193725,194146,194146,194146,194146,194146,194146,194542,194542,194542,194542,194542,194542,194542,194542,194542,194542,194542,194542,194856,194856,194856,194856,194856,194856,194856,194856,194856,194856,194856,194856,195239,195239,195239,195239,195239,195239,195239,195239,195239,195239,195239,195239,195239,195239,195604,195604,195604,195604,195604,195604,195989,195989,195989,195989,196374,196374,196746,196746,196746,196746,197113,197113,197113,197113,197113,197113,197113,197113,197113,197113,197113,197113,197113,197113,197113,197113,197113,197113,197469,197469,197469,197469,197469,197469,197883,197883,197883,197883,197883,197883,197883,197883,197883,197883,197883,197883,198209,198209,198209,198209,198209,198209,198209,198209,198650,198650,198650,198650,198650,198650,199056,199056,199056,199056,199430,199430,199430,199430,199430,199430,199430,199430,199430,199430,199430,199430,199791,199791,200102,200102,200102,200102,200102,200102,200102,200102,200102,200102,200102,200102,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200503,200901,200901,200901,200901,200901,200901,200901,200901,200901,200901,200901,200901,200901,200901,200901,200901,201209,201209,201590,201590,201590,201590,201590,201590,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,201965,202311,202311,202311,202311,202311,202311,202311,202311,202311,202311,202311,202311,202311,202311,202760,202760,202760,202760,202760,202760,203124,203124,203124,203124,203124,203124,203124,203124,203124,203124,203436,203436,203436,203436,203436,203436,203436,203436,203436,203436,203436,203436,203791,203791,203791,203791,203791,203791,204176,204176,204534,204534,204534,204534,204925,204925,204925,204925,204925,204925,204925,204925,205232,205232,205232,205232,205232,205232,205232,205232,205232,205232,205575,205575,205575,205575,205575,205575,205981,205981,205981,205981,205981,205981,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206411,206801,206801,206801,206801,206801,206801,206801,206801,206801,206801,206801,206801,206801,206801,207133,207133,207133,207133,207133,207133,207528,207528,207528,207528,207869,207869,207869,207869,207869,207869,207869,207869,208229,208229,208229,208229,208229,208229,208229,208229,208229,208229,208229,208229,208561,208561,208561,208561,208561,208561,208561,208561,208561,208561,208561,208561,208561,208561,208561,208561,208561,208561,208931,208931,208931,208931,208931,208931,208931,208931,208931,208931,209256,209256,209618,209618,209618,209618,209618,209618,209618,209618,209618,209618,209950,209950,210334,210334,210334,210334,210736,210736,210736,210736,210736,210736,211174,211174,211174,211174,211174,211174,211174,211174,211174,211174,211174,211174,211174,211174,211174,211174,211174,211174,211174,211174,211572,211572,211572,211572,211572,211572,211915,211915,211915,211915,212303,212303,212303,212303,212303,212303,212303,212303,212303,212303,212303,212303,212303,212303,212685,212685,212685,212685,213111,213111,213500,213500,213500,213500,213925,213925,213925,213925,213925,213925,213925,213925,213925,213925,213925,213925,213925,213925,214258,214258,214258,214258,214258,214258,214655,214655,214655,214655,214655,214655,214655,214655,214655,214655,214655,214655,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,214980,215356,215356,215356,215356,215356,215356,215356,215356,215356,215356,215789,215789,215789,215789,215789,215789,216196,216196,216196,216196,216196,216196,216196,216196,216604,216604,216604,216604,216604,216604,216604,216604,216604,216604,216986,216986,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217358,217733,217733,217733,217733,218158,218158,218158,218158,218158,218158,218543,218543,218911,218911,218911,218911,218911,218911,218911,218911,218911,218911,218911,218911,219305,219305,219305,219305,219706,219706,219706,219706,219706,219706,219706,219706,219706,219706,219706,219706,219706,219706,220055,220055,220055,220055,220055,220055,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220509,220863,220863,220863,220863,220863,220863,220863,220863,220863,220863,220863,220863,221247,221247,221247,221247,221247,221247,221247,221247,221576,221576,221576,221576,221576,221576,221983,221983,221983,221983,221983,221983,221983,221983,221983,221983,222453,222453,222818,222818,222818,222818,223267,223267,223267,223267,223267,223267,223267,223267,223267,223267,223267,223267,223267,223267,223267,223267,223267,223267,223267,223267,223666,223666,223666,223666,223666,223666,223666,223666,223666,223666,224079,224079,224079,224079,224079,224079,224079,224079,224437,224437,224437,224437,224437,224437,224437,224437,224437,224437,224437,224437,224437,224437,224437,224437,224818,224818,225215,225215,225215,225215,225215,225215,225215,225215,225215,225215,225569,225569,225569,225569,225569,225569,225569,225569,225569,225569,225569,225569,225569,225569,225993,225993,225993,225993,226449,226449,226816,226816,226816,226816,226816,226816,226816,226816,226816,226816,226816,226816,227185,227185,227185,227185,227185,227185,227576,227576,227576,227576,227576,227576,227576,227576,227576,227576,227576,227576,227576,227576,227576,227576,228027,228027,228027,228027,228027,228027,228390,228390,228390,228390,228390,228390,228390,228390,228829,228829,228829,228829,229184,229184,229184,229184,229184,229184,229184,229184,229520,229520,229520,229520,229905,229905,229905,229905,229905,229905,230263,230263,230263,230263,230263,230263,230263,230263,230702,230702,230702,230702,230702,230702,231089,231089,231089,231089,231089,231089,231474,231474,231474,231474,231474,231474,231474,231474,231474,231474,231474,231474,231846,231846,231846,231846,231846,231846,232296,232296,232296,232296,232643,232643,232643,232643,232643,232643,233053,233053,233053,233053,233053,233053,233520,233520,233520,233520,233520,233520,233520,233520,233890,233890,233890,233890,233890,233890,233890,233890,233890,233890,233890,233890,233890,233890,233890,233890,233890,233890,234246,234246,234246,234246,234663,234663,234663,234663,234663,234663,234663,234663,234663,234663,234663,234663,234663,234663,234663,234663,234663,234663,234663,234663,235127,235127,235127,235127,235526,235526,235526,235526,235526,235526,235526,235526,235526,235526,235526,235526,235900,235900,236229,236229,236229,236229,236229,236229,236229,236229,236229,236229,236602,236602,236602,236602,236602,236602,237063,237063,237390,237390,237390,237390,237390,237390,237390,237390,237390,237390,237732,237732,237732,237732,237732,237732,237732,237732,237732,237732,237732,237732,238079,238079,238509,238509,238509,238509,238899,238899,238899,238899,238899,238899,238899,238899,238899,238899,238899,238899,238899,238899,238899,238899,238899,238899,238899,238899,239323,239323,239323,239323,239323,239323,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,239770,240155,240155,240155,240155,240155,240155,240577,240577,240577,240577,240980,240980,240980,240980,240980,240980,240980,240980,241356,241356,241356,241356,241356,241356,241356,241356,241356,241356,241736,241736,241736,241736,241736,241736,241736,241736,241736,241736,241736,241736,242173,242173,242173,242173,242173,242173,242506,242506,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,242875,243255,243255,243593,243593,243593,243593,243593,243593,244008,244008,244008,244008,244343,244343,244811,244811,244811,244811,244811,244811,244811,244811,244811,244811,244811,244811,244811,244811,244811,244811,245153,245153,245153,245153,245153,245153,245153,245153,245153,245153,245153,245153,245574,245574,245978,245978,245978,245978,245978,245978,246309,246309,246309,246309,246309,246309,246309,246309,246309,246309,246674,246674,246674,246674,246674,246674,246674,246674,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247120,247466,247466,247466,247466,247466,247466,247466,247466,247466,247466,247466,247466,247959,247959,247959,247959,247959,247959,248334,248334,248334,248334,248334,248334,248334,248334,248334,248334,248334,248334,248334,248334,248334,248334,248334,248334,248785,248785,248785,248785,248785,248785,249211,249211,249211,249211,249606,249606,249606,249606,249606,249606,249606,249606,249606,249606,249606,249606,249606,249606,249965,249965,249965,249965,249965,249965,250392,250392,250392,250392,250770,250770,250770,250770,250770,250770,250770,250770,250770,250770,250770,250770,251231,251231,251231,251231,251231,251231,251231,251231,251655,251655,251655,251655,251655,251655,252109,252109,252109,252109,252109,252109,252109,252109,252109,252109,252109,252109,252501,252501,252501,252501,252903,252903,252903,252903,252903,252903,253284,253284,253284,253284,253284,253284,253284,253284,253284,253284,253284,253284,253670,253670,253670,253670,253670,253670,254100,254100,254100,254100,254100,254100,254100,254100,254100,254100,254100,254100,254479,254479,254846,254846,254846,254846,254846,254846,254846,254846,254846,254846,254846,254846,254846,254846,254846,254846,255331,255331,255331,255331,255331,255331,255331,255331,255331,255331,255331,255331,255331,255331,255331,255331,255331,255331,255331,255331,255745,255745,255745,255745,256132,256132,256541,256541,256541,256541,256541,256541,256541,256541,256541,256541,257020,257020,257020,257020,257020,257020,257020,257020,257020,257020,257020,257020,257020,257020,257020,257020,257020,257020,257409,257409,257409,257409,257409,257409,257409,257409,257783,257783,257783,257783,258204,258204,258204,258204,258204,258204,258204,258204,258204,258204,258204,258204,258204,258204,258631,258631,258631,258631,259027,259027,259436,259436,259436,259436,259436,259436,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,259854,260196,260196,260196,260196,260196,260196,260675,260675,260675,260675,260675,260675,260675,260675,260675,260675,260675,260675,260675,260675,261083,261083,261083,261083,261083,261083,261554,261554,261554,261554,261554,261554,261973,261973,261973,261973,261973,261973,261973,261973,261973,261973,262445,262445,262445,262445,262445,262445,262872,262872,263250,263250,263250,263250,263250,263250,263250,263250,263250,263250,263612,263612,264080,264080,264080,264080,264497,264497,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,264916,265324,265324,265742,265742,265742,265742,266217,266217,266217,266217,266217,266217,266646,266646,266646,266646,266646,266646,267037,267037,267037,267037,267037,267037,267037,267037,267037,267037,267037,267037,267426,267426,267426,267426,267426,267426,267852,267852,267852,267852,267852,267852,267852,267852,267852,267852,267852,267852,267852,267852,268223,268223,268223,268223,268223,268223,268223,268223,268223,268223,268598,268598,268598,268598,268598,268598,268598,268598,268598,268598,268598,268598,269021,269021,269021,269021,269021,269021,269418,269418,269418,269418,269418,269418,269418,269418,269849,269849,269849,269849,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270308,270764,270764,270764,270764,270764,270764,270764,270764,270764,270764,270764,270764,270764,270764,271141,271141,271141,271141,271141,271141,271141,271141,271141,271141,271141,271141,271587,271587,271587,271587,271587,271587,271971,271971,271971,271971,272415,272415,272415,272415,272415,272415,272824,272824,273206,273206,273206,273206,273206,273206,273206,273206,273206,273206,273206,273206,273695,273695,273695,273695,273695,273695,274136,274136,274136,274136,274136,274136,274136,274136,274136,274136,274136,274136,274526,274526,274526,274526,274526,274526,274526,274526,274526,274526,274526,274526,274526,274526,274526,274526,275007,275007,275410,275410,275410,275410,275410,275410,275410,275410,275410,275410,275789,275789,275789,275789,275789,275789,275789,275789,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276237,276656,276656,277076,277076,277076,277076,277076,277076,277076,277076,277076,277076,277076,277076,277542,277542,277542,277542,277542,277542,277917,277917,277917,277917,278373,278373,278373,278373,278373,278373,278777,278777,278777,278777,278777,278777,278777,278777,278777,278777,278777,278777,278777,278777,278777,278777,278777,278777,279225,279225,279659,279659,279659,279659,279659,279659,279659,279659,279659,279659,279659,279659,280056,280056,280056,280056,280056,280056,280499,280499,280499,280499,280872,280872,280872,280872,280872,280872,280872,280872,280872,280872,280872,280872,281366,281366,281366,281366,281366,281366,281366,281366,281771,281771,281771,281771,281771,281771,282212,282212,282212,282212,282212,282212,282212,282212,282212,282212,282212,282212,282586,282586,282586,282586,283042,283042,283042,283042,283042,283042,283463,283463,283463,283463,283463,283463,283463,283463,283463,283463,283463,283463,283881,283881,283881,283881,283881,283881,284321,284321,284723,284723,284723,284723,284723,284723,284723,284723,284723,284723,284723,284723,285096,285096,285096,285096,285096,285096,285096,285096,285096,285096,285096,285096,285548,285548,285548,285548,286055,286055,286055,286055,286055,286055,286055,286055,286055,286055,286055,286055,286055,286055,286458,286458,286458,286458,286458,286458,286903,286903,286903,286903,286903,286903,286903,286903,286903,286903,286903,286903,286903,286903,286903,286903,287364,287364,287364,287364,287364,287364,287792,287792,288196,288196,288196,288196,288196,288196,288196,288196,288196,288196,288588,288588,288588,288588,288588,288588,288588,288588,288975,288975,288975,288975,288975,288975,288975,288975,288975,288975,288975,288975,288975,288975,288975,288975,288975,288975,289417,289417,289417,289417,289417,289417,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,289843,290408,290408,290769}; void euler_prime() {
vis[0]=1;
vis[1]=1;
for (int i=2;i<N;i++) {
if (!vis[i]) {
p[cnt++]=i;
}
for (int j=0;j<cnt&&p[j]*i<N;j++) {
vis[p[j]*i]=1;
if (i%p[j]==0) {
break;
}
}
}
} bool isprime( int num )
{
if(num ==2|| num==3 )
return 1 ;
if(num %6!= 1&&num %6!= 5)
return 0 ;
int tmp =sqrt(num);
for(int i= 5; i <=tmp; i+=6 )
if(num %i== 0||num %(i+ 2)==0)
return 0 ;
return 1 ;
} bool isyltx(int x,int y) {
int index=x*y-3*(x-y);
index=(index>=0?index:0);
if (index<N) {
return !vis[index];
}
else {
return isprime(index);
}
return false;
} int main()
{
euler_prime();
for (int i=0;i<cnt;i++) {
for (int j=i+1;j<cnt;j++) {
int x=p[i];
int y=p[j];
if (isyltx(x,y)) {
f[y]++;
}
swap(x,y);
if (isyltx(x,y)) {
f[x]++;
}
}
}
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
for (int i=1;i<N;i++) {
f[i]+=f[i-1];
}
// for (int i=5000;i<N;i++) {
// printf("%d,",f[i]);
// }
int T,Q;
scanf("%d",&T);
while (T--) {
scanf("%d",&Q);
if (Q<5000) {
printf("%d\n",f[Q]);
}
else {
printf("%d\n",a[Q-5000]);
}
}
return 0;
}

T114048 [RC-02] yltx数对 (打表)的更多相关文章

  1. MySQL左连接时 返回的记录条数 比 左边表 数量多

    在学MySQL的连接时,为了便于记忆,就将左连接 记做 最后结果的总记录数 和 进行左连接的左表的记录数相同,简单的说就是下面这个公式 count(table A left join table B) ...

  2. mysql中左连接后,最终的记录数大于左边表的记录分析

    如果B表符合条件的记录数大于1条,就会出现1:n的情况,这样left join后的结果,记录数会多于A表的记录数. 例如:member与member_login_log表的结构如下,member记录会 ...

  3. NYOJ 85:有趣的数(打表,规律)

    85-有趣的数 内存限制:64MB 时间限制:3000ms 特判: No 通过数:8 提交数:12 难度:2 题目描述: 把分数按下面的办法排成一个数表. 1/1 1/2 1/3 1/4- 2/1 2 ...

  4. 51nod 1082 与7无关的数【打表/预处理】

    1082 与7无关的数 题目来源: 有道难题 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题  收藏  关注 一个正整数,如果它能被7整除,或者它的十进制表示法中某个 ...

  5. [HNOI2009] 有趣的数列——卡特兰数与杨表

    [HNOI 2009] 我们称一个长度为2n的数列是有趣的,当且仅当该数列满足以下三个条件: (1)它是从1到2n共2n个整数的一个排列{ai}: (2)所有的奇数项满足a1<a3<…&l ...

  6. hdu5247找连续数(打表)

    题意(中问题直接粘题意吧)                                 找连续数 Problem Description 小度熊拿到了一个无序的数组,对于这个数组,小度熊想知道是否 ...

  7. 「日志」Navicat统计的行数竟然和表实际行数不一致

    背景 近期为了保障线上数据库的稳定性,我决定针对一些大表的历史数据有计划地进行备份迁移,但是呢,发现一个奇特的现象,Navicat统计行数和表自身count统计数竟然不一致!?0.0 Navicat ...

  8. MySQL中查询行数最多的表并且排序

    #切换到schema use information_schema; #查询数据量最大的30张表 并排序 select table_name,table_rows from tables order ...

  9. 51nod 1062 序列中最大的数【打表】

    1062 序列中最大的数 题目来源: Ural 1079 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题  收藏  关注 有这样一个序列a: a[0] = 0 a[ ...

随机推荐

  1. mybatis(五):源码分析 - sqlsource创建流程

  2. Codeforces Round #621 (Div. 1 + Div. 2)E(二分查找,枚举分界点,容斥原理)

    可以把每头牛看作一个位置,有几对牛可以放置相当于有几对位置可以给它睡觉,没有牛可以在其他牛的位置睡觉,所以有几对牛放置的可能答案就乘多少(相当于在原本的两个集合里分别插入一个元素,元素代表它睡觉的位置 ...

  3. [POI2000] 公共串 - 后缀数组,二分

    [POI2000] 公共串 Description 给出几个由小写字母构成的单词,求它们最长的公共子串的长度. Solution 预处理出后缀数组和高度数组,二分答案 \(k\) ,对于每一个连续的 ...

  4. Form表单利用Jquery Validate验证以及ajax提交

    #表单利用Jquery验证验证以及ajax提交 概述>详细讲解表单利用Jquery >验证验证以及ajax提交的过程,以及Validate的自定义提示语,非空判断,输入字段的远程ajax验 ...

  5. Hydra暴力破解工具

    hydra [[[-l LOGIN|-L FILE] [-p PASS|-P FILE]] | [-C FILE]] [-e nsr] [-o FILE] [-t TASKS] [-M FILE [- ...

  6. 圆桌问题 (ArrayList+模拟)

    圆桌上围坐着2n个人.其中n个人是好人,另外n个人是坏人.如果从第一个人开始数数,数到第m个人,则立即处死该人:然后从被处死的人之后开始数数,再将数到的第m个人处死……依此方法不断处死围坐在圆桌上的人 ...

  7. opencv学习之颜色空间转换cvtColor()

    我们生活中大多数看到的彩色图片都是RGB类型,但是在进行图像处理时,需要用到灰度图.二值图.HSV.HSI等颜色制式,opencv提供了cvtColor()函数来实现这些功能.首先看一下cvtColo ...

  8. unittest学习4-跳过用例执行

    unittest支持跳过单个测试方法,甚至整个测试用例,还支持将测试用例标记为“测试失败” 基本跳过如下: import unittestimport requests,sys class MyTes ...

  9. Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()

    今天遇到一个错误,没有定义一个openssl_cipher_iv_length()方法,可是我明明开启OpenSSL了啊 如果开启了还报错 只需要把php的目录加入环境变量 -重启电脑  就解决了 但 ...

  10. 找不到方法:'System.Net.Http.HttpRequestMessage System.Web.Http.Controllers.HttpActionContext.get_Request()'

    出现这种情况一般是引用了.net standard 库解决方案1:在web.config 文件中增加如下节点 <dependentAssembly> <assemblyIdentit ...