Title Description
Input Format
no
Output Format
no
Translation of the meaning of problems
The former n (n <= 10000) together integer sequentially written: 12345678910111213141516 ...... 0-9 count how many times appeared.
Sample input and output
no
code show as below:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<cstdio>
#include <algorithm>
#include<map>
#include<sstream>
using namespace std;
#pragma warning(disable:4996)
#pragma warning(disable:6031)
int main()
{
int Count[13];
int n;
cin >> n;
while (n--)
{
memset(Count, 0, sizeof(Count));
int ans;
cin >> ans;
for (int i = 1; i <= ans; i++)
{
string s;
stringstream sliu;//流stringstream
sliu << i;//数字转化成流
sliu >> s;//流转化成字符串
for (int j = 0; j < s.length(); j++)
{
Count[s[j] - '0']++;
}
}
for (int i = 0; i <= 9; i++)
{
printf("%d%c", Count[i],i==9?'\n':' ');
}
//printf("\n");
}
return 0;
}