Skip to content

Instantly share code, notes, and snippets.

@6LYTH3
Created July 15, 2011 07:58
Show Gist options
  • Save 6LYTH3/1084281 to your computer and use it in GitHub Desktop.
Save 6LYTH3/1084281 to your computer and use it in GitHub Desktop.
git clone - FakeTickets
package main;
import java.io.File;
import java.util.Scanner;
public class Fake {
public static void main(String[] args) throws Throwable {
File file = new File("txt");
Scanner scan = new Scanner(file);
int N, M, c;
while (true) {
N = scan.nextInt();
M = scan.nextInt();
if ((N < 1 || N >= 1000) || (M < 1 || M >= 1000))
break;
int num[] = new int[N];
for (int i = 0; i < M; i++)
num[scan.nextInt() - 1]++;
c = 0;
for (int i = 0; i < N; i++)
if (num[i] > 1)
c++;
System.out.println(c);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment