Saleh127

UVA 11000

Aug 6th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);
  7. cout.tie(0);
  8.  
  9. long long a[200000],c[200000],d,e,f,i,j,k,l;
  10. while(scanf("%lld",&d)==1 && d>=0)
  11. {
  12. a[0]=0;
  13. a[1]=1;
  14. c[0]=1;
  15. for(i=2; i<=d+3; i++)
  16. {
  17. a[i]=a[i-1]+a[i-2];
  18. }
  19. for(i=1; i<=d+3; i++)
  20. {
  21. c[i]=c[i-1]+a[i+1];
  22. }
  23. cout<<c[d]-a[d+1]<<" "<<c[d]<<endl;
  24. }
  25. return 0;
  26. }
  27.  
Add Comment
Please, Sign In to add comment