zoukankan      html  css  js  c++  java
  • Problem A

    题意:

    已知 (a_1)(a_k) ,推导公式见题面。

    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    ll n, k, _, a;
    int main() {
    	//freopen("in.txt", "r", stdin);
    	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    	cin >> _; while (_--) {
    		cin >> n >> k;
    		k--;
    		while (k--) {
    			a = n;
    			ll l = 10, r = 0;
    			while (a) {
    				l = min(l, a % 10);
    				r = max(r, a % 10);
    				a /= 10;
    			}
    			if (!l)break;//如果存在前导0直接break
    			n += l * r;
    		}
    		cout << n << endl;
    	}
    }
    

    The desire of his soul is the prophecy of his fate
    你灵魂的欲望,是你命运的先知。

  • 相关阅读:
    PatentTips
    PatentTips
    PatentTips
    PatentTips – Java native function calling
    PatentTips
    PatentTips
    PatentTips
    PatentTips
    PatentTips
    PatentTips
  • 原文地址:https://www.cnblogs.com/RioTian/p/13658214.html
Copyright © 2011-2022 走看看