【Codeforces 493D】Vasya and Chess
阿新 • • 發佈:2019-02-28
black tokenize ces cpp 就是 buffered int() ati println
【鏈接】 我是鏈接,點我呀:)
【題意】
【題解】
會發現兩個皇後之間如果只有奇數個位置
也就是n%2==1
那麽第二個人總是贏的
因為如果white往下跑的話,black也能往下跑。
第二個人沒有輸的機會。
其他情況就是第一個人贏了...
【代碼】
import java.io.*; import java.util.*; public class Main { static InputReader in; static PrintWriter out; public static void main(String[] args) throws IOException{ //InputStream ins = new FileInputStream("E:\\rush.txt"); InputStream ins = System.in; in = new InputReader(ins); out = new PrintWriter(System.out); //code start from here new Task().solve(in, out); out.close(); } static int N = 50000; static class Task{ int n; public void solve(InputReader in,PrintWriter out) { n = in.nextInt(); if ( n%2==0) { out.println("white\n1 2"); }else { out.println("black"); } } } static class InputReader{ public BufferedReader br; public StringTokenizer tokenizer; public InputReader(InputStream ins) { br = new BufferedReader(new InputStreamReader(ins)); tokenizer = null; } public String next(){ while (tokenizer==null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(br.readLine()); }catch(IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } } }
【Codeforces 493D】Vasya and Chess