Advertisement
_takumi

num22.1

Nov 25th, 2020
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int F(int x) {
  5.     int L = 0;
  6.     int M = 0;
  7.     while (x > 0) {
  8.         L = L + 1;
  9.         if(M < x) {
  10.             M = x % 10;
  11.         }
  12.         x = x / 10;
  13.     }
  14.     return L * 10 + M;
  15. }
  16.  
  17. int main() {
  18.     for (int w = 999; w > 0; w--) {
  19.         if (F(w) == 37) {
  20.             cout << w;
  21.             break;
  22.         }
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement