fork 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. scanf("%d", &t);
  11. long int k[t];
  12. for(int p=0; p<t; p++)
  13. {
  14. scanf("%ld", &k[p]);
  15. k[p]+=1;
  16. //printf("%ld",k[p]);
  17. }
  18. for(int q=0; q<t; q++)
  19. {
  20. int flag=0;
  21. do
  22. {
  23. char s[100];
  24. //itoa(k[q], s, 10);
  25. sprintf(s, "%ld", k[q]);
  26. //cout<<s;
  27. /*string t;
  28. getline(cin, t);
  29. cout<<t;*/
  30.  
  31. int l=strlen(s);
  32. //cout<<"\n l="<<l;
  33. char r[100];
  34. int i, j;
  35. //cout<<endl;
  36. for(i=l-1, j=0; i>=0; i--, j++)
  37. {
  38. r[j]=s[i];
  39. //cout<<r[j];
  40. }
  41. r[j]='\0';
  42. //cout<<"\n r="<<r;
  43. if(strcmp(s, r) == 0)
  44. {
  45. flag=1;
  46. printf("\n%s", s);
  47. }
  48. else
  49. {
  50. k[q]=atol(s);
  51. k[q]=k[q]+1;
  52. }
  53. }while(flag != 1);
  54. flag=0;
  55. }
  56. //cout<<endl;
  57. return 0;
  58. }
  59.  
Time limit exceeded #stdin #stdout 5s 3340KB
stdin
1
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
stdout
Standard output is empty