Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. int main() {
  2.  
  3. unsigned long int n,p,max;
  4. int t,i,j;
  5. scanf("%d",&t);
  6.  
  7. for(i=1000000; i>=10000; i--){
  8. mozeSeDobitKaoProizvodTrocifrenih[i] = 0;
  9. }
  10.  
  11. for(i=999; i>=100; i--){
  12. for(j=999; j>=100; j--){
  13. p=i*j;
  14. mozeSeDobitKaoProizvodTrocifrenih[p] = 1;
  15. }
  16. }
  17.  
  18. rezultat[9999] = 0;
  19. for(i=10000; i<=1000000; i++){
  20. if ( mozeSeDobitKaoProizvodTrocifrenih[i] == 1 && isPalindrome(i) == 1 ){
  21. rezultat[i] = i;
  22. }else{
  23. rezultat[i] = rezultat[i-1];
  24. }
  25. }
  26. }
  27.  
  28. while(t){
  29. scanf("%ld",&n);
  30. printf("%ld\n",rezultat[n-1]);
  31.  
  32. t--;
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement