You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
682 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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;
}