Advertisement
Saleh127

at 106C

Oct 25th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5.  
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);
  10. cout.tie(0);
  11.  
  12. ll n,a,c,d,e=1,f,i,j=1;
  13. cin>>n;
  14.  
  15. ll x[100]={0},y[100]={0};
  16.  
  17. x[0]=1;
  18. y[0]=1;
  19. for(i=1; i<=37; i++)
  20. {
  21. e*=3;
  22. x[i]=e;
  23. }
  24. for(i=1; i<=25; i++)
  25. {
  26. j*=5;
  27. y[i]=j;
  28. }
  29. for(i=1;i<38;i++)
  30. {
  31. a=n-x[i];
  32. if(a>0)
  33. {
  34. for(j=1;j<26;j++)
  35. {
  36. if(y[j]==a)
  37. {
  38. cout<<i<<" "<<j<<endl;
  39. return 0;
  40. }
  41. }
  42. }
  43. else break;
  44. }
  45. for(i=1;i<26;i++)
  46. {
  47. a=n-y[i];
  48. if(a>0)
  49. {
  50. for(j=1;j<38;j++)
  51. {
  52. if(x[j]==a)
  53. {
  54. cout<<j<<" "<<i<<endl;
  55. return 0;
  56. }
  57. }
  58. }
  59. else break;
  60. }
  61. cout<<-1<<endl;
  62. return 0;
  63. }
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement