Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. #include <cmath>
  5. long double arithProgSum(long double firstElement, long double lastElement, long double n);
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int n;
  11.     cin >> n;
  12.     n < 5 ? cout << fixed << setprecision(0) << (pow(10.0f, n) - pow(10.0f, n - 1)) * (pow(10.0f, n - 1) + (pow(10.0f, n) - 1)) / 2 << endl : cout << "4949" << string(n - 4, '9') << "55" << string(n - 2, '0') << endl;
  13.     return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement