标签:
来自互联网 :
既高效又好用才是王道!
- import java.io.IOException;
- import java.io.FileInputStream;
- import java.io.InputStreamReader;
- import java.io.BufferedReader;
- import java.io.OutputStreamWriter;
- import java.io.PrintWriter;
- import java.io.StreamTokenizer;
- import java.util.ArrayList;
- import java.util.Collections;
- public class Main
- {
- public static final boolean DEBUG = false;
- public StreamTokenizer tokenizer;
- public BufferedReader cin;
- public PrintWriter cout;
- public void init()
- {
- try {
- if (DEBUG) {
- cin = new BufferedReader(new InputStreamReader(
- new FileInputStream("d:\\OJ\\uva_in.txt")));
- } else {
- cin = new BufferedReader(new InputStreamReader(System.in));
- }
- cout = new PrintWriter(new OutputStreamWriter(System.out));
- tokenizer = new StreamTokenizer(cin);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public String next()
- {
- try {
- tokenizer.nextToken();
- if (tokenizer.ttype == StreamTokenizer.TT_EOF)
- return null;
- else if (tokenizer.ttype == StreamTokenizer.TT_NUMBER) {
- return String.valueOf((int)tokenizer.nval);
- } else if (tokenizer.ttype == StreamTokenizer.TT_WORD) {
- return tokenizer.sval;
- } else return null;
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
- public void solve(String s)
- {
- }
- public static void main(String[] args)
- {
- }
- }
标签:
原文地址:http://blog.csdn.net/wxisme/article/details/42127535