CCF 门禁系统

来源:互联网 发布:mysql primary key 编辑:程序博客网 时间:2024/04/30 15:21
import java.util.Scanner;public class Main {      public static void main(String[] args) {          new Main().run();      }      public void run(){          Scanner sc = new Scanner(System.in);          int N = sc.nextInt();          int [] arr =new int[N];        int [] count=new int[N];        for(int i=0;i<N;i++){            arr[i]=sc.nextInt();            count[i]=1;            for(int j=0;j<i;j++){                if(arr[j]==arr[i]){                    count[i]++;                }            }            System.out.print(count[i]+" ");        }        }}

注意内容:
两个循环很纠结。大脑需要变成计算机运行模式理解。