Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class Main {
- final static int BUFFERSIZE=1000;
- public static void main(String args[]) throws FileNotFoundException
- {
- InputReader in;
- OutputWriter out;
- try
- {
- in=new InputReader(new FileInputStream(new File("/home/knightl/input")));
- out=new OutputWriter(new FileOutputStream(new File("/home/knightl/output")));
- }
- catch(FileNotFoundException e)
- {
- in = new InputReader(System.in);
- out=new OutputWriter(System.out);
- }
- int n=in.readInt();
- int arr[]=new int[n];
- for(int i=0;i<n;i++)
- arr[i]=in.readInt();
- for(int i=0;i<n;i++)
- out.printLine(arr[i]);
- out.close();
- }
- }
- class InputReader {
- private InputStream stream;
- private byte[] buf = new byte[1024];
- private int curChar;
- private int numChars;
- private SpaceCharFilter filter;
- public InputReader(InputStream stream) {
- this.stream = stream;
- }
- public int read() {
- if (numChars == -1)
- throw new InputMismatchException();
- if (curChar >= numChars) {
- curChar = 0;
- try {
- numChars = stream.read(buf);
- } catch (IOException e) {
- throw new InputMismatchException();
- }
- if (numChars <= 0)
- return -1;
- }
- return buf[curChar++];
- }
- public int readInt() {
- int c = read();
- while (isSpaceChar(c))
- c = read();
- int sgn = 1;
- if (c == '-') {
- sgn = -1;
- c = read();
- }
- int res = 0;
- do {
- if (c < '0' || c > '9')
- throw new InputMismatchException();
- res *= 10;
- res += c - '0';
- c = read();
- } while (!isSpaceChar(c));
- return res * sgn;
- }
- public boolean isSpaceChar(int c) {
- if (filter != null)
- return filter.isSpaceChar(c);
- return isWhitespace(c);
- }
- public static boolean isWhitespace(int c) {
- return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
- }
- public interface SpaceCharFilter {
- public boolean isSpaceChar(int ch);
- }
- }
- class OutputWriter {
- private final OutputStream out;
- private byte[] buf = new byte[1024];
- private byte[] tmp = new byte[1024];
- private int top;
- public OutputWriter(OutputStream outputStream) {
- top=0;
- out=outputStream;
- }
- public void flush() {
- try {
- out.write(buf,0,top);
- top=0;
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- public void close() {
- flush();
- try {
- out.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- private void add_tmp(int tmp_top)
- {
- for(int j=0;j<tmp_top;j++)
- {
- if(top==buf.length)
- flush();
- buf[top++]=tmp[j];
- }
- }
- public void print(int i) {
- int tmp_top=0;
- if(i==0)
- tmp[tmp_top++]='0';
- else
- {
- boolean sign=i<0;
- if(sign) i=-i;
- while(i!=0)
- {
- tmp[tmp_top++]=(byte)('0'+i%10);
- i/=10;
- }
- if(sign)
- tmp[tmp_top++]='-';
- for(int j=0,k=tmp_top-1;j<k;j++,k--)
- {
- byte t=tmp[j];
- tmp[j]=tmp[k];
- tmp[k]=t;
- }
- }
- add_tmp(tmp_top);
- }
- public void printLine(int i) {
- print(i);
- tmp[0]='\n';
- add_tmp(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment