题解 1047: [编程入门]报数问题

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

约瑟夫的环

摘要:解题思路:注意事项:参考代码:import java.util.Scanner;public class wc {static Scanner sc=new Scanner(System.in);pu……

C语言改版001

摘要:#include<stdio.h>#include<stdlib.h>typedef struct student{    int number;    struct student*next;}no……

成了,经典的约瑟夫环问题 有n人围成一圈,顺序排号。从第1个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来的第几号的那位。

摘要:解题思路:建立c++的list容器,将数据输入,每搁三个判断一下,删除,继续判断,最后找到剩余的元素,输出注意事项:本次使用,学到了auto的新用法 参考代码:#include<iostream> ……

只需调用<iostream>!用数组来依次报数。

摘要:解题思路:假设最开始有n个人在报数,因此定义一个储存n个数字的数组。用嵌套循环依次访问每个元素,每访问一次,cou就+1,当cou为3的倍数时,把该元素变成0(即该玩家出局)。每当所有元素都访问一遍后……

c语言简单数组解报数问题

摘要:解题思路:注意事项:参考代码:#includeint main(){ int arr[201]; int n,i,j; scanf ("%d",&n); for (i=0;i<n;i++)    //……

一定要细心啊(不难)

摘要:解题思路:注意事项:参考代码:#include<stdio.h> int main(void) {     int n;     printf("Please enter the number……

real_count经典命名

摘要:#include<stdio.h> int main(void) {     int n;     scanf("%d", &n);     int flag[100] = {0};   ……

简单易懂 给个赞 嘻嘻

摘要:解题思路:注意事项:参考代码:#include<stdio.h>#define N 10000void text(int * a , int n){ int co……