zoukankan      html  css  js  c++  java
  • 团体程序设计天梯赛 L1-011. A-B

    读入的是字符串,数组大小至少为字符串长度+1

     1 #include <stdio.h> 
     2 #include <stdlib.h>
     3 #include <string.h>
     4 #include <stdbool.h>
     5 
     6 char str[10001],str1[10001];
     7 bool vis[128];
     8 bool v;
     9 
    10 int main()
    11 {
    12     long i;
    13     char c;
    14     gets(str);
    15     for (i=0;i<128;i++)
    16         vis[i]=true;
    17     v=true;
    18     //contain ' '
    19     gets(str1);
    20     for (i=0;i<strlen(str1);i++)
    21     {
    22         c=str1[i];
    23         if (c==' ')
    24             v=false;
    25         else
    26             vis[(long)c]=false;
    27     }
    28     for (i=0;i<strlen(str);i++)
    29     {
    30         if (str[i]==' ')
    31         {
    32             if (v)
    33                 printf("%c",str[i]);
    34         }
    35         else
    36         {
    37             if (vis[(long)str[i]])
    38                 printf("%c",str[i]);
    39         }
    40     }
    41     printf("
    ");
    42     return 0;
    43 }
  • 相关阅读:
    bzoj3224
    [洛谷日报第62期]Splay简易教程 (转载)
    bzoj1588
    codeforces467C
    codeforces616B
    codeforces379C
    codeforces545C
    codeforces285C
    codeforces659C
    快读代码level.2
  • 原文地址:https://www.cnblogs.com/cmyg/p/8574637.html
Copyright © 2011-2022 走看看