Advertisement
Luckytoef

Untitled

Apr 2nd, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. std::ifstream f("siruri2.in");
  4. std::ofstream g("siruri2.out");
  5.  
  6. long long divi(long long n)
  7. {
  8.     long long d=2, p, P=1;
  9.     while(n>1)
  10.     {
  11.         p=0;
  12.         while(n%d==0)
  13.         {
  14.             p++;
  15.             n/=d;
  16.         }
  17.         if(p)
  18.             P*=(p+1);
  19.         d++;
  20.         if(d*d>n)
  21.             d=n;
  22.     }
  23.     return P;
  24. }
  25. long long ogl(long long n)
  26. {
  27.     long long xo=0;
  28.     while(n)
  29.     {
  30.         xo = xo * 10 + n%10;
  31.         n/=10;
  32.     }
  33.     return xo;
  34. }
  35.  
  36. int main()
  37. {
  38.     int T, n;
  39.     long long a=1, b=1, c=0;
  40.     f >> T >> n;
  41.     if(n<=2)
  42.         g<<1<<" "<<1;
  43.     else if(T == 1)
  44.     {
  45.         for(int i=3;i<=n; i++)
  46.         {
  47.             c=a+b;
  48.             a=b;
  49.             b=c;
  50.         }
  51.         g<<c<<" "<<divi(c);
  52.     }
  53.     else if(T == 2)
  54.     {
  55.         for(int i=3;i<=n; i++)
  56.         {
  57.             c=a+b;
  58.             a=b;
  59.             b=ogl(c);
  60.         }
  61.         g<<c<<" "<<divi(c);
  62.     }
  63.     return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement