9 I‘ll shoot the magic arrow several times on the ground, and of course the arrow will leave some holes on the ground. When you connect three holes with three line segments, you may get a triangle. {|It is hole! Common sense!| No Response, Read Problem Statement|don‘t you know what a triangle is?} 1 Case $1: = >$ 5 $/*This is my code printed in proportional font, isn‘t it cool?*/ printf("Definitely it is cooooooool %d\n",4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4 * 4);$ 2 $Two space$ and {blue| red} color!
4 4 doge 6
体验过什么叫WA到死么?-.-!不罗嗦了,注意的就是其中的方式总量是会超过int范围的,所以要及时判断出来,还有一个,也就是把我卡了半天的,就是判断文件大小,每次输入最大文件是1024KB,一个字符是1B,所以每次输入的字符串长度都是百万++的 T.T 所果断开了500W的才过
代码太简单,所以不注释了
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char str[5000000];
int main (void)
{
int n,i,j,k,l;
__int64 num,s;
while(~scanf("%d%*c",&n))
{
num=1;
k=0;
s=0;
while(n--&&gets(str))
{
l=strlen(str);
if(num>100000)continue;
for(i=0;i<l;i++)
{
if(str[i]==‘$‘||str[i]==‘{‘||str[i]==‘}‘)
{
if(k!=0)
{
if(num*(s+1)>100000)
{
num=100001;
break;
}
num*=s+1;
s=0;
k=0;
}
else if(str[i]==‘$‘)k=1;
else k=2;
}else if(k==1)
{
if(str[i]==‘ ‘)
{
s++;
if(s>=100000)
{
num=100001;
break;
}
}
else
{
if(num*(s+1)>100000)
{
num=100001;
break;
}
num*=s+1;
s=0;
}
}else if(k==2)
{
if(str[i]==‘|‘)
{
s++;
if(s>=100000)
{
num=100001;
break;
}
}
}
}
}
if(num>100000)puts("doge");
else printf("%I64d\n",num);
}
return 0;
}
HDU--4891--The Great Pan--暴力搜索,布布扣,bubuko.com
HDU--4891--The Great Pan--暴力搜索
原文:http://blog.csdn.net/jingdianitnan/article/details/38304425