Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. /*
  2. ID: antrian2
  3. TASK: palsquare
  4. LANG: C++
  5. */
  6. #include <iostream>
  7. #include <fstream>
  8. #include <cmath>
  9. #include <string>
  10. using namespace std;
  11.  
  12. int main()
  13. {
  14. //ifstream fin("palsquare.in");
  15. //ofstream fout("palsquare.out");
  16. int b,i;
  17. cin>>b;
  18. string fires[2][301];
  19. string ar[301][2];
  20. int ari[301];
  21. string z,m;
  22. for(int i=0;i<300;i++)
  23. {
  24. ari[i]=0;
  25. }
  26. for(i=1;i<=300;i++)
  27. {
  28. int j=0;
  29. int k=i;
  30. bool turtles=true;
  31. while(turtles)
  32. {
  33. if(k<b)
  34. {
  35. turtles=false;
  36. }
  37. if(j==fires[0][i-1].size())cout<<"DAME\n";
  38. fires[0][i-1].at(j)=k%b;
  39. k=k/b;
  40. j++;
  41. }
  42. j=0;
  43. k=i*i;
  44. turtles=true;
  45. while(turtles)
  46. {
  47. if(k<b)
  48. {
  49. turtles=false;
  50. }
  51. if(j== fires[1][i-1].size())cout<<"DAME\n";
  52. fires[1][i-1].at(j)=k%b;
  53. k=k/b;
  54. j++;
  55. }
  56. turtles=true;
  57. int kl=0;
  58. while(kl<j)
  59. {
  60. if(fires[1][i-1][kl]!=fires[1][i-1][j])
  61. {
  62. turtles=false;
  63. }
  64. kl++;
  65. j--;
  66. }
  67. if(turtles)
  68. {
  69. ar[i-1][0]=fires[0][i-1];
  70. ar[i-1][1]=fires[1][i-1];
  71. ari[i-1]=1;
  72. }
  73. }
  74. for(int i=0;i<300;i++)
  75. {
  76. if(ari[i]==1)
  77. {
  78. cout<<ar[i][0]<<ar[i][1]<<"\n";
  79. }
  80. }
  81. // fin.close();
  82. // fout.close();
  83. return 0;
  84.  
  85.  
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement