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

csuoj 1392: Number Trick

时间:2015-05-03 23:40:42      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:

http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1392

1392: Number Trick

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 200  Solved: 36
[Submit][Status][Web Board]

Description

技术分享

Input

技术分享

Output

技术分享

Sample Input

2.6

Sample Output

135
270
135135
270270

HINT

 

技术分享

 

 

 

分析:

给一个小数X,找个A使得:AX=(A循环左移一位)

首先,假设A为一个满足题目条件的数,有n个数位,且最高位数字为A 0 。

那么可列出方程:AX=(A-A 0* 10 n-1 )*10+A 0————>> A 0 *(10 n -1)=A*(10-X)

也就是说,只要n和A 0 确定了,A也就可以唯一确定。

那么我们只要直接枚举:n=(1->8) A 0 =(1->9)

计算出A是不是满足这两个条件就可以得出正确答案了。

 

 

AC代码:

 1 #include <cstdio>
 2 typedef long long ll;
 3 using namespace std;
 4  
 5 int power[10],a[10010],ans=0;
 6 float x,tmpx;//不知道为什么用double会wa
 7 ll f1,f2;
 8  
 9 int digit(ll tmp)
10 {
11   int tot=0;
12   while(tmp) tot++,tmp/=10;
13   return tot;
14 }
15  
16 int head(ll tmp)
17 {
18   for (; tmp>=10; tmp/=10);
19   return tmp;
20 }
21  
22 int main()
23 {
24   power[0]=1;
25   for (int i=1; i<=9; i++) power[i]=power[i-1]*10;
26   scanf("%f",&x);
27   if (x>=10)
28   {
29     printf("No solution\n");
30     return 0;
31   }
32   for (int i=1; i<=8; i++)//枚举总共几个数位
33     for (int j=1; j<=9; j++)//枚举开头数字
34     {
35       tmpx=100000-10000*x;
36       f1=(int)tmpx;
37       f2=(ll)10000*(power[i]-1)*j;
38       if (f2%f1!=0) continue;
39       f2/=f1;
40       if (digit(f2)==i && head(f2)==j) a[++ans]=f2;
41     }
42   if (ans==0) printf("No solution\n");
43     else for (int i=1; i<=ans; i++) printf("%d\n",a[i]);
44   return 0;
45 }

 

 

 

学长打表:

 

技术分享
 1 //#include <cstdio>
 2 //#include <cstring>
 3 //
 4 //using namespace std ;
 5 //
 6 //typedef long long LL ;
 7 //
 8 //LL change( LL a ) {
 9 //    LL data[32] ;
