AcWing 4606. Java直接解132ms
原题链接
简单
import java.util.*;
import java.io.*;
class Main {
static PrintWriter pw;
private void run() throws IOException {
// read_write_file(); // comment this before submission
FastScanner fs = new FastScanner();
char[] s = fs.readLine().toCharArray();
pr((s[s.length - 1] - '0') % 2 == 0 ? 0 : 1);
}
private final String INPUT = "input.txt";
private final String OUTPUT = "output.txt";
void read_write_file() {
FileInputStream instream = null;
PrintStream outstream = null;
try {
instream = new FileInputStream(INPUT);
outstream = new PrintStream(new FileOutputStream(OUTPUT));
System.setIn(instream);
System.setOut(outstream);
} catch (Exception e) {
}
}
public static void main(String[] args) throws IOException {
pw = new PrintWriter(System.out);
new Main().run();
pw.close();
}
<T> void pr(T t) {
pw.println(t);
}
class FastScanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
String next() {
while (!st.hasMoreTokens())
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
int[] readArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = nextInt();
return a;
}
String readLine() throws IOException {
return br.readLine();
}
}
void tr(Object... o) {
pw.println(Arrays.deepToString(o));
}
}