码迷,mamicode.com
首页 > 其他好文 > 详细

hdu 4891 The Great Pan (模拟)

时间:2014-07-29 21:58:42      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:多校 hdu4885 模拟

为什么要开__int64 巨巨在哪~

# include <stdio.h>
# include <algorithm>
# include <string.h>
using namespace std;
int main ()
{
	__int64 count;
    int i,len,cot,cot1,j,flag,n;
    char a[1001][1030];
    while(~scanf("%d",&n))
    {
        getchar();
        flag=0;
        count=1;
        cot1=1;
        int flag1=0;
        for(i=0;i<n;i++)
        {
            gets(a[i]);
            len=strlen(a[i]);
            for(j=0;j<len;j++)
            {
                if(a[i][j]=='{')
                    flag=1;
                if(a[i][j]=='}')
                    flag=0;
                if(flag)
                {
                    if(a[i][j]=='|')
                        cot1++;
                }
                else
                {
                    count*=cot1;
                    if(count>100000)
                    {
                        flag1=1;
                    }
                    cot1=1;
                }
            }
        }
        if(flag1)
            printf("doge\n");
        else
        {
            cot=0;
            cot1=1;
            flag=0;
            for(i=0;i<n;i++)
            {
                len=strlen(a[i]);
                for(j=0;j<len;j++)
                {
                    if(a[i][j]=='$')
                        cot++;
                    if(cot%2)
                    {
                        if(a[i][j]==' ')
                            cot1++;
                        else
                        {
                            
                            count*=cot1;
                            cot1=1;
                            if(count>100000)
                            {
                                flag=1;
                                printf("doge\n");
                                break;
                            }
                        }
                    }
                    else
                    {
                        count*=cot1;
                        cot1=1;
                        if(count>100000)
                        {
                            flag=1;
                            printf("doge\n");
                            break;
                        }
                    }            
                }
                if(flag)
                    break;
            }
            if(!flag)
                printf("%I64d\n",count);
        }
    }
    return 0;
}


hdu 4891 The Great Pan (模拟),布布扣,bubuko.com

hdu 4891 The Great Pan (模拟)

标签:多校 hdu4885 模拟

原文地址:http://blog.csdn.net/lp_opai/article/details/38277067

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!