Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include <cmath>
- using namespace std;
- int main() {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- string str;
- long long f = 0, q = 0;
- int fl = 0, ql = 0;
- while (getline(cin, str)) {
- int i = 0;
- string tmp;
- for (; str[i] != '.'; ++i) {
- tmp = tmp + str[i];
- }
- i++;
- f += stoll(tmp);
- tmp = "";
- for (; i < str.length(); ++i) {
- tmp = tmp + str[i];
- }
- q += stoll(tmp);
- }
- fl = to_string(f).length();
- f += q / pow(10, 15);
- q = q % (long long)pow(10, 15);
- ql = to_string(q).length();
- cout << f << ".";
- for (int j = 0; j < 15 - ql; ++j) {
- cout << 0;
- }
- cout << q;
- //cout << setprecision(15);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement