Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

真心变态。。。。。2分模都过不去只好打表了。。不过不用打完,其实还是有规律的

Posted by 20092134 at 2011-07-17 04:43:50 on Problem 2720
只有一个ans[101][11]的数组吧,发现当i大于10时其实数字肯定是重复的。。所以i>10?10:i接可以了。。。
#include<stdio.h>
int f[9];
int ans[111][12]={
{0,1,1,1,1,1,1,1,1,1,1,1,},
{0,2,4,16,65536,19156736,37428736,21748736,60948736,12948736,32948736,32948736,},
{0,3,27,97484987,739387,60355387,26595387,195387,4195387,64195387,64195387,64195387,},
{0,4,256,6084096,61392896,64208896,5328896,63728896,51728896,11728896,11728896,11728896,},
{0,5,3125,8203125,8203125,8203125,8203125,8203125,8203125,8203125,8203125,8203125,},
{0,6,46656,63878656,38438656,43238656,27238656,47238656,47238656,47238656,47238656,47238656,},
{0,7,823543,70132343,33172343,65172343,65172343,65172343,65172343,65172343,65172343,65172343,},
{0,8,16777216,21126656,19449856,97945856,56825856,43225856,35225856,95225856,95225856,95225856,},
{0,9,87420489,27177289,45865289,31945289,64745289,12745289,92745289,92745289,92745289,92745289,},
{0,10,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
{0,11,11670611,72906611,87066611,36666611,12666611,72666611,72666611,72666611,72666611,72666611,},
{0,12,448256,95094016,97596416,54172416,92412416,70012416,94012416,54012416,54012416,54012416,},
{0,13,6592253,88549053,44325053,84645053,27045053,95045053,55045053,55045053,55045053,55045053,},
{0,14,25558016,54651136,98510336,60782336,12302336,35502336,47502336,67502336,67502336,67502336,},
{0,15,80859375,80859375,80859375,80859375,80859375,80859375,80859375,80859375,80859375,80859375,},
{0,16,9551616,70255616,20015616,14415616,50415616,90415616,90415616,90415616,90415616,90415616,},
{0,17,36764177,74229777,39125777,26485777,44085777,60085777,20085777,20085777,20085777,20085777,},
{0,18,37575424,40542976,92395776,66315776,54315776,54315776,54315776,54315776,54315776,54315776,},
{0,19,89123979,90459179,73483179,12363179,97963179,69963179,9963179,9963179,9963179,9963179,},
{0,20,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
{0,21,81124421,4492421,5452421,16652421,80652421,60652421,60652421,60652421,60652421,60652421,},
{0,22,46723584,97785856,53092096,58608896,8784896,61104896,23504896,91504896,51504896,51504896,},
{0,23,32910567,74988647,81606247,59078247,74918247,99718247,55718247,75718247,75718247,75718247,},
{0,24,72843776,58014976,44734976,76734976,76734976,76734976,76734976,76734976,76734976,76734976,},
{0,25,47265625,47265625,47265625,47265625,47265625,47265625,47265625,47265625,47265625,47265625,},
{0,26,203776,84203776,84203776,84203776,84203776,84203776,84203776,84203776,84203776,84203776,},
{0,27,49892803,20403683,57450083,71242083,77002083,9802083,93802083,13802083,13802083,13802083,},
{0,28,5812736,52791296,98986496,63370496,72650496,30250496,22250496,62250496,62250496,62250496,},
{0,29,26483469,93310669,3646669,71326669,89726669,81726669,41726669,41726669,41726669,41726669,},
{0,30,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
{0,31,44734431,49246431,35006431,99806431,3806431,23806431,23806431,23806431,23806431,23806431,},
{0,32,32542976,31314176,61074176,9074176,9074176,9074176,9074176,9074176,9074176,9074176,},
{0,33,83380513,83623713,31111713,69031713,41831713,93831713,73831713,73831713,73831713,73831713,},
{0,34,9569536,38863616,99874816,79842816,31362816,84162816,76162816,56162816,56162816,56162816,},
{0,35,35546875,98046875,48046875,48046875,48046875,48046875,48046875,48046875,48046875,48046875,},
{0,36,59291136,66747136,84507136,34107136,50107136,10107136,10107136,10107136,10107136,10107136,},
{0,37,99442517,79296917,34528917,59488917,48288917,12288917,32288917,32288917,32288917,32288917,},
{0,38,64610304,9627136,74242816,3094016,54102016,20822016,65622016,97622016,77622016,77622016,},
{0,39,9951959,59516759,96028759,1308759,24508759,32508759,52508759,52508759,52508759,52508759,},
{0,40,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
{0,41,37953641,34977641,95137641,29537641,25537641,65537641,65537641,65537641,65537641,65537641,},
{0,42,33016064,81994496,51891456,15904256,24608256,83328256,12928256,40928256,80928256,80928256,},
{0,43,98995507,50561107,74801107,70801107,70801107,70801107,70801107,70801107,70801107,70801107,},
{0,44,89367296,61165056,27577856,51961856,83481856,29081856,97081856,37081856,37081856,37081856,},
{0,45,73828125,48828125,48828125,48828125,48828125,48828125,48828125,48828125,48828125,48828125,},
{0,46,53181696,3229696,88989696,80189696,24189696,4189696,4189696,4189696,4189696,4189696,},
{0,47,85062863,44457423,37123023,68579023,91139023,96739023,52739023,12739023,12739023,12739023,},
{0,48,52403456,76161536,27054336,33102336,32782336,1582336,9582336,89582336,89582336,89582336,},
{0,49,25062449,62182449,18182449,18182449,18182449,18182449,18182449,18182449,18182449,18182449,},
{0,50,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
{0,51,31315051,65815051,15815051,15815051,15815051,15815051,15815051,15815051,15815051,15815051,},
{0,52,7575296,43348736,37691136,57595136,97435136,63835136,7835136,47835136,47835136,47835136,},
{0,53,56150373,56305573,96977573,6897573,58097573,90097573,10097573,10097573,10097573,10097573,},
{0,54,83789056,70167296,75332096,21028096,42948096,41348096,9348096,69348096,69348096,69348096,},
{0,55,65234375,15234375,15234375,15234375,15234375,15234375,15234375,15234375,15234375,15234375,},
{0,56,50323456,63315456,48275456,73075456,97075456,17075456,17075456,17075456,17075456,17075456,},
{0,57,55688057,79688057,79688057,79688057,79688057,79688057,79688057,79688057,79688057,79688057,},
{0,58,21097984,69904896,1190656,16179456,77523456,56243456,9843456,77843456,17843456,17843456,},
{0,59,52427939,58732739,80540739,28220739,21020739,9020739,89020739,89020739,89020739,89020739,},
{0,60,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
{0,61,60431661,99207661,62567661,12167661,68167661,28167661,28167661,28167661,28167661,28167661,},
{0,62,4466944,65959936,16879616,20674816,50402816,68322816,17122816,49122816,29122816,29122816,},
{0,63,38342847,4850367,34123967,84171967,16811967,12011967,48011967,28011967,28011967,28011967,},
{0,64,90306816,48398336,78465536,57057536,54177536,57377536,9377536,29377536,29377536,29377536,},
{0,65,37890625,37890625,37890625,37890625,37890625,37890625,37890625,37890625,37890625,37890625,},
{0,66,53244416,4988416,87548416,61948416,17948416,57948416,57948416,57948416,57948416,57948416,},
{0,67,52277723,23133563,30535163,97319163,61479163,99879163,15879163,55879163,55879163,55879163,},
{0,68,93733376,16677376,8677376,8677376,8677376,8677376,8677376,8677376,8677376,8677376,},
{0,69,1741429,31912629,17416629,81096629,66696629,18696629,58696629,58696629,58696629,58696629,},
{0,70,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
{0,71,29996471,36924471,55484471,26684471,50684471,30684471,30684471,30684471,30684471,30684471,},
{0,72,22313216,83421696,86007296,2839296,5879296,74679296,10679296,30679296,30679296,30679296,},
{0,73,62013833,26922633,45866633,92586633,86186633,54186633,94186633,94186633,94186633,94186633,},
{0,74,36312576,47666176,28146176,92146176,92146176,92146176,92146176,92146176,92146176,92146176,},
{0,75,44921875,57421875,7421875,7421875,7421875,7421875,7421875,7421875,7421875,7421875,},
{0,76,94552576,62552576,62552576,62552576,62552576,62552576,62552576,62552576,62552576,62552576,},
{0,77,30996797,13587197,48115197,9075197,56275197,60275197,40275197,40275197,40275197,40275197,},
{0,78,43454464,92576256,23799296,91780096,28196096,52516096,58916096,86916096,46916096,46916096,},
{0,79,39775919,36787119,94003119,88883119,47283119,59283119,19283119,19283119,19283119,19283119,},
{0,80,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
{0,81,71782481,70054481,22214481,7014481,51014481,71014481,71014481,71014481,71014481,71014481,},
{0,82,78388224,66066176,64472576,72952576,8952576,8952576,8952576,8952576,8952576,8952576,},
{0,83,12640587,52904427,23294827,26718827,72158827,98558827,82558827,22558827,22558827,22558827,},
{0,84,99118336,57058816,83382016,24470016,82390016,95190016,47190016,27190016,27190016,27190016,},
{0,85,14453125,39453125,39453125,39453125,39453125,39453125,39453125,39453125,39453125,39453125,},
{0,86,76935936,58631936,19591936,69191936,65191936,25191936,25191936,25191936,25191936,25191936,},
{0,87,54601383,40632103,56670503,77918503,48478503,91678503,95678503,75678503,75678503,75678503,},
{0,88,79786496,85698816,27919616,57871616,48751616,15951616,83951616,3951616,3951616,3951616,},
{0,89,92384409,53741209,19373209,91053209,94253209,62253209,82253209,82253209,82253209,82253209,},
{0,90,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
{0,91,36642691,18006691,24966691,39366691,55366691,95366691,95366691,95366691,95366691,95366691,},
{0,92,33364736,4237056,12262656,47910656,47750656,74950656,50950656,30950656,30950656,30950656,},
{0,93,36482893,27002893,95002893,95002893,95002893,95002893,95002893,95002893,95002893,95002893,},
{0,94,61956096,66944256,7021056,66285056,5005056,50605056,38605056,78605056,78605056,78605056,},
{0,95,49609375,49609375,49609375,49609375,49609375,49609375,49609375,49609375,49609375,49609375,},
{0,96,37162496,80170496,99530496,50730496,54730496,34730496,34730496,34730496,34730496,34730496,},
{0,97,85744737,22058337,74922337,46282337,32682337,68682337,8682337,8682337,8682337,8682337,},
{0,98,91295744,13961216,57748736,44263936,71015936,74535936,69735936,21735936,41735936,41735936,},
{0,99,499899,47479899,45479899,45479899,45479899,45479899,45479899,45479899,45479899,45479899,},
{0,100,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
{0,101,510101,1510101,1510101,1510101,1510101,1510101,1510101,1510101,1510101,1510101,},
{0,102,20251904,55497216,55086336,39169536,32321536,39041536,78241536,90241536,10241536,10241536,},
{0,103,81176727,68171287,75953687,80849687,80689687,34289687,78289687,38289687,38289687,38289687,},
{0,104,25977856,88970496,5751296,95927296,42647296,81047296,29047296,89047296,89047296,89047296,},
{0,105,78515625,78515625,78515625,78515625,78515625,78515625,78515625,78515625,78515625,78515625,},
{0,106,14080256,58432256,25792256,70592256,34592256,54592256,54592256,54592256,54592256,54592256,},
{0,107,44217843,68513043,39153043,87153043,87153043,87153043,87153043,87153043,87153043,87153043,},
{0,108,69346816,56505856,23885056,18701056,14381056,60781056,32781056,92781056,92781056,92781056,},
{0,109,10135389,32028189,32156189,25436189,78236189,6236189,86236189,86236189,86236189,86236189,},
{0,110,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
{0,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,100000000,},
};
__int64 abmodn( __int64 a, __int64 b, __int64 n )
{
     __int64 ans=1,t=1;
	 
     for(;b!=0;b=b/2)
     {  if ( b%2==1 )
              ans = (ans*a)%n;
         a = a * a % n;
     }
	 return ans;         
}
void find()
{int b,j;
  __int64 k;
	for(b=1;b<=110;b++)
	{k=1;
		for(j=1;j<=100;j++)
	 {
		 k=abmodn((__int64)b,k,100000000);
		 if(k==0)k=(__int64)100000000;
		 ans[b][j]=(int)k;
	}
	}
}
void jisuan2(int ans)
{   int i;
    
	for(i=0;i<9;i++)
	{
		f[i]=(int)ans%10;
		ans=ans/10;
	}
}
int main()
{   int b,i,n,j;
//	freopen("data.in","r",stdin);
//	freopen("data.out","w",stdout);
	while(scanf("%d",&b)&&b){
	 scanf("%d%d",&i,&n);
//	 find();打成表,直接计算居然TLE了,想不通啊!!!!
	 if(i>11) i=11;
	 jisuan2(ans[b-1][i]);
	 for(i=n-1;i>=0;i--)
		  printf("%d",f[i]);
	  printf("\n");
	  //之前用来打表的
/*	  for(i=1;i<=111;i++)
	  {  printf("{0,");
		  for(j=1;j<=11;j++)
			  printf("%d,",ans[i][j]);
		  printf("},\n");
		  int k;
		 // scanf("%d",&k);
	  }*/
	}      	
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator