daily pastebin goal
0%
SHARE
TWEET

Ilya ( Mars )

a guest Jan 18th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string s; cin >> s;
  2.     ll res = 0, ll l=0;
  3.     for (ll i = 0; i < s.size(); ++i)
  4.     {
  5.         if (s[i] - '0' < 1 || s[i] - '0'> 9)
  6.         {
  7.             ++res;
  8.             ++l;
  9.         }
  10.         else
  11.         {
  12.             string ch;
  13.             ll sz = 0;
  14.             for (; i < s.size(); ++i)
  15.             {
  16.                 if (s[i] - '0' < 0 || s[i] - '0'> 9)
  17.                     break;
  18.                 else ch += s[i];
  19.             }
  20.             for (; i < s.size(); ++i)
  21.             {
  22.                 if (s[i] - '0' >= 1 && s[i] - '0' <= 9)
  23.                     break;
  24.                 ++sz;
  25.             }
  26.             --i;
  27.             v.push_back({ stoll(ch),{ch.size(),sz} });
  28.         }
  29.     }
  30.     ll sum = 0;
  31.     for (ll i = l; i < v.size()-1; ++i)
  32.     {
  33.         ll fir = v[i].first*v[i].second.second + v[i+1].first*v[i+1].second.second;
  34.         ll sec = v[i].first*(v[i].second.second+v[i+1].second.first+v[i+1].second.second);
  35.         if (sec > fir)
  36.         {
  37.             v[i + 1].first = ticonst;
  38.             v[i + 1].second.first = ticonst;
  39.             v[i + 1].second.second = ticonst;
  40.         }
  41.     }
  42.     return 0;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top