Untitled
unknown
plain_text
a year ago
579 B
8
Indexable
Never
#include <iostream> using namespace std; int main() { char a[50]{ 0 }; cin >> a; int m=0; int u; int summ = 0; for (int i = 1; i < 50; i+=2) { if (m<int(a[i])) { m = int(a[i]); u = i; } } for (int g = u; g < 49; ++g) { a[g] = a[g + 1]; if (g == 48) { a[g + 1] = 0; } } for (int j = 0; j < 50; ++j) { if (j % 2 == 0) { summ += int(a[j]); } else { summ += -int(a[j]); } } cout << summ; }