Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string line;
- char a;
- bool rl=false;
- int s1, s2, z1 = 0, z2 = 0, size;
- __int64 f1 = 0, f2 = 0;
- while (getline(cin, line))
- {
- rl = false;
- s1 = 0; s2 = 0;
- z1 = 0; z2 = 0;
- f1 = 0; f2 = 0;
- size = line.size();
- for (int i = 0; i < size; i++)
- {
- if (line[i] == '^')
- z1 = i;
- }
- for (int i = 0; i < size; i++)
- {
- if (line[i] == '=')
- {
- if (rl == false)
- z1--;
- else
- z2++;
- }
- else if (line[i] == '^')
- rl = true;
- else
- {
- if (rl == false)
- {
- s1 = line[i] - 48;
- f1 = f1 + s1*z1;
- z1--;
- }
- else
- {
- z2++;
- s2 = line[i] - 48;
- f2 = f2 + s2*z2;
- }
- }
- }
- if (z1 == 0)
- z1 = 1;
- if (z2 == 0)
- z2 = 1;
- if (f1 > f2)
- cout << "left" << endl;
- if (f1 < f2 )
- cout << "right" << endl;
- if (f1 == f2 )
- cout << "balance" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement