Files
python/TangDou/AcWing/DP/ShuWei/1096_Prepare.cpp

22 lines
682 B
C++
Raw Permalink Normal View History

2025-08-30 18:35:01 +08:00
#include <bits/stdc++.h>
using namespace std;
const int N = 20;
int pw[N];
typedef long long ll;
const int mod = 1e9 + 7;
int main() {
pw[0] = 1; // 10^0=1,递推的起点
// 1、一日取模,终生取模~
// 2、为了防止运算过程中溢出,所以在乘法时注意加上ll类型转换
// i ∈ [1,N-1] 共19位
for (int i = 1; i < N; i++) pw[i] = (ll)10 * pw[i - 1] % mod;
for (int i = 1; i < N; i++) printf("%d ", pw[i]);
/*
输出结果
10 100 1000 10000 100000 1000000 10000000 100000000 1000000000 999999937 999999307 999993007 999930007 999300007 993000007 930000007 300000007 49 490
*/
return 0;
}