//
3 耶稣有13个门徒,其中有一个就是出卖耶稣的叛徒,请用排除法找出这位叛徒:13人围坐一圈,从第一个开始报号:1,2,3,1,2,3...。凡是报到“3”就退出圈子,最后留在圈子内的人就是出卖耶稣的叛徒。请找出它原来的序号。
// int a[13] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
// int count = 0;//记录报的数1, 2, 3
// int number = 13;
// while (number > 1) {
// for (int i = 0; i < 13; i++) {
// if (a[i] != 0) {
// count++;
// }
// if (count == 3) {
// a[i] = 0;
// count = 0;
// number -= 1;
// }
//
//
// }
// }
// for (int i = 0; i < 13; i++) {
// if (a[i] != 0) {
// printf("出卖耶稣的叛徒是%d", a[i]);
// }
// }
// int a[13] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
// int count = 0;//记录报的数1, 2, 3
// int number = 13;
// while (number > 1) {
// for (int i = 0; i < 13; i++) {
// if (a[i] != 0) {
// count++;
// }
// if (count == 3) {
// a[i] = 0;
// count = 0;
// number -= 1;
// }
//
//
// }
// }
// for (int i = 0; i < 13; i++) {
// if (a[i] != 0) {
// printf("出卖耶稣的叛徒是%d", a[i]);
// }
// }