摘要: #include #include using namespace std;int main(){ int n; scanf("%d",&n); while(n--) { int m; int a[100]; scanf("%d",&m); for (int i=0; i<m; i++) scanf("%d",&a[i]); sort(a,a+m); printf("%d\n",a[1]); } return 0; } 阅读全文
posted @ 2013-12-24 20:56 forever97 阅读(113) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;int main(){ int n; while (scanf("%d",&n)!=EOF) { int a[10010]; for (int i=0; i<n; i++) scanf("%d",&a[i]); sort(a,a+n); int begin=0,end=n-2,flag=1; printf("%d",a[n-1]); while (begin<=end) { ... 阅读全文
posted @ 2013-12-24 20:46 forever97 阅读(237) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std;struct node{ string name,begin,end;}a[1000];int cmp1(node a,node b) { return a.beginb.end;}int main(){ int n,m,i; cin>>n; while(n--) { cin>>m; for(i=0;i>a[i].name>>a[i].begin>>a[i].end; sort(a,a+m,cmp1); cout<<... 阅读全文
posted @ 2013-12-24 19:57 forever97 阅读(159) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;struct arc{ int a; int b;};bool cmp(arc x,arc y){ return (x.a+"); for (int j=3; j\n"); } printf("\n"); } } return 0;} 注意点:在这道题中学会了sort的各种用法,还有结构体的定义,需要注意的是结构体定义完后一定要加上‘;’。 阅读全文
posted @ 2013-12-24 19:13 forever97 阅读(147) 评论(0) 推荐(0) 编辑