如果发现广告等破坏行为,请尽量将条目恢复到较早的版本而不是把相应内容直接删除,谢谢合作。

URAL/1654

来自"NOCOW"

跳转到: 导航, 搜索

哎,网上看的。。一开始没太看懂题目。。。

栈的小应用吧。

#include <cstdio>
#include <cstdlib>
#include <cstring>
char str[250000] ;
int main()
{
    int pstr = 0 ;
    while(scanf("%c",&str[pstr]) != EOF)
    {
        if ('\n' == str[pstr])  break;
        if ((pstr-1 >= 0) && (str[pstr-1] == str[pstr]))
            pstr--;
        else  pstr++;
    }
    for (int i=0;i<=pstr;i++)
        printf("%c",str[i]);
    printf("\n");
    return 0;
}

zzy

个人工具