首页 > 其他 > 详细

UVA-1225 Digit Counting

时间:2018-09-06 13:30:00      阅读:169      评论:0      收藏:0      [点我收藏+]
 1 #include <iostream>
 2 #include <stdlib.h>
 3 #include <string>
 4 #include <vector>
 5 #include <algorithm>
 6 #include <string.h>
 7 #include <stack>
 8 #include <unordered_map>
 9 #include <math.h>
10 #include <iomanip>
11 
12 using namespace std;
13 
14 int hashList[10002][10];
15 
16 int main()
17 {
18     int T;
19     cin >> T;
20     memset(hashList,0,sizeof(hashList));
21     for(int i = 1; i <= 10001; i ++)
22     {
23         int tmpNum = i;
24         for(int j = 0;j < 10;j ++)
25         {
26             hashList[i][j] = hashList[i-1][j];
27         }
28         while(tmpNum)
29         {
30             hashList[i][tmpNum%10] ++;
31             tmpNum /= 10;
32         }
33     }
34     while(T --)
35     {
36         int input;
37         cin >> input;
38         for(int i = 0;i < 9;i ++)
39         {
40             cout << hashList[input][i] << " ";
41         }
42         cout << hashList[input][9];
43         cout << endl;
44     }
45     return 0;
46 }

 

UVA-1225 Digit Counting

原文:https://www.cnblogs.com/Asurudo/p/9597606.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!