Problem A - Sequence with Digits (数学推导)
发布日期:2021-05-09 00:11:45 浏览次数:18 分类:博客文章

本文共 448 字,大约阅读时间需要 1 分钟。

题意:

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

#include
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; }}
上一篇:Problem B - Card Constructions (构造)
下一篇:LC算法技巧总结(二):双指针和滑动窗口技巧

发表评论

最新留言

留言是一种美德,欢迎回访!
[***.207.175.100]2025年04月12日 11时36分15秒