8-1. 求一批整数中出现最多的个位数字(20)
来源:互联网 发布:mac上装什么虚拟机好 编辑:程序博客网 时间:2024/04/25 22:42
#include <stdio.h>int bidaxiao(int n);int main(){int a,b ;scanf("%d",&a);int x[a];int i,j,k,p;for(i=0; i<a; ++i){scanf("%d",&x[i]);}//printf("%d %d %d",x[0],x[1],x[2]);int temp_a ;int c[10] ={0,0,0,0,0,0,0,0,0,0,};for(j=0; j<a; ++j){temp_a = x[j];while(temp_a > 0){b = temp_a%10 ;temp_a /= 10 ;switch(b){case 0:c[0] += 1;break;case 1:c[1] += 1 ;break;case 2:c[2] += 1 ;break;case 3:c[3] += 1 ;break;case 4:c[4] += 1 ;break;case 5:c[5] += 1 ;break;case 6:c[6] += 1 ;break;case 7:c[7] += 1 ;break;case 8:c[8] += 1 ;break;case 9:c[9] += 1 ;break;}}}int max = c[9];int index = 9 ;for(k=8; k>=0; --k){if(max < c[k]){max = c[k] ;index = k ;}}printf("%d: ",max);for(p = 0; p < index; ++p) {if(max == c[p])printf("%d ", p);}printf("%d\n", index);//printf("%d",c[1]);return 0;}
0 0
- 8-1. 求一批整数中出现最多的个位数字(20)
- PAT:8-1. 求一批整数中出现最多的个位数字(20)
- 8-1. 求一批整数中出现最多的个位数字(20)
- 求一批整数中出现最多的个位数字
- 求一批整数中出现最多的个位数字
- 08-1. 求一批整数中出现最多的个位数字(20)
- 08-1. 求一批整数中出现最多的个位数字(20)
- 08-1. 求一批整数中出现最多的个位数字(20)
- 08-1. 求一批整数中出现最多的个位数字(20)
- 08-1. 求一批整数中出现最多的个位数字(20)
- 08-1. 求一批整数中出现最多的个位数字(20)
- 08-1. 求一批整数中出现最多的个位数字(20)
- 08-1. 求一批整数中出现最多的个位数字(20)
- 08-1. 求一批整数中出现最多的个位数字(20)
- 08-1. 求一批整数中出现最多的个位数字(20)
- 08-1. 求一批整数中出现最多的个位数字(20)
- c语言练习 8-1. 求一批整数中出现最多的个位数字
- 数组-07. 求一批整数中出现最多的个位数字(20)
- Android中ListView、GridView里的CheckBox混乱且记录选中数量不准确的解决方案
- 如何判断一个数是否为2的N次方
- 深搜的非递归写法
- J - Vertical Histogram(1.5.7)
- 网络编程Socket之TCP之read/write
- 8-1. 求一批整数中出现最多的个位数字(20)
- R读取txt文件的问题
- 黑马程序员_io流的理解
- leetcode 刷题之路 2 Evaluate Reverse Polish Notation
- [leetcode] Sqrt(x)
- WebKit之CSS处理流程(4)
- [leetcode] Plus One
- 括号匹配(二)--侥幸通过,用动态规划的思想
- Lucene从入门到熟悉(二)检索