zoukankan      html  css  js  c++  java
  • 破损的键盘 (Broken Keyboard,UVa 11988)

     1 #include <iostream>
     2 #include <string.h>
     3 #include <string>
     4 #include <fstream>
     5 #include <algorithm>
     6 #include <stdio.h>
     7 #include <vector>
     8 #include <queue>
     9 #include <set>
    10 #include <cmath>
    11 using namespace std;
    12 const double eps = 1e-8;
    13 const double pi=acos(-1.0);
    14 const int INF=0x7fffffff;
    15 unsigned long long uINF = ~0LL;
    16 #define MAXN 1007
    17 #define mod 1000000007
    18 typedef long long LL;
    19 char s[100010],ans[100010];
    20 int main()
    21 {
    22     while(scanf("%s",s)!=EOF)
    23     {
    24         int len=strlen(s);
    25         for(int i=0;i<len;i++)
    26         {
    27             if(s[i]=='['||s[i]==']')
    28             ans[i]='';
    29             else ans[i]=s[i];
    30         }
    31         ans[len]='';
    32         for(int i=len-1;i>=0;i--)
    33         if(s[i]=='[')printf("%s",ans+i+1);
    34         if(s[0]!='['&&s[0]!=']')printf("%s",ans);
    35         for(int i=0;i<len;i++)
    36         if(s[i]==']')printf("%s",ans+i+1);
    37         printf("
    ");
    38     }
    39 
    40     return 0;
    41 }
  • 相关阅读:
    007_2 (变式)青蛙跳台阶
    008 二进制中1的个数
    009 数值的整数次方
    007_1 斐波那契数列的非递归解法
    Linux TTY函数跟踪
    Linux UART介绍
    Linux TTY介绍
    Linux音频编程
    Jasper语音助理
    Raspberry Pi使用
  • 原文地址:https://www.cnblogs.com/TO-Asia/p/3224335.html
Copyright © 2011-2022 走看看