Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
120881 | 袁龙浩 | 18第一次出现与最后一次出现的位置 | C++ | Compile Error | 0 MS | 0 KB | 679 | 2025-06-01 15:40:02 |
#include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ long long n,a[2001],m,min=0,max=0,x=0; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } cin>>m; for(int i=1;i<=n;i++){ if(a[i]==m){ x=1; min=i; break; } } if(x==0){ cout<<"-1"; return 0; } for(int i=n;i>=1;i--){ if(a[i]==m){ max=i; break; } } cout<<min<<" "<<max; return 0; }
Main.cc: In function 'int main()': Main.cc:8:5: error: 'cin' was not declared in this scope cin>>n; ^ Main.cc:22:9: error: 'cout' was not declared in this scope cout<<"-1"; ^ Main.cc:31:5: error: 'cout' was not declared in this scope cout<