Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <map>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. int n;
  9. cin >> n;
  10. long long cityOne = 100000, cityTwo = 200000, res = 0;
  11. while (n) {
  12. res += cityOne + cityTwo;
  13. if (cityOne < cityTwo) {
  14. cityOne += cityTwo;
  15. } else {
  16. cityTwo += cityOne;
  17. }
  18. n--;
  19. }
  20. if (cityOne > cityTwo) {
  21. cout << cityOne;
  22. } else {
  23. cout << cityTwo;
  24. }
  25. cout << " " << res;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement