栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

poj 1126 Simply Syntax

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

poj 1126 Simply Syntax

#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string.h>using namespace std;#define maxl 500char st[maxl];int find(char *st){    if (st[0] <= 'z' && st[0] >= 'p')        return 1;    if (st[0] == 'N')    {        int x = find(st + 1);        if (x == -1) return x;        return 1 + x;    }    if (st[0] == 'I' || st[0] == 'D' || st[0] == 'E' || st[0] == 'C')    {        int x = find(st + 1);        if (x == -1) return x;        int y = find(st + 1 + x);        if (y == -1) return x;        return 1 + x + y;    }    return -1;}int main(){    while (scanf("%s", st) == 1)    {        if (find(st) == (signed int)strlen(st)) printf("YESn");        else printf("NOn");    }    return 0;}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/375040.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号