UVA 1225
来源:互联网 发布:linux开机自动挂载 编辑:程序博客网 时间:2024/06/13 23:09
题目大意:求1到m的数位中0~9出现的次数。
解题思路:从一到m循环,求出每位数。
ac代码:
#include <iostream>#include <cstring>using namespace std;int main(){int n, sum[10], m, temp, temp2;char a[1000];scanf("%d", &n);while (n--){scanf("%d", &m);memset(sum, 0, sizeof(sum));for (int i=1; i<=m; i++){temp = i;while (temp){temp2 = temp%10;temp = temp/10;sum[temp2]++;}}for (int i=0; i<10; i++)printf(i==0?"%d":" %d", sum[i]);printf("\n");}return 0;}
阅读全文
0 0
- uva-1225
- UVa 1225
- Uva 1225
- UVA 1225
- UVa 1225
- uva 1225
- UVA-1225
- 【UVa - 1225】
- UVa-1225
- UVA 1225
- UVA 1225
- UVA 1225
- UVA 1225
- UVa 1225
- uva 1225
- UVA Digit Counting UVA - 1225
- UVa 1225 - Digit Counting
- UVa 1225 - Digit Counting
- 记一次完整手机APP项目的开发
- 【jQuery】on注册事件的时候处理函数自动运行
- hdu 1024 最大M字段和
- [luogu-2680]noip2015day2-T3 运输计划 题解
- MFC控件
- UVA 1225
- SmartTabLayout+CoordinatorLayout+RecycleView+沉浸式状态栏
- ORB-SLAM2 环境搭建和运行测试
- 关于包装类自动装箱时的缓存机制
- 从Arrays里面的toString方法是不是…
- 传说中的二分法查找
- 以递归方式列出指定路径的文件夹目…
- 关于异常捕获的问题
- 使用IO流进行文件拷贝和文件夹拷贝