规定每隔n局出现一次平局,其余全胜,输入end结束。
运行实例
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int K = scanner.nextInt();
String str = scanner.next();
ArrayList<String> array = new ArrayList<String>();
while (!"End".equals(str)) {
array.add(str);
str = scanner.next();
}
int n = 1;
for (String string : array) {
if (n % (K + 1) != 0) {
if ("ChuiZi".equals(string)) {
System.out.println("Bu");
} else if ("JianDao".equals(string)) {
System.out.println("ChuiZi");
} else if ("Bu".equals(string)) {
System.out.println("JianDao");
}
} else {
System.out.println(string);
}
n++;
}
} // main
}