牛客网自测试题20170307
来源:互联网 发布:js写日历 编辑:程序博客网 时间:2024/05/16 03:30
牛客网自测试题20170307
#include<iostream>#include<cstdlib>#include<cstdio>#include<ctime>using namespace std;//页码统计int main(void){long int b,e,t;b=clock();//运行时间计算static int shuzu[10]={0,0,0,0,0,0,0,0,0,0};unsigned int num=1;//页码整数cin>>num;//假设999unsigned int count=1,acount=1;while(count<=num){acount=count;int weight[10]={0,0,0,0,0,0,0,0,0,0};//每个数字都进行分解int k=0,flag=0;while(acount!=0){++flag;//标识位weight[k++]=acount%10;acount=acount/10;}//每个数字位分别判断for(int i=0;i<10;i++){if(i<flag){if(weight[i] == 0)++shuzu[0];}if(weight[i] == 1)++shuzu[1];if(weight[i] == 2)++shuzu[2];if(weight[i] == 3)++shuzu[3];if(weight[i] == 4)++shuzu[4];if(weight[i] == 5)++shuzu[5];if(weight[i] == 6)++shuzu[6];if(weight[i] == 7)++shuzu[7];if(weight[i] == 8)++shuzu[8];if(weight[i] == 9)++shuzu[9];}//累加器自增count++;}//依次输出for(int i=0;i<=8;i++){cout<<shuzu[i]<<" ";}cout<<shuzu[9];cout<<endl;//运行时间e=clock();t=(e-b)/1000;cout<<t<<endl;system("pause");return 0;}
0 0
- 牛客网自测试题20170307
- java面试题--自测
- 安卓巴士自测试题---第十六期
- 安卓巴士自测试题-第十七期
- 安卓巴士自测试题-第十八期
- 安卓巴士自测试题-第十九期
- 安卓巴士自测试题-第二十期
- java Web开发方向全套培训课件及Java基础自测、面试笔试自测试题
- 安卓巴士自测试题——第一期
- 安卓巴士自测试题——第二期
- 安卓巴士自测试题——第三期
- 安卓巴士自测试题——第四期
- 安卓巴士自测试题——第五期
- 安卓巴士自测试题——第六期
- 安卓巴士自测试题——第七期
- 安卓巴士自测试题——第八期
- 安卓巴士自测试题——第九期
- 安卓巴士自测试题——第十期
- 小tip:中文英文左右padding一致两端对齐实
- 一对一映射
- Elasticsearch5.0学习与理解翻译(一)
- CentOS7下安装Oracle12c后的一些相关工作
- 使用Thread的wait方法与notify方法时遇到的IllegalMonitorStateException
- 牛客网自测试题20170307
- java编程思想之控制执行流程
- 02:输出第二个整数
- linux 查看crontab日志
- number
- android开发中如何从当前页面返回上一页面
- javaScript对象转换为原始值的过程
- 欢迎使用CSDN-markdown编辑器
- 记一次大规模数据迁移和加密