Created
February 20, 2019 12:16
-
-
Save stmtk1/ff6890d0ca1c26d7611afef1d0f24020 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.InputStream; | |
import java.io.IOException; | |
class MyScanner{ | |
InputStream stream; | |
public MyScanner(){ | |
stream = System.in; | |
} | |
public int nextInt(){ | |
int ret = 0; | |
try{ | |
while(true){ | |
char readed = (char)stream.read(); | |
if(readed < '0' || readed > '9'){ | |
break; | |
} | |
ret = ret * 10 + (readed - '0'); | |
} | |
}catch(IOException e){ | |
e.printStackTrace(); | |
}finally{ | |
return ret; | |
} | |
} | |
} | |
class Main { | |
public static void main(String args[]) { | |
System.out.println("Hello world"); | |
MyScanner sc = new MyScanner(); | |
System.out.println(sc.nextInt()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment