#include <stdio.h>
#include <string.h>

int main()
{
    int T, N, i, j;
    int a[10];
    scanf("%d", &T);
    while (T--)
    {
        memset(a, 0, sizeof(a));
        scanf("%d", &N);
        for (i = 1; i <= N; ++i)
        {
            j = i;
            while (j > 0)
            {
                ++a[j%10];
                j /= 10;
            }
        }
        for (i = 0; i < 9; ++i)
            printf("%d ", a[i]);
        printf("%d\n", a[9]); // a[9]后面不能再输入空格,否则会PE
    }

return 0;
}

UVa1225 Digit Counting的更多相关文章

  1. UVA1225 - Digit Counting(紫书习题3.3)

    Trung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequen ...

  2. UVa 1225 Digit Counting --- 水题

    UVa 1225 题目大意:把前n(n<=10000)个整数顺次写在一起,12345678910111213...,数一数0-9各出现多少字 解题思路:用一个cnt数组记录0-9这10个数字出现 ...

  3. UVa1587.Digit Counting

    题目连接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=247&p ...

  4. 数数字(Digit Counting,ACM/ICPC Danang 2007,UVa1225)

    #include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ char s[10000]; in ...

  5. 数数字 (Digit Counting,ACM/ICPC Dannang 2007 ,UVa1225)

    题目描述:算法竞赛入门经典习题3-3 #include <stdio.h> #include <string.h> int main(int argc, char *argv[ ...

  6. 【习题 3-3 UVA-1225】Digit Counting

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 水模拟 [代码] #include <bits/stdc++.h> using namespace std; int a ...

  7. 习题3-3 数数字(Digit Counting , ACM/ICPC Danang 2007, UVa1225)

    #include<stdio.h> #include<string.h> int main() { char s[100]; scanf("%s",s); ...

  8. Digit Counting UVA - 1225

    ​ Trung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequ ...

  9. 数数字 (Digit Counting,ACM/ICPC Danang 2007,UVa 1225)

    思路: 利用java 特性,将数字从1 一直加到n,全部放到String中,然后依次对strring扫描每一位,使其carr[str.charAt(i)-'0']++; 最后输出carr[i],即可. ...

随机推荐

  1. poj2390

    #include <stdio.h> #include <stdlib.h> int main() { int r,m,y,i; scanf("%d %d %d&qu ...

  2. 20140613_JavaWeb学习之开发环境配置篇

    本文所使用软件百度云盘网址:http://pan.baidu.com/s/1kTDRFwz 1安装JDK 操作系统:windows7-64bit 版本号:jdk-7u51-windows-x64 安装 ...

  3. 如何在MFC中操作资源句柄

    如何获取动态库中对话框相关资源,避免因资源问题报错? AfxGetResourceHandle用于获取当前资源模块句柄AfxSetResourceHandle则用于设置程序目前要使用的资源模块句柄. ...

  4. opacity在IE6~8下无效果,解决的办法

    opacity在IE6~8下无效果,解决的办法 问题出现时rgba()在ie6下不出效果,最后查到是opacity的问题. opacity是css3时出现的,目前主流浏览器都支持.but老IE是个麻烦 ...

  5. javascript中数据类型转换

    转换为数字: parseInt():转换为整数型数值:从下标0开始判断,若为数值型则继续直到遇到非数值,返回前面的整数值: 小数点无效,若0开始为非数值则返回NaN: 转换空字符串会返回NaN: 能转 ...

  6. 性能优化工具---top

    作用: 实时显示linux下各个进程的资源占用情况 参数: -d :后面可以接秒数,就是整个程序画面更新的秒数.预设是 5 秒: -p :指定某些个 PID 来进行观察监测而已. -b :以批次的方式 ...

  7. Ueditor和CKeditor 两款编辑器的使用与配置

    一丶ueditor 百度编辑器 1.官方文档,演示,下载地址:http://ueditor.baidu.com/website/index.html 2.百度编辑器的好:Editor是由百度web前端 ...

  8. 在centos6.5下yum仓库的创建

    第一步:打开虚拟机,装入光盘镜像,选择为已连接 第二步: df -h mount umount /dev/sr0 mkdir /centos mount /dev/sr0 /centos mkdir ...

  9. 2014.9.3数据库CRUD

    CRUD 增删改查 DCL 数据控制语言:备份,grant DML 数据操作语言: CRUD DDL 数据定义语言:create drop alter 自增长列不能赋值 增: Insert into  ...

  10. 2014.8.30.ref,out,params,enum,递归

    (一)ref 函数形参变量的输入有两种方式:传值,传址.而ref则为传址.eg: static int Add(ref int n) { Console.WriteLine("Add---- ...