【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

水模拟

【代码】

#include <bits/stdc++.h>
using namespace std; int a[10]; int main()
{
/*freopen("F:\\rush.txt", "r", stdin);*/
int T;
scanf("%d", &T);
while (T--)
{
int n;
scanf("%d", &n);
for (int i = 0; i <= 9; i++) a[i] = 0;
for (int i = 1; i <= n; i++)
{
int x = i;
while (x)
{
a[x % 10]++;
x /= 10;
}
}
for (int i = 0; i <= 9; i++)
{
printf("%d", a[i]);
if (i == 9)
puts("");
else
putchar(' ');
}
}
return 0;
}

【习题 3-3 UVA-1225】Digit Counting的更多相关文章

  1. UVa 1225 Digit Counting --- 水题

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

  2. UVa 1225 Digit Counting

    题意:给出n,将前n个整数顺次写在一起,统计各个数字出现的次数. 用的最笨的办法--直接统计-- 后来发现网上的题解有先打表来做的 #include<iostream> #include& ...

  3. UVa 1225 - Digit Counting - ACM/ICPC Danang 2007 解题报告 - C语言

    1.题目大意 把前n$(n\le 10000)$个整数顺次写在一起:12345678910111213……计算0~9各出现了多少次. 2.思路 第一想法是打表,然而觉得稍微有点暴力.不过暂时没有想到更 ...

  4. UVa1587.Digit Counting

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

  5. UVA 1640 The Counting Problem UVA1640 求[a,b]或者[b,a]区间内0~9在里面各个数的数位上出现的总次数。

    /** 题目:UVA 1640 The Counting Problem UVA1640 链接:https://vjudge.net/problem/UVA-1640 题意:求[a,b]或者[b,a] ...

  6. uva 11401 Triangle Counting

    // uva 11401 Triangle Counting // // 题目大意: // // 求n范围内,任意选三个不同的数,能组成三角形的个数 // // 解题方法: // // 我们设三角巷的 ...

  7. UVa 1583 Digit Generator --- 水题+打表

    UVa 1583 题目大意:如果x加上x的各个数字之和得到y,那么称x是y的生成元. 给定数字n,求它的最小生成元 解题思路:可以利用打表的方法,提前计算出以i为生成元的数,设为d,并保存在a[d]中 ...

  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],即可. ...

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

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

随机推荐

  1. region实现大纲效果

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  2. elasticsearch index 之merge

    merge是lucene的底层机制,merge过程会将index中的segment进行合并,生成更大的segment,提高搜索效率.segment是lucene索引的一种存储结构,每个segment都 ...

  3. Mvc异步

    <h3>MVC 自带的yibu请求</h3> <%-- 1.要执行的方法,2.控制器,3.Ajax操作--%> <%using (Ajax.BeginForm ...

  4. vue中 v-cloak 的用法

    原文来自:http://www.sunzhongwei.com/hide-vuejs-variable-with-v-cloak-when-page-loading

  5. OpenCV —— HighGUI

    分为:硬件相关部分,文件部分以及图形用户接口部分 创建窗口 —— cvNamedWindow 若设置成 CV_WINDOW_AUTOSIZE 窗口大小会随着图像的载入而根据图像大小调整,用户没办法手动 ...

  6. Snapshot Standby

    INTRODUCTION Snapshot standby database是ORACLE 11g的新特性.允许Physical standby短时间的使用read write模式. Snapshot ...

  7. 请求头header里的contentType为application/json和capplition/x-www-form-urlencoded

    application/x-www-form-urlencoded 最常见的 POST 提交数据的方式了.浏览器的原生 <form> 表单,如果不设置 enctype 属性,那么最终就会以 ...

  8. 顶级、块级、内联,html元素的三大分类

    学习html后, 你会了解一些基本的html元素(Element), 如p, h1~h6, br, div, li, ul, img等.如果将这些元素细分, 又可以分别归为顶级(top-level)元 ...

  9. 阿里云 CentOS7.4 环境安装nginx

    下载 nginx地址: http://nginx.org/en/download.html Mainline version可以理解为开发版本 Stable version 稳定版 Legacy ve ...

  10. UDP 打洞示例 包含 服务器 客户端

    客户端示例: #include "Net.h" #include "../p2pInfo.h" int main() { CUdp  udp; if (0!=u ...