#include <iostream> #include <algorithm> using namesapce std; int main(){ int n,q,a,b,size; while(scanf("%d",&n)!=EOF){ int num[100001],buf[100001]; for(int j=1;j<=n;j++){ scanf("%d",&num[j]); } scanf("%d",&q); for(int j=0;j<q;j++){ scanf("%d%d",&a,&b); size==0; for(int k=a;k<=b;k++){ buf[size++] = num[k]; } sort(buf,buf+size); printf("%d",buf[0]); } } return 0; } /* Main.cc:3:7: error: expected nested-name-specifier before 'namesapce' using namesapce std; ^ Main.cc: In function 'int main()': Main.cc:15:11: warning: statement has no effect [-Wunused-value] size==0; ^ Main.cc:19:24: error: 'sort' was not declared in this scope sort(buf,buf+size); ^ Main.cc:19:24: note: suggested alternative: In file included from /usr/include/c++/4.9/algorithm:62:0, from Main.cc:2: /usr/include/c++/4.9/bits/stl_algo.h:4705:5: note: 'std::sort' sort(_RandomAccessIterator __first, _RandomAccessIterator __last, ^ */ |
Double click to view unformatted code.