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

zoj 3465 The Hive

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

zoj 3465 The Hive

#include <iostream>#include <cstdio>#include <cstring>using namespace std;char hive[9][12];int top[9];const int hi[9]={6,7,8,9,10,9,8,7,6};const int ku[9]={5,4,3,2,1,2,3,4,5};const char mpK[25][25]={ "         _n", "       _/ \_n", "     _/ \_/ \_n", "   _/ \_/ \_/ \_n", " _/ \_/ \_/ \_/ \_n",  "/ \_/ \_/ \_/ \_/ \n", "\_/ \_/ \_/ \_/ \_/n",  "/ \_/ \_/ \_/ \_/ \n", "\_/ \_/ \_/ \_/ \_/n",  "/ \_/ \_/ \_/ \_/ \n", "\_/ \_/ \_/ \_/ \_/n",  "/ \_/ \_/ \_/ \_/ \n", "\_/ \_/ \_/ \_/ \_/n",  "/ \_/ \_/ \_/ \_/ \n", "\_/ \_/ \_/ \_/ \_/n",  "/ \_/ \_/ \_/ \_/ \n", "\_/ \_/ \_/ \_/ \_/n",  "/ \_/ \_/ \_/ \_/ \n", "\_/ \_/ \_/ \_/ \_/n",  "  \_/ \_/ \_/ \_/n", "    \_/ \_/ \_/n",  "      \_/ \_/n", "        \_/n"};int main(){    int n;while(scanf("%d",&n)!=EOF){    int cas=0;    memset(hive,'.',sizeof(hive));    memset(top,0,sizeof(top));    char mp[25][25];    memcpy(mp,mpK,sizeof(mpK));    char st[3];    for(int i=0;i<n;i++)    {        scanf("%s",st);        int xx=st[0]-'A';        if(top[xx]>hi[xx]) continue;        if(hive[xx][top[xx]-1]==st[1])   {top[xx]--;cas++;}        else hive[xx][top[xx]++]=st[1];    }    for(int i=0;i<9;i++)        for(int j=0;j<top[i];j++)mp[22-ku[i]-j*2][i*2+1]=hive[i][j];    printf("The number of candy is %d.n",cas);    for(int i=0;i<23;i++)         printf("%s",mp[i]);}    return 0;}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/374744.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

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

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