Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
96054 孙嘉言 环形密码 C++ Compile Error 0 MS 0 KB 400 2024-11-02 17:55:10

Tests(0/0):


Code:

#include <cstring> #include <cmath> using namespace std; bool a[1001]={0}; int b[1001]; int n,m,i,f=0,t=0,s=0; int main(){ cin>>n>>m; for(int i=1;i<=n;i++){ cin>>b[i]; } while(f!=n){ t++; if(t>n) t=1; if(!a[t]) s++; if(s==m){ s=0; cout<<t<<' '; a[t]=1; m=b[t]; f++; } }cout<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:2: error: 'cin' was not declared in this scope
  cin>>n>>m;
  ^
Main.cc:18:10: error: 'cout' was not declared in this scope
          cout<