输入输出挂1(P神)
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
out.close();//一定要滴
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
String nextLine() throws IOException{
return reader.readLine();
}//自己加的 方法1
String nextLine() {
String str = null;
try {
str = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}//方法2
public int nextInt() {
return Integer.parseInt(next());
}
}
}
挂2
StreamTokenizer sc=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
挂3(带hasNext())
static FastScanner sc = new FastScanner(System.in);// 快读
static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));// 快速输出
class FastScanner {// 用于快速读入大量数据
BufferedReader br;
StringTokenizer st;
public FastScanner(InputStream in) {
br = new BufferedReader(new InputStreamReader(in), 16384);
eat("");
}
public void eat(String s) {
st = new StringTokenizer(s);
}
public String nextLine() {
try {
return br.readLine();
} catch (IOException e) {
return null;
}
}
public boolean hasNext() {
while (!st.hasMoreTokens()) {
String s = nextLine();
if (s == null)
return false;
eat(s);
}
return true;
}
public String next() {
hasNext();
return st.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
挂4
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Main {
private static final String NO = "NO";
private static final String YES = "YES";
InputStream is;
PrintWriter out;
String INPUT = "";
private static final long MOD = 998244353L;
void run() throws Exception {
is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
out = new PrintWriter(System.out);
long s = System.currentTimeMillis();
solve();
out.flush();
if (!INPUT.isEmpty())
tr(System.currentTimeMillis() - s + "ms");
}
public static void main(String[] args) throws Exception {
new Main().run();
}
private byte[] inbuf = new byte[1024];
public int lenbuf = 0, ptrbuf = 0;
private boolean vis[];
private int readByte() {
if (lenbuf == -1)
throw new InputMismatchException();
if (ptrbuf >= lenbuf) {
ptrbuf = 0;
try {
lenbuf = is.read(inbuf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (lenbuf <= 0)
return -1;
}
return inbuf[ptrbuf++];
}
private boolean isSpaceChar(int c) {
return !(c >= 33 && c <= 126);
}
private int skip() {
int b;
while ((b = readByte()) != -1 && isSpaceChar(b))
;
return b;
}
private double nd() {
return Double.parseDouble(ns());
}
private char nc() {
return (char) skip();
}
private String ns() {
int b = skip();
StringBuilder sb = new StringBuilder();
while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
// ')
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
private char[] ns(int n) {
char[] buf = new char[n];
int b = skip(), p = 0;
while (p < n) {
if (!(isSpaceChar(b)))
buf[p++] = (char) b;
b = readByte();
}
return n == p ? buf : Arrays.copyOf(buf, p);
}
private char[][] nm(int n, int m) {
char[][] map = new char[n][];
for (int i = 0; i < n; i++)
map[i] = ns(m);
return map;
}
private int[] na(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = ni();
return a;
}
private Integer[] na2(int n) {
Integer[] a = new Integer[n];
for (int i = 0; i < n; i++)
a[i] = ni();
return a;
}
private int[][] na(int n, int m) {
int[][] a = new int[n][];
for (int i = 0; i < n; i++)
a[i] = na(m);
return a;
}
private Integer[][] na2(int n, int m) {
Integer[][] a = new Integer[n][];
for (int i = 0; i < n; i++)
a[i] = na2(m);
return a;
}
private int ni() {
int num = 0, b;
boolean minus = false;
while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
;
if (b == '-') {
minus = true;
b = readByte();
}
while (true) {
if (b >= '0' && b <= '9') {
num = num * 10 + (b - '0');
} else {
return minus ? -num : num;
}
b = readByte();
}
}
private long nl() {
long num = 0;
int b;
boolean minus = false;
while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
;
if (b == '-') {
minus = true;
b = readByte();
}
while (true) {
if (b >= '0' && b <= '9') {
num = num * 10 + (b - '0');
} else {
return minus ? -num : num;
}
b = readByte();
}
}
private static void tr(Object... o) {
System.out.println(Arrays.deepToString(o));
}
}
挂五
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
public class Main {
public static void main(String[] args) throws IOException {
InputReader in=new InputReader(System.in);
PrintWriter out=new PrintWriter(System.out);
int ans=0;
out.println(ans);
out.close();
}
static class InputReader{
private final InputStream stream;
private final byte[] buf=new byte[8192];
private int curChar,snumChars;
public InputReader(InputStream stream) {
this.stream=stream;
}
public int read() {
if(snumChars==-1) throw new InputMismatchException();
if(curChar>=snumChars) {
curChar=0;
try {
snumChars=stream.read(buf);
}catch(IOException e) {
throw new InputMismatchException();
}
if(snumChars<=0) return -1;
}
return buf[curChar++];
}
public int ni() {
int c=read();
while(isSpaceChar(c)) {
c=read();
}
int sgn=1;
if(c=='-') {
sgn=-1;
c=read();
}
int res=0;
do {
res*=10;
res+=c-'0';
c=read();
}while(!isSpaceChar(c));
return res*sgn;
}
public long nl() {
int c=read();
while(isSpaceChar(c)) {
c=read();
}
int sgn=1;
if(c=='-') {
sgn=-1;
c=read();
}
long res=0;
do {
res*=10;
res+=c-'0';
c=read();
}while(!isSpaceChar(c));
return res*sgn;
}
public int []nextIntArray(int n){
int a[]=new int [n];
for(int i=0;i<n;i++) {
a[i]=ni();
}
return a;
}
public String readString() {
int c=read();
while(isSpaceChar(c)) c=read();
StringBuilder res=new StringBuilder();
do {
res.appendCodePoint(c);
c=read();
}while(!isSpaceChar(c));
return res.toString();
}
public String nextLine() {
int c=read();
while(isSpaceChar(c)) c=read();
StringBuilder res=new StringBuilder();
do {
res.appendCodePoint(c);
c=read();
}while(!isEndOfLine(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
}
private boolean isEndOfLine(int c) {
return c=='\n'||c=='\r'||c==-1;
}
}
}
版权声明:本文为dregs_原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。