上帝造题五分钟

 1 #include<iostream>
 2 #include<algorithm>
 3 #include<cstdio>
 4 using namespace std;
 5 int main()
 6 {
 7     int str[2000],tmp[2000];
 8     int n,q,l,r,j;
 9     while(~scanf("%d%d",&n,&q))
10     {
11         for(int i=0;i<n;i++)
12             scanf("%d",&str[i]);
13         while(q--)
14         {
15             j=0;
16             scanf("%d%d",&l,&r);
17             for(int i=l;i<=r;i++)
18                 tmp[j++]=str[i];
19             int len=r-l+1;
20             sort(tmp,tmp+len);
21             printf("%d
",tmp[0]);
22         }
23     }
24 }
View Code
原文地址:https://www.cnblogs.com/WDKER/p/5161921.html