Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
111848 石晋骁 环形密码 C++ Compile Error 0 MS 0 KB 804 2025-03-07 14:24:23

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int n,m ;// n是人数,m是谁报道m谁死 int hz[1000];// hz[i]=1就表示是第i个人挂了,hz[i]=0表示第i个人活着 int main(){ cin >>n>>m; int ren =0; int bs = 0; int live = n;// 一开始活着的人是n个 while(live != 1){ // 只要活着的人不是一个,游戏就得继续 ren++; if(ren == n+1){ // 如果是第n+1个人报的,其实就相当于是第1个人报 ren = 1; } if(hz[ren]== 1){// 这个人已经挂了,跳过 continue; } bs++;// 没有跳过,说明该他报数 if(bs == m){ hz[ren]= 1;// 这个人噶了 cout<< ren<<" "; bs = 0; live--;// 活着的人少一 } } return 0; }


Run Info:

Main.cc:3:1: error: stray '\357' in program
 int n,m ;// n是人数,m是谁报道m谁死
 ^
Main.cc:3:1: error: stray '\274' in program
Main.cc:3:1: error: stray '\214' in program
Main.cc:3:9: error: expected initializer before 'm'
 int n,m ;// n是人数,m是谁报道m谁死
         ^
Main.cc: In function 'int main()':
Main.cc:6:11: error: 'n' was not declared in this scope
     cin >>n>>m;
           ^
Main.cc:6:14: error: 'm' was not declared in this scope
     cin >>n>>m;
              ^