Advertisement
erfanul007

UVa 11000

Mar 12th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef unsigned long long int ull;
  5. typedef long long int ll;
  6. typedef vector<int> vi;
  7. typedef vector<ll> vll;
  8. typedef pair<int,int > pii;
  9. typedef vector< pii > vpii;
  10.  
  11. #define sc scanf
  12. //#define pf printf
  13. #define sci(n) scanf("%d",&n)
  14. #define scl(n) scanf("%lld",&n)
  15. #define scd(n) scanf("%lf",&n)
  16. #define scs(s) scanf("%s",s)
  17. #define pfi(n) printf("%d",n)
  18. #define pfl(n) printf("%lld",n)
  19. #define pff(n) cout<<n
  20. #define line printf("\n")
  21. #define spc printf(" ")
  22. #define loop(i,x,y) for(int i=int(x); i<=int(y); i++)
  23. #define rloop(i,y,x) for(int i=int(y); i>=int(x); i--)
  24. #define cspf(i) printf("Pair #%d: ", i)
  25. #define pb push_back
  26. #define mp make_pair
  27. #define ff first
  28. #define ss second
  29. #define all(v) v.begin(),v.end()
  30. #define rall(v) v.rbegin(),v.rend()
  31. #define read() freopen("input.txt", "r", stdin)
  32. #define write() freopen("output.txt", "w", stdout)
  33. /// Constants
  34. #define eps 1e-9
  35. #define inf (1e6)+9
  36. #define PI acos(-1.0) // 3.1415926535897932
  37. #define MAX 1000009
  38.  
  39.  
  40. int main()
  41. {
  42. ll pm=0,pf=1;
  43. ll male[100],total[100];
  44. male[0]=0;
  45. total[0]=1;
  46. loop(i,1,50){
  47. male[i]=male[i-1]+(pm+pf);
  48. total[i]=total[i-1]+(pm+pm+pf);
  49. ll f=pf;
  50. pf=pm;
  51. pm=pm+f;
  52.  
  53. }
  54. int n;
  55. while(1){
  56. cin>>n;
  57. if(n<0) break;
  58. cout<<male[n]<<" "<<total[n]<<endl;
  59. }
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement