【Codeforces 493D】Vasya and Chess
and Codeforces
2023-09-14 09:03:44 时间
【链接】 我是链接,点我呀:)
【题意】
【题解】
会发现两个皇后之间如果只有奇数个位置 也就是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());
}
}
}
相关文章
- [Ramda] Pick and Omit Properties from Objects Using Ramda
- [Now] Configure secrets and environment variables with Zeit’s Now
- Python - 数据结构与算法(Data Structure and Algorithms)
- [AWS] Create MySQL database in RDS and connect from local / EC2
- [PWA] Disable Text Selection and Touch Callouts in a PWA on iOS
- [AngularJS] Javascript scope and AngularJS $scope
- 【Codeforces Round #635 (Div. 2) B】Kana and Dragon Quest game
- 【Codeforces 493C】Vasya and Basketball
- 【CodeForces 574B】Bear and Three Musketeers
- 【Educational Codeforces Round 48 (Rated for Div. 2) C】 Vasya And The Mushrooms
- 【Good Bye 2017 A】New Year and Counting Cards
- 【Codeforces Round #447 (Div. 2) B】Ralph And His Magic Field
- 【14.94%】【codeforces 611E】New Year and Three Musketeers
- 【30.36%】【codeforces 740D】Alyona and a tree
- 【codeforces 750D】New Year and Fireworks
- 【codeforces 750B】New Year and North Pole
- 【codeforces 798C】Mike and gcd problem
- 【codeforces 514A】Chewbaсca and Number
- 【codeforces 515C】Drazil and Factorial
- 【Codeforces Round #435 (Div. 2) B】Mahmoud and Ehab and the bipartiteness
- 【Codeforces Round #428 (Div. 2) A】Arya and Bran
- Codeforces 443 B. Kolya and Tandem Repeat
- (hdu step 6.3.2)Girls and Boys(比赛离开后几个人求不匹配,与邻接矩阵)
- C. Arthur and Table(Codeforces Round #311 (Div. 2) 贪心)
- Codeforces Round #311 (Div. 2) E - Ann and Half-Palindrome(字典树+dp)
- Codeforces Round #216 (Div. 2) E. Valera and Queries (BIT)