728x90
SMALL

자바

 

 

 

import java.util.*;

public class Main{
public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int[] student = new int[31];

        for(int i=1; i<29; i++) 
        {
            int success = sc.nextInt();
            student[success] = 1;
        }
    
        for(int i=1; i<student.length; i++) 
        {
            if(student[i]!=1)
            System.out.println(i);
        }

sc.close();
}
}

 

 

 

///////////////////////

 

 

 

C#

 

 

 

using System;
using System.Text;

namespace Baekjoon {
    class Program {
        static void Main(string[] args) {
            int[] student = new int[31];
            int arr = 0;
                
            for(int i = 0;i<28;i++)
            {
                arr = int.Parse(Console.ReadLine());
                student[arr] = 1;
            }
            
            for(int i = 1;i<31;i++)
            {
                if(student[i] != 1)
                  Console.WriteLine(i);
            } // 자연수라서 0이 나올 수가 없기 때문에 i를 1~30까지만 해준다.
        }
    }
}

 

 

 

728x90

설정

트랙백

댓글