_takumi

num22.3

Nov 25th, 2020
449
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <utility>
  2. using namespace std;
  3.  
  4. pair<int, int> F(int x) {
  5.     int a = 0, b = 0;
  6.     while (x>0) {
  7.         a++;
  8.         b += x % 100;
  9.         x /= 100;
  10.     }
  11.     return make_pair(a, b);
  12. }
  13.  
  14. int main() {
  15.     for (int w = 9999; w > 0; w--) {
  16.         if (F(w) == make_pair(2, 17)) {
  17.             cout << w;
  18.             break;
  19.         }
  20.     }
  21.     return 0;
  22. }
RAW Paste Data