fork(1) download
  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4. #include <iostream>
  5. using namespace std;
  6. int main()
  7. {
  8.  
  9. int t;
  10. #ifndef ONLINE_JUDGE
  11. freopen("a.txt", "r" , stdin);
  12. freopen("1.out", "w", stdout);
  13. #endif
  14. scanf("%d", &t);
  15. long int k[t];
  16. for(int p=0; p<t; p++)
  17. {
  18. scanf("%ld", &k[p]);
  19. k[p]+=1;
  20. //printf("%ld",k[p]);
  21. }
  22. for(int q=0; q<t; q++)
  23. {
  24. int flag=0;
  25. do
  26. {
  27. char s[100];
  28. //itoa(k[q], s, 10);
  29. sprintf(s, "%ld", k[q]);
  30. //cout<<s;
  31. /*string t;
  32. getline(cin, t);
  33. cout<<t;*/
  34.  
  35. int l=strlen(s);
  36. //cout<<"\n l="<<l;
  37. char r[100];
  38. int i, j;
  39. //cout<<endl;
  40. for(i=l-1, j=0; i>=0; i--, j++)
  41. {
  42. r[j]=s[i];
  43. //cout<<r[j];
  44. }
  45. r[j]='\0';
  46. //cout<<"\n r="<<r;
  47. if(strcmp(s, r) == 0)
  48. {
  49. flag=1;
  50. printf("\n%s", s);
  51. }
  52. else
  53. {
  54. k[q]=atol(s);
  55. k[q]=k[q]+1;
  56. }
  57. }while(flag != 1);
  58. flag=0;
  59. }
  60. //cout<<endl;
  61. return 0;
  62. }
  63.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Standard output is empty