| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #include <algorithm>
- #include <array>
- #include <bitset>
- #include <climits>
- #include <cstring>
- #include <iostream>
- #include <iomanip>
- #include <list>
- #include <map>
- #include <set>
- #include <sstream>
- #include <stack>
- #include <string>
- #include <utility>
- #include <vector>
- #include <queue>
- using namespace std;
- #define rep(i, a, b) for(int i = (a); i < int(b); ++i)
- #define repto(i, b) rep(i, 0, b)
- #define trav(it, v) for(typeof((v).begin()) it = (v).begin(); \
- it != (v).end(); ++it)
- typedef unsigned int nat;
- const int imax = INT_MAX;
- const int umax = UINT_MAX;
- nat get_number(string str)
- {
- nat sum = 0;
- for(auto c : str)
- {
- if(!isalpha(c))
- continue;
- sum += toupper(c) - 64;
- }
- while(sum/10)
- {
- nat new_sum = 0;
- while(sum/10)
- {
- new_sum += sum % 10;
- sum /= 10;
- }
- new_sum += sum % 10;
- sum = new_sum;
- }
- return sum;
- }
- bool solve(nat tc)
- {
- string first, second;
- getline(cin, first);
- getline(cin, second);
- if(!first.length())
- return false;
- nat first_num = get_number(first);
- nat second_num = get_number(second);
- cout << fixed << setprecision(2) << min(first_num, second_num)/(float)max(first_num, second_num)*100 << " %" << endl;
- return true;
- }
- int main()
- {
- //Set to 0 if you need to read the number of cases first
- nat n = 1 << 30;
- if(!n) cin >> n;
- for(nat i = 1; i <= n && solve(i); ++i);
- return 0;
- }
|