fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct data
  5. {
  6. long long leng;
  7. long long Sd;
  8. long long Sg;
  9. long long Sc;
  10. };
  11. struct data S[200];
  12. void khoitao ()
  13. {
  14. S[0].leng=3;
  15. S[0].Sd=0;
  16. S[0].Sg=3;
  17. S[0].Sc=3;
  18. }
  19.  
  20. char Dequy (long long n, int cs)
  21. {
  22. if (1<=n && n<=S[cs].Sd) return Dequy (n, cs-1);
  23. else if (S[cs].Sd<n && n<=S[cs].Sg)
  24. {
  25. n=n-S[cs].Sd;
  26. if (n==1) return 'm';
  27. else return 'o';
  28. }
  29. else if (S[cs].Sg<n && n<=S[cs].Sc)
  30. {
  31. n=n-S[cs].Sg;
  32. return Dequy (n, cs-1);
  33. }
  34. }
  35.  
  36. int main ()
  37. {
  38. khoitao();
  39. int i=0;
  40. long long N;
  41. cin>>N;
  42. while (1)
  43. {
  44. if (S[i].leng>=N) break;
  45. i++;
  46. S[i].Sd=0+S[i-1].leng;
  47. S[i].Sg=S[i].Sd+1+i+2;
  48. S[i].Sc=S[i].Sg+S[i-1].leng;
  49. S[i].leng=S[i].Sc;
  50. }
  51. cout<<Dequy (N, i);
  52.  
  53. return 0;
  54. }
Success #stdin #stdout 0s 15240KB
stdin
1000000000
stdout
o