mirror of
https://github.com/danbulant/introductionToProgramming
synced 2026-05-19 12:28:44 +00:00
19 lines
414 B
Java
19 lines
414 B
Java
package week5;
|
|
|
|
import common.StdIn;
|
|
|
|
public class MissingInt {
|
|
public static void main(String[] args) {
|
|
int n = Integer.parseInt(args[0]);
|
|
boolean[] nums = new boolean[n];
|
|
for(var i = 0; i < n - 1; i++) {
|
|
int integer = StdIn.readInt() - 1;
|
|
nums[integer] = true;
|
|
}
|
|
for(var i = 0; i < nums.length; i++) {
|
|
if(!nums[i]) {
|
|
System.err.println(i + 1);
|
|
}
|
|
}
|
|
}
|
|
}
|