Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alekseytimoshchenko/c6be48c94735984a2be33cfac3a5dfde to your computer and use it in GitHub Desktop.
Save alekseytimoshchenko/c6be48c94735984a2be33cfac3a5dfde to your computer and use it in GitHub Desktop.
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