Created
November 12, 2016 14:14
-
-
Save alekseytimoshchenko/c6be48c94735984a2be33cfac3a5dfde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
public class Solution | |
{ | |
public static void main(String[] args) throws IOException | |
{ | |
if (args.length == 0) | |
{ | |
throw new IllegalArgumentException(); | |
} | |
int id = Integer.parseInt(args[0]); | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
String fileName = br.readLine(); | |
BufferedReader bis = new BufferedReader(new FileReader(fileName)); | |
String line; | |
while ((line = bis.readLine()) != null) | |
{ | |
String[] tmp = line.split(" "); | |
int currentId = Integer.parseInt(tmp[0]); | |
if (currentId == id){ | |
System.out.println(line); | |
} | |
} | |
br.close(); | |
bis.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment