Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
165107 陈开远 【一维数组】数组元素移动(1) C++ Compile Error 0 MS 0 KB 397 2026-11-09 20:33:17

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; stack<int> s; int main(){ int i; int n,cur=1; int temp=0; int a[1001]; cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<=n;i++) { while(cur<=a[i]) } s.push(cur);cur++; { if(s.top()==a[i]) s.pop(); else } cout<<"NO"<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:15:1: error: expected primary-expression before '}' token
 }
 ^
Main.cc:21:1: error: expected primary-expression before '}' token
 }       
 ^
Main.cc:7:8: warning: unused variable 'temp' [-Wunused-variable]
    int temp=0;
        ^