解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class A1047 {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b[] = new int[a];
int n = 0;
loop: for (;;) {
for (int i = 0; i < b.length; i++) {
if (b[i] == 0)
n++;
if (n % 3 == 0) {
b[i] = 1;
n = 0;
}
int s = 0;
for (int x = 0; x < b.length; x++) {
if (b[x] == 0)
s++;
}
if (s == 1) {
for (int x = 0; x < b.length; x++) {
if (b[x] == 0) {
System.out.println(x+1);
break loop;
}
}
}
}
}
}
}
0.0分
2 人评分