我这里有一个烦人的案例;其中我无法正确输入。我一直通过 接受输入Scanner
,不习惯BufferedReader
.
输入格式
First line contains T, which is an integer representing the number of test cases.
T cases follow. Each case consists of two lines.
First line has the string S.
The second line contains two integers M, P separated by a space.
例子
Input:
2
AbcDef
1 2
abcabc
1 1
到目前为止我的代码:
public static void main (String[] args) throws java.lang.Exception
{
BufferedReader inp = new BufferedReader (new InputStreamReader(System.in));
int T= Integer.parseInt(inp.readLine());
for(int i=0;i<T;i++) {
String s= inp.readLine();
int[] m= new int[2];
m[0]=inp.read();
m[1]=inp.read();
// Checking whether I am taking the inputs correctly
System.out.println(s);
System.out.println(m[0]);
System.out.println(m[1]);
}
}
输入上述示例时,我得到以下输出:
AbcDef
9
49
2
9
97