跳到正文

题解

CF1907E 题解

Vitamin_B约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年4月5日
收录
2025年12月12日
更新
2026年11月21日
篇幅
约 1 分钟
题目
CF1907E

版本

  1. v1当前

思路

本体核心:不能进位。

那就好做了,把每一位拆分分别计算,然后用组合数学中的插板法就行辣。

插板法不懂可以 bdfs。

代码

C++
# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
int t, n;
ll sum;
int main () {
	ios::sync_with_stdio (0);
	cin.tie (0);
	cout.tie (0);
	cin >> t;
	while (t --) {
		cin >> n;
		sum = 1;
		while (n) {
			sum *= (n % 10 + 2) * (n % 10 + 1) / 2;
			n /= 10;
		}
		cout << sum << '\n';
	}
	return 0;
}
原文