Digit Counting UVA
来源:互联网 发布:php的csrf防护 编辑:程序博客网 时间:2024/06/15 17:46
Digit Counting UVA - 1225
题目传送:
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3666
题目大意:求一串连续整数中的0-9出现的次数,比如:13,即12345678910111213,那么这个时候输出十个整数,分别是0-9出现的次数
Output:1,6,2,2,1,1,1,1,1,1,1;
分析:打表查表;
AC Code:
#include <algorithm>#include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <cmath>using namespace std;int f[10000][10];int main(){ memset(f, 0, sizeof(f)); for (int i = 1 ; i < 10000 ; ++ i)//打表过程 { for (int j = 0 ; j < 10 ; ++ j) f[i][j] = f[i-1][j]; int left = i; while (left)//统计每一位的出现的次数 { f[i][left%10] ++; left /= 10; } } int t,n; while (~scanf("%d",&t)) while (t --) { scanf("%d",&n); for (int i = 0 ; i < 9 ; ++ i) printf("%d ",f[n][i]); printf("%d\n",f[n][9]); } return 0;}
阅读全文
0 0
- Digit Counting -UVA
- UVa 1225 - Digit Counting
- UVa 1225 - Digit Counting
- UVa-1225 - Digit Counting
- UVa 1225 Digit Counting
- UVA - 1225 Digit Counting
- UVA 1225 - Digit Counting
- UVa 1225 - Digit Counting
- UVa-1225Digit Counting
- 【Uva 1225】 Digit Counting
- UVa 1225 - Digit Counting
- UVa 1225 - Digit Counting
- Uva - 1225 - Digit Counting
- Uva 1225 Digit Counting
- UVA 1225 Digit Counting
- UVa 1225 - Digit Counting
- UVa 1225 Digit Counting
- UVa 1225 Digit Counting
- 数组++、对象、ES5Array新增方法
- 几种分类问题的区别:多类分类,多标签分类,多示例学习,多任务学习
- Python第三方库:Pyinstaller——神奇的Py打包工具
- hibernate.cfg.xml
- 使用MyEclipse简化hibernate开发
- Digit Counting UVA
- jquery $(document).ready() 与window.onload的区别
- 【HDU 4552】怪盗基德的挑战书(kmp)
- 数塔
- C++的运算符重载
- Krpano插件---view标签说明
- 学习(Broadcast Receiver) 个人笔记三
- Android 项目导入错误
- 浅谈MVP的使用