zoukankan      html  css  js  c++  java
  • UVA-1225 Digit Counting

     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 }
  • 相关阅读:
    SED{shell三剑客awk,sed,grep}
    AWK{shell三剑客awk,sed,grep}
    面试汇总
    shell脚本
    redis主从
    haproxy
    grafana
    zabbix
    lnmp
    shell 基础
  • 原文地址:https://www.cnblogs.com/Asurudo/p/9597606.html
Copyright © 2011-2022 走看看