Problem Description
Problem Analysis
/*Store integers in character form
then just check it*/
At first I thought it was like the case above: given a string of numbers and asked to find something
It turned out to be finding the occurrence counts of all digits in 1~N…
So I got tricked -.-
So I had to consider whether it would time out…
Then I still felt it was better to just precompute a table
After all, if this problem times out, it should be because many already-computed operations are repeated
/*(Also, the given sample output has a space after the last digit~ xi xi xi)*/
What a tricky problem. The sentence in the parentheses above is wrong
Although the problem’s sample output has spaces, the result is still required not to have spaces-.-
If there is a space at the end, it will get PE… -.-
AC code:
| |
Note that the array needs to be placed outside int main…
-.- It should be the so-called overflow issue.
Also, here is a table-precomputation method written based on someone else’s code
The third loop used when building this table is different
(that is, the method of recording the previous data)
| |
PS:
While writing the AC code, I also accidentally wrote code for the first interpretation-.-
Okay~ I’ll keep it as a memento too
| |
Problem link:【UVa】[1225]Digit Counting