| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 143405 | 李茗宇 | 18查找该数出现的位置 | C++ | Compile Error | 0 MS | 0 KB | 617 | 2026-01-14 18:53:51 |
#include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,l=0,f=0,r=0,y; cin>>n; int a[n+1]; for(int i=1;i<=n;i++){ cin>>a[i]; } cin>>y; for(int i=1;i<=n;i++){ if(a[i]==y){ l=i; f=1; break; } } if(f==0){ cout<<-1; return 0; } for(int i=n;i>=1;i--){ if(a[i]==y){ r=i; break; } } cout<<l<<' '<<r; return 0; }
Main.cc: In function 'int main()':
Main.cc:7:5: error: 'cin' was not declared in this scope
cin>>n;
^
Main.cc:21:9: error: 'cout' was not declared in this scope
cout<<-1;
^
Main.cc:30:1: error: 'cout' was not declared in this scope
cout<