zoukankan      html  css  js  c++  java
  • YTU 2904: B--Faultfinding

    2904: B--Faultfinding

    时间限制: 1 Sec  内存限制: 128 MB
    提交: 64  解决: 33

    题目描述

    Do you remember the game in which we find difference among several similar pictures? Now we change it into digital version. There are N digits, same or different. Please find how many different digits there are among them and output the number.

    输入

    Each group of the first line is N (1<=N<=10000). The second line consists N integers.

    输出

    The number of different digits.

    样例输入

    2
    1 1
    3 
    1 2 3
    

    样例输出

    1
    3
    

    im0qianqian_站在回忆的河边看着摇晃的渡船终年无声地摆渡,它们就这样安静地画下黄昏画下清晨......可怜

    #include <stdio.h>
    int main()
    {
        int s,a[10000],n=1,i,j;
        while (~scanf("%d",&s)&&s)
        {
            for (i=0; i<s; i++)scanf("%d",a+i);
            for (i=1; i<s; i++)
                for (j=i-1; j>=0; j--)
                {
                    if (a[j]==a[i])break;
                    if (j==0)n++;
                }
            printf("%d
    ",n);
        }
        return 0;
    }


  • 相关阅读:
    SpringMVC概述
    Spring 声明式事务
    Spring_AOP切面编程
    Spring DI依赖注入
    Spring IOC控制反转
    Spring解耦和耦合
    Spring概述
    HTTP协议常见状态码
    TCP/IP协议的认识
    设计模式-工厂模式(factory)
  • 原文地址:https://www.cnblogs.com/im0qianqian/p/5989665.html
Copyright © 2011-2022 走看看