zoukankan      html  css  js  c++  java
  • 输入最多100个两位数的整数,统计每个数字在十位、个位出现的次数

    //

    //  main.c

    //  c yuyan

    //

    //  Created by anzhongyin on 2016/11/29.

    //  Copyright © 2016 anzhongyin. All rights reserved.

    //

     

    #include <stdio.h>

    //#include <math.h>

     

    int main(int argc, const char * argv[]) {

        // insert code here...

        // TODO Auto-generated method stub

        const int n=100;

        int number[n]={0};

        int s[10]={0};

        int g[10]={0};

        for (int i=0;i<100;i++) {

            int a;

            scanf("%d",&a);

            if (a==-1) {

                break;

            }

            if (a<100&&a>9) {

                number[i]=a;

                s[a/10]++;

                g[a%10]++;

            }

        }

        for (int i=0; i<10; i++) {

            printf("%d在十位出现%d次,在个位上出现%d; ",i,s[i],g[i]);

        }

        

        return 0;

    }

  • 相关阅读:
    AD预测论文研读系列2
    hdu 5795
    sg函数的应用
    二分查找
    快速幂
    筛选法素数打表
    多校hdu-5775 Bubble sort(线段树)
    多校hdu5754(博弈)
    多校hdu5738 寻找
    多校hdu5726 线段树+预处理
  • 原文地址:https://www.cnblogs.com/bcd589/p/6143703.html
Copyright © 2011-2022 走看看