zoukankan      html  css  js  c++  java
  • NYOJ 283

     1 #include <cstdio>
     2 #include <cstdlib>
     3 #include <iostream>
     4 #include <cstring>
     5 #include <algorithm>
     6 #include <string>
     7 using namespace std;
     8 /*
     9 bool cmp(char *a,char *b)
    10 {
    11      int len1 = strlen(a);
    12      int len2 = strlen(b);
    13      return len1>len2;
    14 }
    15 */
    16 int cmp(const void *a,const void *b)
    17 {
    18      int len1 = strlen((char *)a);
    19      int len2 = strlen((char *)b);
    20      return len1>len2;
    21 }
    22      
    23 int main()
    24 {
    25      char str[16][25];
    26      int i,j,k=1;
    27      int  num;
    28      while(scanf("%d",&num),num)
    29      {
    30           memset(str, 0, sizeof(str)); 
    31           for(i=0;i<num;i++)
    32                cin>>str[i];
    33           //sort(str,str+num,cmp);
    34           qsort(str,num,25,cmp);
    35           printf("SET %d\n",k);
    36           k++;
    37           for(i=0;i<num;i+=2)
    38                cout<<str[i]<<endl;
    39           for(j=num-1-num%2;j>0;j-=2) 
    40                cout<<str[j]<<endl;
    41      }
    42      //while(1);
    43      return 0;
    44 }
  • 相关阅读:
    Delphi Excel 操作大全
    ThreadLocal类
    MyBatis实战总结
    MyBatis入门
    Mybatis逆向工程
    2020年全国高校计算机能力挑战赛初赛java组
    集合论基础
    命题与逻辑
    Redis技术概述
    UML图中6种箭头的含义
  • 原文地址:https://www.cnblogs.com/hxsyl/p/2686012.html
Copyright © 2011-2022 走看看