10 //    int cur = 0 ;
11 //    while( a ) {
12 //        data[cur++] = a % 10LL ;
13 //        a /= 10LL ;
14 //    }
15 //    LL ans = 0 ;
16 //    for( int i = cur - 2 ; i >= 0 ; i -- ) {
17 //        ans = ans * 10 + data[i] ;
18 //    }
19 //    ans = ans * 10 + data[cur-1] ;
20 //    return ans ;
21 //}
22 //
23 //int main() {
24 //
25 //    freopen("out.txt","w",stdout);
26 //    int cnt = 0 ;
27 //    printf("void init() {\n") ;
28 //    for( LL a = 1LL ; a <= 100000000LL ; a ++ ) {
29 //        LL b = change( a ) ;
30 //        if( 10000LL * b % a == 0 ) {
31 //            LL t = 10000LL * b / a ;
32 //            //ans[t].push_back(a) ;
33 //            printf("ans[%lld].push_back(%lld);" , t , a ) ;
34 //            if( ++cnt == 100 ) {
35 //                printf("\n") ;
36 //                cnt = 0 ;
37 //            }
38 //        }
39 //    }
40 //    printf("\n}\n") ;
41 //
42 //    return 0 ;
43 //}
44 
45 #include <vector>
46 #include <cstdio>
47 #include <cstring>
48 
49 using namespace std ;
50 
51 typedef long long LL ;
52 
53 vector<int> ans[10000000+10] ;
54 void init() {
55 ans[10000].push_back(1);ans[10000].push_back(2);ans[10000].push_back(3);ans[10000].push_back(4);ans[10000].push_back(5);ans[10000].push_back(6);ans[10000].push_back(7);ans[10000].push_back(8);ans[10000].push_back(9);ans[1000].push_back(10);ans[10000].push_back(11);ans[17500].push_back(12);ans[34000].push_back(15);ans[38125].push_back(16);ans[45000].push_back(18);ans[1000].push_back(20);ans[10000].push_back(22);ans[17500].push_back(24);ans[20800].push_back(25);ans[1000].push_back(30);ans[10000].push_back(33);ans[17500].push_back(36);ans[1000].push_back(40);ans[10000].push_back(44);ans[12000].push_back(45);ans[17500].push_back(48);ans[1000].push_back(50);ans[10000].push_back(55);ans[1000].push_back(60);ans[10000].push_back(66);ans[1000].push_back(70);ans[3750].push_back(72);ans[7600].push_back(75);ans[10000].push_back(77);ans[1000].push_back(80);ans[10000].push_back(88);ans[1000].push_back(90);ans[10000].push_back(99);ans[100].push_back(100);ans[7500].push_back(108);ans[10000].push_back(111);ans[16750].push_back(120);ans[20080].push_back(125);ans[26000].push_back(135);ans[30625].push_back(144);ans[32500].push_back(148);ans[33400].push_back(150);ans[44500].push_back(180);ans[46000].push_back(185);ans[100].push_back(200);ans[7500].push_back(216);ans[10000].push_back(222);ans[11200].push_back(225);ans[16750].push_back(240);ans[20080].push_back(250);ans[26000].push_back(270);ans[30625].push_back(288);ans[32500].push_back(296);ans[100].push_back(300);ans[7500].push_back(324);ans[10000].push_back(333);ans[16750].push_back(360);ans[19000].push_back(370);ans[20080].push_back(375);ans[100].push_back(400);ans[7500].push_back(432);ans[10000].push_back(444);ans[11200].push_back(450);ans[16750].push_back(480);ans[100].push_back(500);ans[7500].push_back(540);ans[10000].push_back(555);ans[15625].push_back(592);ans[100].push_back(600);ans[4096].push_back(625);ans[7500].push_back(648);ans[10000].push_back(666);ans[11200].push_back(675);ans[100].push_back(700);ans[2875].push_back(720);ans[5500].push_back(740);ans[6760].push_back(750);ans[7500].push_back(756);ans[10000].push_back(777);ans[100].push_back(800);ans[7500].push_back(864);ans[10000].push_back(888);ans[100].push_back(900);ans[2800].push_back(925);ans[7500].push_back(972);ans[10000].push_back(999);ans[10].push_back(1000);ans[1000].push_back(1010);ans[9100].push_back(1100);ans[10000].push_back(1111);ans[11120].push_back(1125);ans[16675].push_back(1200);ans[17500].push_back(1212);ans[20008].push_back(1250);ans[24250].push_back(1320);
56 ans[27280].push_back(1375);ans[33340].push_back(1500);ans[34000].push_back(1515);ans[36875].push_back(1584);ans[38125].push_back(1616);ans[39400].push_back(1650);ans[44450].push_back(1800);ans[45000].push_back(1818);ans[46672].push_back(1875);ans[49500].push_back(1980);ans[10].push_back(2000);ans[1000].push_back(2020);ans[9100].push_back(2200);ans[10000].push_back(2222);ans[11120].push_back(2250);ans[16675].push_back(2400);ans[17500].push_back(2424);ans[19200].push_back(2475);ans[20008].push_back(2500);ans[20800].push_back(2525);ans[24250].push_back(2640);ans[27280].push_back(2750);ans[10].push_back(3000);ans[1000].push_back(3030);ans[9100].push_back(3300);ans[10000].push_back(3333);ans[11120].push_back(3375);ans[16675].push_back(3600);ans[17500].push_back(3636);ans[20008].push_back(3750);ans[24250].push_back(3960);ans[10].push_back(4000);ans[1000].push_back(4040);ans[3040].push_back(4125);ans[9100].push_back(4400);ans[10000].push_back(4444);ans[11120].push_back(4500);ans[12000].push_back(4545);ans[16675].push_back(4800);ans[17500].push_back(4848);ans[19200].push_back(4950);ans[10].push_back(5000);ans[1000].push_back(5050);ans[9100].push_back(5500);ans[10000].push_back(5555);ans[11120].push_back(5625);ans[10].push_back(6000);ans[1000].push_back(6060);ans[9100].push_back(6600);ans[10000].push_back(6666);ans[11120].push_back(6750);ans[12736].push_back(6875);ans[10].push_back(7000);ans[1000].push_back(7070);ans[3750].push_back(7272);ans[6676].push_back(7500);ans[7600].push_back(7575);ans[9100].push_back(7700);ans[10000].push_back(7777);ans[11120].push_back(7875);ans[11625].push_back(7920);ans[10].push_back(8000);ans[1000].push_back(8080);ans[3040].push_back(8250);ans[9100].push_back(8800);ans[10000].push_back(8888);ans[10].push_back(9000);ans[1000].push_back(9090);ans[9100].push_back(9900);ans[10000].push_back(9999);ans[1].push_back(10000);ans[2440].push_back(10250);ans[7750].push_back(10840);ans[10000].push_back(11111);ans[11112].push_back(11250);ans[18000].push_back(12195);ans[18700].push_back(12300);ans[23125].push_back(13008);ans[26200].push_back(13550);ans[32250].push_back(14760);ans[33334].push_back(15000);ans[34960].push_back(15375);ans[38500].push_back(16260);ans[39025].push_back(16400);ans[44445].push_back(18000);ans[45800].push_back(18450);ans[48750].push_back(19512);ans[1].push_back(20000);ans[1600].push_back(20325);ans[2440].push_back(20500);ans[7750].push_back(21680);ans[10000].push_back(22222);ans[11112].push_back(22500);ans[18000].push_back(24390);ans[18700].push_back(24600);ans[21952].push_back(25625);ans[23125].push_back(26016);ans[26200].push_back(27100);ans[32250].push_back(29520);ans[1].push_back(30000);
57 ans[2440].push_back(30750);ans[7750].push_back(32520);ans[10000].push_back(33333);ans[11112].push_back(33750);ans[11440].push_back(33875);ans[18000].push_back(36585);ans[18700].push_back(36900);ans[23125].push_back(39024);ans[1].push_back(40000);ans[1600].push_back(40650);ans[2440].push_back(41000);ans[7750].push_back(43360);ans[10000].push_back(44444);ans[11112].push_back(45000);ans[13280].push_back(46125);ans[18000].push_back(48780);ans[18700].push_back(49200);ans[1].push_back(50000);ans[2440].push_back(51250);ans[7750].push_back(54200);ans[10000].push_back(55555);ans[11112].push_back(56250);ans[1].push_back(60000);ans[1600].push_back(60975);ans[2440].push_back(61500);ans[7750].push_back(65040);ans[10000].push_back(66666);ans[11112].push_back(67500);ans[11440].push_back(67750);ans[1].push_back(70000);ans[2440].push_back(71750);ans[5150].push_back(73800);ans[7750].push_back(75880);ans[8944].push_back(76875);ans[10000].push_back(77777);ans[11112].push_back(78750);ans[1].push_back(80000);ans[1600].push_back(81300);ans[2440].push_back(82000);ans[7750].push_back(86720);ans[10000].push_back(88888);ans[1].push_back(90000);ans[2440].push_back(92250);ans[7750].push_back(97560);ans[10000].push_back(99999);ans[100].push_back(100100);ans[1000].push_back(101010);ans[1720].push_back(101750);ans[2320].push_back(102375);ans[2500].push_back(102564);ans[2875].push_back(102960);ans[3475].push_back(103600);ans[3750].push_back(103896);ans[3800].push_back(103950);ans[4762].push_back(105000);ans[5500].push_back(105820);ans[6760].push_back(107250);ans[7500].push_back(108108);ans[7600].push_back(108225);ans[8425].push_back(109200);ans[9000].push_back(109890);ans[9091].push_back(110000);ans[9910].push_back(111000);ans[10000].push_back(111111);ans[10625].push_back(111888);ans[12088].push_back(113750);ans[12250].push_back(113960);ans[13375].push_back(115440);ans[13420].push_back(115500);ans[14200].push_back(116550);ans[14530].push_back(117000);ans[15344].push_back(118125);ans[15825].push_back(118800);ans[16750].push_back(120120);ans[16840].push_back(120250);ans[17500].push_back(121212);ans[18100].push_back(122100);ans[18600].push_back(122850);ans[19192].push_back(123750);ans[19920].push_back(124875);ans[20080].push_back(125125);ans[20635].push_back(126000);ans[21250].push_back(126984);ans[22000].push_back(128205);ans[22300].push_back(128700);ans[22780].push_back(129500);ans[23000].push_back(129870);ans[23077].push_back(130000);ans[24400].push_back(132275);ans[24925].push_back(133200);ans[25750].push_back(134680);ans[25926].push_back(135000);ans[26000].push_back(135135);ans[26740].push_back(136500);ans[26875].push_back(136752);ans[27850].push_back(138600);ans[27928].push_back(138750);ans[28500].push_back(139860);ans[28775].push_back(140400);ans[29800].push_back(142450);
58 ans[30000].push_back(142857);ans[30070].push_back(143000);ans[30625].push_back(144144);ans[30700].push_back(144300);ans[30736].push_back(144375);ans[31624].push_back(146250);ans[31750].push_back(146520);ans[32500].push_back(148148);ans[32660].push_back(148500);ans[33400].push_back(150150);ans[34000].push_back(151515);ans[34480].push_back(152625);ans[35000].push_back(153846);ans[35065].push_back(154000);ans[35250].push_back(154440);ans[35650].push_back(155400);ans[36508].push_back(157500);ans[37000].push_back(158730);ans[37840].push_back(160875);ans[38125].push_back(161616);ans[38224].push_back(161875);ans[38575].push_back(162800);ans[38950].push_back(163800);ans[39394].push_back(165000);ans[39875].push_back(166320);ans[39940].push_back(166500);ans[40600].push_back(168350);ans[41392].push_back(170625);ans[41500].push_back(170940);ans[41725].push_back(171600);ans[42250].push_back(173160);ans[42280].push_back(173250);ans[42800].push_back(174825);ans[43020].push_back(175500);ans[43125].push_back(175824);ans[44056].push_back(178750);ans[44500].push_back(180180);ans[44560].push_back(180375);ans[45000].push_back(181818);ans[45055].push_back(182000);ans[45400].push_back(183150);ans[45946].push_back(185000);ans[46000].push_back(185185);ans[46128].push_back(185625);ans[46375].push_back(186480);ans[47090].push_back(189000);ans[47500].push_back(190476);ans[48025].push_back(192400);ans[48052].push_back(192500);ans[48200].push_back(193050);ans[48520].push_back(194250);ans[48718].push_back(195000);ans[49125].push_back(196560);ans[49495].push_back(198000);ans[49950].push_back(199800);ans[100].push_back(200200);ans[1000].push_back(202020);ans[1720].push_back(203500);ans[2320].push_back(204750);ans[2500].push_back(205128);ans[2875].push_back(205920);ans[3475].push_back(207200);ans[3750].push_back(207792);ans[3800].push_back(207900);ans[3904].push_back(208125);ans[4762].push_back(210000);ans[5500].push_back(211640);ans[6400].push_back(213675);ans[6760].push_back(214500);ans[7500].push_back(216216);ans[7600].push_back(216450);ans[8425].push_back(218400);ans[8832].push_back(219375);ans[9000].push_back(219780);ans[9091].push_back(220000);ans[9910].push_back(222000);ans[10000].push_back(222222);ans[10625].push_back(223776);ans[11200].push_back(225225);ans[12088].push_back(227500);ans[12250].push_back(227920);ans[13375].push_back(230880);ans[13420].push_back(231000);ans[14200].push_back(233100);ans[14530].push_back(234000);ans[15344].push_back(236250);ans[15825].push_back(237600);ans[16000].push_back(238095);ans[16750].push_back(240240);ans[16840].push_back(240500);ans[17500].push_back(242424);ans[18100].push_back(244200);ans[18600].push_back(245700);ans[19192].push_back(247500);ans[19920].push_back(249750);ans[20080].push_back(250250);ans[20635].push_back(252000);ans[20800].push_back(252525);ans[21250].push_back(253968);ans[21376].push_back(254375);
59 ans[22000].push_back(256410);ans[22300].push_back(257400);ans[22780].push_back(259000);ans[23000].push_back(259740);ans[23040].push_back(259875);ans[23077].push_back(260000);ans[24400].push_back(264550);ans[24925].push_back(266400);ans[25408].push_back(268125);ans[25750].push_back(269360);ans[25926].push_back(270000);ans[26000].push_back(270270);ans[26740].push_back(273000);ans[26875].push_back(273504);ans[27200].push_back(274725);ans[27850].push_back(277200);ans[27928].push_back(277500);ans[28500].push_back(279720);ans[28775].push_back(280800);ans[29800].push_back(284900);ans[30000].push_back(285714);ans[30070].push_back(286000);ans[30625].push_back(288288);ans[30700].push_back(288600);ans[30736].push_back(288750);ans[31360].push_back(291375);ans[31624].push_back(292500);ans[31750].push_back(293040);ans[32500].push_back(296296);ans[32660].push_back(297000);ans[100].push_back(300300);ans[208].push_back(300625);ans[1000].push_back(303030);ans[1720].push_back(305250);ans[2320].push_back(307125);ans[2500].push_back(307692);ans[2875].push_back(308880);ans[3475].push_back(310800);ans[3750].push_back(311688);ans[3800].push_back(311850);ans[4762].push_back(315000);ans[5500].push_back(317460);ans[6760].push_back(321750);ans[7336].push_back(323750);ans[7500].push_back(324324);ans[7600].push_back(324675);ans[8425].push_back(327600);ans[9000].push_back(329670);ans[9091].push_back(330000);ans[9910].push_back(333000);ans[10000].push_back(333333);ans[10625].push_back(335664);ans[10900].push_back(336700);ans[12088].push_back(341250);ans[12250].push_back(341880);ans[13375].push_back(346320);ans[13420].push_back(346500);ans[14200].push_back(349650);ans[14530].push_back(351000);ans[15344].push_back(354375);ans[15760].push_back(356125);ans[15825].push_back(356400);ans[16084].push_back(357500);ans[16750].push_back(360360);ans[16840].push_back(360750);ans[17500].push_back(363636);ans[18100].push_back(366300);ans[18600].push_back(368550);ans[18919].push_back(370000);ans[19000].push_back(370370);ans[19192].push_back(371250);ans[19920].push_back(374625);ans[20080].push_back(375375);ans[20635].push_back(378000);ans[21250].push_back(380952);ans[22000].push_back(384615);ans[22078].push_back(385000);ans[22300].push_back(386100);ans[22780].push_back(388500);ans[23000].push_back(389610);ans[23077].push_back(390000);ans[24400].push_back(396825);ans[24925].push_back(399600);ans[100].push_back(400400);ans[1000].push_back(404040);ans[1720].push_back(407000);ans[2320].push_back(409500);ans[2500].push_back(410256);ans[2875].push_back(411840);ans[3475].push_back(414400);ans[3750].push_back(415584);ans[3800].push_back(415800);ans[3904].push_back(416250);ans[4762].push_back(420000);ans[4960].push_back(420875);ans[5500].push_back(423280);ans[6400].push_back(427350);ans[6760].push_back(429000);ans[7500].push_back(432432);ans[7600].push_back(432900);
60 ans[7648].push_back(433125);ans[8425].push_back(436800);ans[8832].push_back(438750);ans[9000].push_back(439560);ans[9091].push_back(440000);ans[9910].push_back(444000);ans[10000].push_back(444444);ans[10625].push_back(447552);ans[11200].push_back(450450);ans[12000].push_back(454545);ans[12088].push_back(455000);ans[12250].push_back(455840);ans[12640].push_back(457875);ans[13375].push_back(461760);ans[13420].push_back(462000);ans[14200].push_back(466200);ans[14530].push_back(468000);ans[15344].push_back(472500);ans[15825].push_back(475200);ans[16000].push_back(476190);ans[16750].push_back(480480);ans[16840].push_back(481000);ans[17120].push_back(482625);ans[17500].push_back(484848);ans[17632].push_back(485625);ans[18100].push_back(488400);ans[18600].push_back(491400);ans[19192].push_back(495000);ans[19920].push_back(499500);ans[100].push_back(500500);ans[1000].push_back(505050);ans[1720].push_back(508750);ans[2320].push_back(511875);ans[2500].push_back(512820);ans[2875].push_back(514800);ans[3475].push_back(518000);ans[3750].push_back(519480);ans[3800].push_back(519750);ans[4762].push_back(525000);ans[5500].push_back(529100);ans[6760].push_back(536250);ans[7500].push_back(540540);ans[7600].push_back(541125);ans[8425].push_back(546000);ans[9000].push_back(549450);ans[9091].push_back(550000);ans[9910].push_back(555000);ans[10000].push_back(555555);ans[10625].push_back(559440);ans[12088].push_back(568750);ans[12250].push_back(569800);ans[12500].push_back(571428);ans[13375].push_back(577200);ans[13420].push_back(577500);ans[14200].push_back(582750);ans[14530].push_back(585000);ans[15344].push_back(590625);ans[15625].push_back(592592);ans[15825].push_back(594000);ans[100].push_back(600600);ans[208].push_back(601250);ans[1000].push_back(606060);ans[1720].push_back(610500);ans[2320].push_back(614250);ans[2500].push_back(615384);ans[2875].push_back(617760);ans[3475].push_back(621600);ans[3750].push_back(623376);ans[3800].push_back(623700);ans[3904].push_back(624375);ans[4096].push_back(625625);ans[4762].push_back(630000);ans[5500].push_back(634920);ans[6400].push_back(641025);ans[6760].push_back(643500);ans[7336].push_back(647500);ans[7500].push_back(648648);ans[7600].push_back(649350);ans[8425].push_back(655200);ans[8832].push_back(658125);ans[9000].push_back(659340);ans[9091].push_back(660000);ans[9280].push_back(661375);ans[9910].push_back(666000);ans[10000].push_back(666666);ans[10625].push_back(671328);ans[10900].push_back(673400);ans[11200].push_back(675675);ans[12088].push_back(682500);ans[12250].push_back(683760);ans[13375].push_back(692640);ans[13420].push_back(693000);ans[14200].push_back(699300);ans[100].push_back(700700);ans[285].push_back(702000);ans[1000].push_back(707070);ans[1720].push_back(712250);ans[2000].push_back(714285);ans[2098].push_back(715000);ans[2320].push_back(716625);
61 ans[2500].push_back(717948);ans[2875].push_back(720720);ans[2980].push_back(721500);ans[3475].push_back(725200);ans[3750].push_back(727272);ans[3800].push_back(727650);ans[4450].push_back(732600);ans[4762].push_back(735000);ans[5500].push_back(740740);ans[5724].push_back(742500);ans[6760].push_back(750750);ans[7500].push_back(756756);ans[7600].push_back(757575);ans[8125].push_back(761904);ans[8272].push_back(763125);ans[8425].push_back(764400);ans[9000].push_back(769230);ans[9091].push_back(770000);ans[9350].push_back(772200);ans[9910].push_back(777000);ans[10000].push_back(777777);ans[10625].push_back(783216);ans[11800].push_back(793650);ans[12088].push_back(796250);ans[12250].push_back(797720);ans[100].push_back(800800);ans[544].push_back(804375);ans[1000].push_back(808080);ans[1720].push_back(814000);ans[2320].push_back(819000);ans[2500].push_back(820512);ans[2875].push_back(823680);ans[3475].push_back(828800);ans[3750].push_back(831168);ans[3800].push_back(831600);ans[3904].push_back(832500);ans[4762].push_back(840000);ans[4960].push_back(841750);ans[5500].push_back(846560);ans[6400].push_back(854700);ans[6760].push_back(858000);ans[7500].push_back(864864);ans[7600].push_back(865800);ans[7648].push_back(866250);ans[8425].push_back(873600);ans[8480].push_back(874125);ans[8832].push_back(877500);ans[9000].push_back(879120);ans[9091].push_back(880000);ans[9910].push_back(888000);ans[10000].push_back(888888);ans[10625].push_back(895104);ans[100].push_back(900900);ans[208].push_back(901875);ans[1000].push_back(909090);ans[1099].push_back(910000);ans[1720].push_back(915750);ans[2320].push_back(921375);ans[2500].push_back(923076);ans[2800].push_back(925925);ans[2875].push_back(926640);ans[3475].push_back(932400);ans[3750].push_back(935064);ans[3800].push_back(935550);ans[4762].push_back(945000);ans[5500].push_back(952380);ans[6445].push_back(962000);ans[6760].push_back(965250);ans[7336].push_back(971250);ans[7500].push_back(972972);ans[7600].push_back(974025);ans[8425].push_back(982800);ans[9000].push_back(989010);ans[9091].push_back(990000);ans[9910].push_back(999000);ans[10000].push_back(999999);ans[4400].push_back(1046025);ans[7020].push_back(1075500);ans[10000].push_back(1111111);ans[10375].push_back(1115760);ans[13960].push_back(1162250);ans[16318].push_back(1195000);ans[25616].push_back(1344375);ans[28300].push_back(1394700);ans[30265].push_back(1434000);ans[40250].push_back(1673640);ans[42640].push_back(1743375);ans[44212].push_back(1792500);ans[46225].push_back(1859600);ans[4400].push_back(2092050);ans[7020].push_back(2151000);ans[10000].push_back(2222222);ans[10375].push_back(2231520);ans[13960].push_back(2324500);ans[16318].push_back(2390000);ans[25616].push_back(2688750);ans[28300].push_back(2789400);ans[30265].push_back(2868000);ans[31168].push_back(2905625);ans[4400].push_back(3138075);
62 ans[7020].push_back(3226500);ans[10000].push_back(3333333);ans[10375].push_back(3347280);ans[13960].push_back(3486750);ans[16318].push_back(3585000);ans[4400].push_back(4184100);ans[7020].push_back(4302000);ans[10000].push_back(4444444);ans[10375].push_back(4463040);ans[13960].push_back(4649000);ans[16318].push_back(4780000);ans[4400].push_back(5230125);ans[7020].push_back(5377500);ans[10000].push_back(5555555);ans[10375].push_back(5578800);ans[13960].push_back(5811250);ans[16318].push_back(5975000);ans[4400].push_back(6276150);ans[7020].push_back(6453000);ans[10000].push_back(6666666);ans[10375].push_back(6694560);ans[13960].push_back(6973500);ans[2371].push_back(7170000);ans[4400].push_back(7322175);ans[7020].push_back(7528500);ans[10000].push_back(7777777);ans[10375].push_back(7810320);ans[4400].push_back(8368200);ans[7020].push_back(8604000);ans[8224].push_back(8716875);ans[10000].push_back(8888888);ans[10375].push_back(8926080);ans[3205].push_back(9298000);ans[4400].push_back(9414225);ans[7020].push_back(9679500);ans[10000].push_back(9999999);ans[10].push_back(10001000);ans[1000].push_back(10101010);ans[1360].push_back(10137875);ans[3640].push_back(10377750);ans[8750].push_back(10958904);ans[9100].push_back(11001100);ans[9580].push_back(11059500);ans[9991].push_back(11110000);ans[10000].push_back(11111111);ans[11120].push_back(11251125);ans[11524].push_back(11302500);ans[12400].push_back(11415525);ans[14375].push_back(11678832);ans[16675].push_back(12001200);ans[16978].push_back(12045000);ans[17500].push_back(12121212);ans[17800].push_back(12165450);ans[17875].push_back(12176560);ans[18897].push_back(12330000);ans[19700].push_back(12453300);ans[19992].push_back(12498750);ans[20008].push_back(12501250);ans[24250].push_back(13201320);ans[24650].push_back(13271400);ans[26270].push_back(13563000);ans[27000].push_back(13698630);ans[27280].push_back(13751375);ans[27664].push_back(13824375);ans[27730].push_back(13837000);ans[30815].push_back(14454000);ans[31500].push_back(14598540);ans[32185].push_back(14746000);ans[33340].push_back(15001500);ans[33643].push_back(15070000);ans[34000].push_back(15151515);ans[34300].push_back(15220700);ans[35760].push_back(15566625);ans[36875].push_back(15841584);ans[38125].push_back(16161616);ans[38350].push_back(16220600);ans[39400].push_back(16501650);ans[39720].push_back(16589250);ans[39775].push_back(16604400);ans[39994].push_back(16665000);ans[41016].push_back(16953750);ans[42184].push_back(17296250);ans[44450].push_back(18001800);ans[44652].push_back(18067500);ans[45000].push_back(18181818);ans[45200].push_back(18248175);ans[45250].push_back(18264840);ans[45748].push_back(18432500);ans[46672].push_back(18751875);ans[47440].push_back(19025875);ans[48625].push_back(19464720);ans[49500].push_back(19801980);ans[49995].push_back(19998000);ans[10].push_back(20002000);ans[1000].push_back(20202020);ans[1360].push_back(20275750);ans[3640].push_back(20755500);ans[8750].push_back(21917808);ans[9100].push_back(22002200);ans[9580].push_back(22119000);
63 ans[9991].push_back(22220000);ans[10000].push_back(22222222);ans[11120].push_back(22502250);ans[11524].push_back(22605000);ans[12400].push_back(22831050);ans[14375].push_back(23357664);ans[16675].push_back(24002400);ans[16978].push_back(24090000);ans[17500].push_back(24242424);ans[17800].push_back(24330900);ans[17875].push_back(24353120);ans[18897].push_back(24660000);ans[19200].push_back(24752475);ans[19700].push_back(24906600);ans[19992].push_back(24997500);ans[20008].push_back(25002500);ans[20800].push_back(25252525);ans[22912].push_back(25944375);ans[24250].push_back(26402640);ans[24650].push_back(26542800);ans[26270].push_back(27126000);ans[27000].push_back(27397260);ans[27280].push_back(27502750);ans[27664].push_back(27648750);ans[27730].push_back(27674000);ans[30815].push_back(28908000);ans[31500].push_back(29197080);ans[32185].push_back(29492000);ans[10].push_back(30003000);ans[1000].push_back(30303030);ans[1360].push_back(30413625);ans[1450].push_back(30441400);ans[3640].push_back(31133250);ans[7525].push_back(32441200);ans[8750].push_back(32876712);ans[9100].push_back(33003300);ans[9580].push_back(33178500);ans[9991].push_back(33330000);ans[10000].push_back(33333333);ans[11120].push_back(33753375);ans[11524].push_back(33907500);ans[12400].push_back(34246575);ans[13276].push_back(34592500);ans[14375].push_back(35036496);ans[16675].push_back(36003600);ans[16978].push_back(36135000);ans[17500].push_back(36363636);ans[17800].push_back(36496350);ans[17875].push_back(36529680);ans[18622].push_back(36865000);ans[18897].push_back(36990000);ans[19700].push_back(37359900);ans[19992].push_back(37496250);ans[20008].push_back(37503750);ans[21160].push_back(38051750);ans[24250].push_back(39603960);ans[24650].push_back(39814200);ans[10].push_back(40004000);ans[1000].push_back(40404040);ans[1360].push_back(40551500);ans[3040].push_back(41254125);ans[3552].push_back(41473125);ans[3640].push_back(41511000);ans[8750].push_back(43835616);ans[9100].push_back(44004400);ans[9580].push_back(44238000);ans[9991].push_back(44440000);ans[10000].push_back(44444444);ans[11120].push_back(45004500);ans[11524].push_back(45210000);ans[12000].push_back(45454545);ans[12400].push_back(45662100);ans[14375].push_back(46715328);ans[16675].push_back(48004800);ans[16978].push_back(48180000);ans[17500].push_back(48484848);ans[17800].push_back(48661800);ans[17875].push_back(48706240);ans[18897].push_back(49320000);ans[19200].push_back(49504950);ans[19700].push_back(49813200);ans[19992].push_back(49995000);ans[10].push_back(50005000);ans[1000].push_back(50505050);ans[1360].push_back(50689375);ans[3640].push_back(51888750);ans[8750].push_back(54794520);ans[9100].push_back(55005500);ans[9580].push_back(55297500);ans[9991].push_back(55550000);ans[10000].push_back(55555555);ans[11120].push_back(56255625);ans[11524].push_back(56512500);ans[12400].push_back(57077625);ans[14375].push_back(58394160);ans[10].push_back(60006000);ans[1000].push_back(60606060);ans[1360].push_back(60827250);ans[1450].push_back(60882800);ans[3640].push_back(62266500);
64 ans[7525].push_back(64882400);ans[8750].push_back(65753424);ans[9100].push_back(66006600);ans[9580].push_back(66357000);ans[9991].push_back(66660000);ans[10000].push_back(66666666);ans[11120].push_back(67506750);ans[11524].push_back(67815000);ans[12400].push_back(68493150);ans[12736].push_back(68756875);ans[13276].push_back(69185000);ans[10].push_back(70007000);ans[1000].push_back(70707070);ans[1360].push_back(70965125);ans[3141].push_back(72270000);ans[3640].push_back(72644250);ans[3750].push_back(72727272);ans[4100].push_back(72992700);ans[5059].push_back(73730000);ans[6676].push_back(75007500);ans[7600].push_back(75757575);ans[8020].push_back(76103500);ans[8750].push_back(76712328);ans[9100].push_back(77007700);ans[9580].push_back(77416500);ans[9991].push_back(77770000);ans[10000].push_back(77777777);ans[10064].push_back(77833125);ans[11120].push_back(78757875);ans[11524].push_back(79117500);ans[11625].push_back(79207920);ans[12400].push_back(79908675);ans[10].push_back(80008000);ans[1000].push_back(80808080);ans[1360].push_back(81103000);ans[3040].push_back(82508250);ans[3552].push_back(82946250);ans[3640].push_back(83022000);ans[8750].push_back(87671232);ans[9100].push_back(88008800);ans[9580].push_back(88476000);ans[9991].push_back(88880000);ans[10000].push_back(88888888);ans[10].push_back(90009000);ans[1000].push_back(90909090);ans[1360].push_back(91240875);ans[1450].push_back(91324200);ans[3640].push_back(93399750);ans[5392].push_back(95129375);ans[7525].push_back(97323600);ans[8750].push_back(98630136);ans[9100].push_back(99009900);ans[9580].push_back(99535500);ans[9991].push_back(99990000);ans[10000].push_back(99999999);
65 }
66 
67 int main() {
68 
69     init() ;
70     double n ;
71     while( scanf("%lf" , &n ) == 1 ) {
72         int a = (int)( n * 10000 + 0.5 ) ;
73         if( ans[a].size() == 0 ) printf("No solution\n") ;
74         else {
75             for( int i = 0 ; i < ans[a].size() ; i ++ ) {
76                 printf("%d\n" , ans[a][i] ) ;
77             }
78         }
79     }
80 
81     return 0 ;
82 }
View Code

 

 

csuoj 1392: Number Trick

标签:

原文地址:http://www.cnblogs.com/jeff-wgc/p/4474830.html

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