不超过N位的正整数中包含有多少数字8?
输入格式
一行1个正整数N,范围[1,16]。
输出格式
一个整数。
输入/输出例子1
输入:
2
输出:
20
解释
8,18,28,38,48,58,68,78,88, 98与80,81,82,83,84,85,86,87,89这些数中有8,共有 包含了20个数字8。
样例解释
无
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
int n;
ll s=0;
ll a=1;
cin >> n;
for(int i=1;i<=n-1;i++){
a*=10;
}
cout<<n*a;
}