zoukankan      html  css  js  c++  java
  • 【Codeforces 493D】Vasya and Chess

    【链接】 我是链接,点我呀:)
    【题意】

    【题解】

    会发现两个皇后之间如果只有奇数个位置 也就是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
    1 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());
            }
        }
    }
    
  • 相关阅读:
    ViewModel和LiveData问题思考与解答
    vps_centos_7_系统环境常规配置备忘
    JVM内存管理&GC
    sping注解
    ibatis order by 防止sql注入
    好用的绿色工具(mss2sql,jd-gui)
    mysql优化
    Spring事务
    好文分享_java堆栈的区别
    Linux usual cmd
  • 原文地址:https://www.cnblogs.com/AWCXV/p/10452789.html
Copyright © 2011-2022 走看看