zoukankan      html  css  js  c++  java
  • 九度 1419 文献排序

    http://ac.jobdu.com/problem.php?id=1419

     1 #include <stdio.h>
    2 #include <string.h>
    3 #include <algorithm>
    4 using namespace std;
    5 struct Record{
    6 char orig_name[201];
    7 char trans_name[201];
    8 }record[201];
    9 void trans(int n)
    10 {
    11 int i;
    12 for(i=0;i<=strlen((record[n].orig_name));i++){
    13 if(record[n].orig_name[i]>='A'&&record[n].orig_name[i]<='Z'){
    14 record[n].trans_name[i]=record[n].orig_name[i]-'A'+'a';
    15 }else{
    16 record[n].trans_name[i]=record[n].orig_name[i];
    17 }
    18 }
    19 }
    20 bool cmp(struct Record a,struct Record b)
    21 {
    22 return strcmp(a.trans_name,b.trans_name)<0;
    23 }
    24 int main()
    25 {
    26 int n;
    27 while(scanf("%d",&n)!=EOF){
    28 getchar();
    29 int i;
    30 for(i=0;i<n;i++){
    31 gets(record[i].orig_name);
    32 trans(i);
    33 }
    34 sort(record,record+n,cmp);
    35 for(i=0;i<n;i++){
    36 puts(record[i].orig_name);
    37 }
    38 }
    39 }



  • 相关阅读:
    基于Spring的集群会话共享方案-spring session
    Tensorflow 模型线上部署
    Dijkstra算法
    BFS和DFS
    图的基本概念
    排序5
    排序4
    排序3
    排序2
    排序1
  • 原文地址:https://www.cnblogs.com/yangce/p/2404405.html
Copyright © 2011-2022 走看看