zoukankan      html  css  js  c++  java
  • nyoj-675-Sinking Ship

     1 #include<stdio.h>
     2 #include<string.h>
     3 struct SHIP
     4 {
     5     char name[15];
     6     char id[10];
     7 }ship[110];
     8 int main()
     9 {
    10     int n,i;
    11     while(scanf("%d",&n)!=EOF)
    12     {
    13         for(i=0;i<n;i++)
    14         {
    15             fflush(stdin);
    16             scanf("%s %s",ship[i].name,ship[i].id);
    17         }
    18         for(i=0;i<n;i++)
    19         {
    20             if(strcmp(ship[i].id,"rat")==0)
    21             printf("%s
    ",ship[i].name);
    22         }
    23         for(i=0;i<n;i++)
    24         {
    25             if(strcmp(ship[i].id,"woman")==0||strcmp(ship[i].id,"child")==0)
    26             printf("%s
    ",ship[i].name);
    27         }
    28         for(i=0;i<n;i++)
    29         {
    30             if(strcmp(ship[i].id,"man")==0)
    31             printf("%s
    ",ship[i].name);
    32         }
    33         for(i=0;i<n;i++)
    34         {
    35             if(strcmp(ship[i].id,"captain")==0)
    36             printf("%s
    ",ship[i].name);
    37         }
    38     }
    39     return 0;
    40 }
  • 相关阅读:
    jquery index与eq
    尝试一下
    document
    2017-03-28 java script DOM操作
    2017-03-25 CSS 样式
    CSS 样式表分类
    CSS 样式表
    HTML 框架
    表格
    HTML常用标记
  • 原文地址:https://www.cnblogs.com/nylg-haozi/p/3184010.html
Copyright © 2011-2022 走看看