Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <algorithm>
- #include <vector>
- #include <map>
- #include <queue>
- #include <set>
- using namespace std;
- double convert10(vector<long long> k, int step)
- {
- double answ=0;
- double Pow = k.size() - 1;
- for (auto i = k.begin(); i != k.end(); i++)
- {
- answ += (*i);
- Pow--;
- }
- return answ;
- }
- int main()
- {
- long long max = -1;
- char ediniz;
- vector<long long> k;
- while (cin >> ediniz)
- {
- long long dic;
- if (ediniz >= '0'&&ediniz <= '9')
- {
- dic = ediniz - '0';
- }
- else
- dic = ediniz - 'A' + 10;
- if (max < dic)
- max = dic;
- k.push_back(dic);
- }
- bool was = false;
- for (int i = max+1; i <= 37; i++)
- {
- long long edin10 = convert10(k, i);
- if (edin10 <= 1)
- {
- cout << "2";
- was = true;
- break;
- }
- if (edin10%(i-1) == 0)
- {
- cout << i << endl;
- was = true;
- break;
- }
- }
- if (!was)
- {
- cout << "No solution.";
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment