The Great Pan

Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

Submit Status

Description

As a programming contest addict, Waybl is always happy to take part in various competitive programming contests. One day, he was competing at a regional contest of Inventing Crappy Problems Contest(ICPC). He tried really hard to solve a "geometry" task without success.

After the contest, he found that the problem statement
is ambiguous! He immediately complained to jury. But problem setter, the
Great Pan, told him "There are only four possibilities, why don't you
just try all of them and get Accepted?".

Waybl was really shocked. It is the first time he
learned that enumerating problem statement is as useful as trying to
solve some ternary search problem by enumerating a subset of possible
angle!

Three years later, while chatting with Ceybl, Waybl was
told that some problem "setters" (yeah, other than the Great Pan) could
even change the whole problem 30 minutes before the contest end! He was
again shocked.

Now, for a given problem statement, Waybl wants to know how many ways there are to understand it.

A problem statement contains only newlines and printable
ASCII characters (32 ≤ their ASCII code ≤ 127) except '{', '}', '|' and
'$'.

Waybl has already marked all ambiguity in the following two formats:

1.{A|B|C|D|...} indicates this part could be understand as A or B or C or D or ....

2.$blah blah$ indicates this part is printed in proportional
fonts, it is impossible to determine how many space characters there
are.

Note that A, B, C, D won't be duplicate, but could be empty. (indicate evil problem setters addedclarified it later.)

Also note that N consecutive spaces lead to N+1 different ways of understanding, not 2 N ways.

It is impossible to escape from "$$" and "{}" markups
even with newlines. There won't be nested markups, i.e. something like
"${A|B}$" or "{$A$|B}" or "{{A|B}|C}" is prohibited. All markups will be
properly matched.

 

Input

Input contains several test cases, please process till EOF.

For each test case, the first line contains an integer n,
indicating the line count of this statement. Next n lines is the problem
statement.

1 ≤ n ≤ 1000, size of the input file will not exceed 1024KB.
 

Output

For each test case print the number of ways to understand this statement, or "doge" if your answer is more than 105.
 

Sample Input

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!
 

Sample Output

4
4
doge
6
 
 
D - The Great Pan
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit Status Description
As a programming contest addict, Waybl is always happy to take part in various competitive programming contests. One day, he was competing at a regional contest of Inventing Crappy Problems Contest(ICPC). He tried really hard to solve a "geometry" task without success. After the contest, he found that the problem statement is ambiguous! He immediately complained to jury. But problem setter, the Great Pan, told him "There are only four possibilities, why don't you just try all of them and get Accepted?". Waybl was really shocked. It is the first time he learned that enumerating problem statement is as useful as trying to solve some ternary search problem by enumerating a subset of possible angle! Three years later, while chatting with Ceybl, Waybl was told that some problem "setters" (yeah, other than the Great Pan) could even change the whole problem 30 minutes before the contest end! He was again shocked. Now, for a given problem statement, Waybl wants to know how many ways there are to understand it. A problem statement contains only newlines and printable ASCII characters (32 ≤ their ASCII code ≤ 127) except '{', '}', '|' and '$'. Waybl has already marked all ambiguity in the following two formats: 1.{A|B|C|D|...} indicates this part could be understand as A or B or C or D or ....
2.$blah blah$ indicates this part is printed in proportional fonts, it is impossible to determine how many space characters there are. Note that A, B, C, D won't be duplicate, but could be empty. (indicate evil problem setters addedclarified it later.) Also note that N consecutive spaces lead to N+1 different ways of understanding, not 2 N ways. It is impossible to escape from "$$" and "{}" markups even with newlines. There won't be nested markups, i.e. something like "${A|B}$" or "{$A$|B}" or "{{A|B}|C}" is prohibited. All markups will be properly matched. Input
Input contains several test cases, please process till EOF.
For each test case, the first line contains an integer n, indicating the line count of this statement. Next n lines is the problem statement.
1 ≤ n ≤ 1000, size of the input file will not exceed 1024KB. Output
For each test case print the number of ways to understand this statement, or "doge" if your answer is more than 105. Sample Input 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! Sample Output 4 4 doge 6
    #include<stdio.h>
#include<string.h> char a[500000]; int main()
{
long long i,n,flag,ans,sum,flag2,num; while(scanf("%lld%*c",&n)!=EOF)
{
memset(a,0,sizeof(a)); for(i=0;i<n;i++)
{
gets(a+strlen(a));
}
//puts(a); flag=0;
flag2=0;
num=1;
ans=1; for(i=0; a[i]!='\n'; i++)
{
if(a[i]=='{')
{
flag=1;
sum=1;
}
if(a[i]=='}')
{
flag=0;
ans*=sum;
//printf("1%d* ", ans );
}
if(flag==1)
{
if(a[i]=='|')
sum++;
} if( flag2==1 && a[i]!=' ' && a[i-1]==' ')
{
ans*=num;
//printf("2%d* ", ans );
num=1;
} if(a[i]=='$')
{
if(flag2==0)
flag2=1;
else
flag2=0;
num=1;
}
if(flag2==1&&a[i]==' ')
num++;
if(ans>100000)
break;
}
if(ans>100000)
puts("doge");
else
printf("%lld\n",ans);
}
return 0;
}
 

The Great Pan的更多相关文章

  1. php7+apache2.4 (Windows7下),成功启动。(楼主另外提供了1个php7集成环境打包: http://pan.baidu.com/s/1qXwjpF2 ,如果你只是想了解一下,放在d盘根目录。)

    php7正式版已经发布,性能是php5.4的2倍.博主入手php7 新鲜了一把,下面是解决问题之后成功启动php7的记录. ( 电脑必须win7 sp1, .netframework4 ) Windo ...

  2. Kettle_使用Pan.bat执行转换、Kitchen.bat执行作业

    参考资料:http://www.cnblogs.com/wxjnew/p/3620792.html 注意:使用bat文件执行速度比执行在spoon.bat中执行慢很多 一.使用Pan.bat执行转换 ...

  3. iOS开发 在scrollView上增加滑动手势(Pan)

    view上有一个scrollView,现在想在view上加一个Pan手势,需求是:当向下划的时候,整个view动,但是scrollView不动:其它情况下scrollView动而view不动. -(B ...

  4. HDU 4891 The Great Pan (模拟)

    The Great Pan 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/D Description As a programm ...

  5. Pentaho Data Integration (三) Pan

    官网连接: http://wiki.pentaho.com/display/EAI/Pan+User+Documentation Pan Pan 是一个可以执行使用Spoon编辑的transforma ...

  6. pan

    百度云盘地址第一季http://pan.baidu.com/share/link?shareid=198342&uk=1191518428第二季http://pan.baidu.com/sha ...

  7. UESTC 1272 Final Pan's prime numbers(乱搞)

    题目链接 Description Final Pan likes prime numbers very much. One day, he want to find the super prime n ...

  8. ANSI X9.8标准 PIN xor PAN获取PIN BlOCK

    ANSI X9.8标准 PIN xor PAN获取PIN BlOCK 之前看到几篇介绍,把ANSI说成16个字节,真心扯淡,各种误人子弟,真正的ANSI算法其实是8个字节,具体格式如下: (1) AN ...

  9. Java实现3DES加密--及ANSI X9.8 Format标准 PIN PAN获取PIN BlOCK

    1, 采用银联ANSI X9.8标准 PIN xor PAN获取PIN BlOCK 2, 采用3Des进行加密 参考: des和3Des加密算法实现 要点:因为3DES是对称加密算法,key是24位, ...

  10. 百度网盘不限速下载软件 Pan Download

    百度网盘不限速下载软件 Pan Download Pan Download下载软件是一款电脑端的快速下载器软件,您可以通过Pan Download直接下载百度网盘中的资源,此款软件下载速度快,下载压缩 ...

随机推荐

  1. 关于Linux网络配置

    Linux网络配置 一:什么是网络接口卡以及如何查看网络接口的网络信息:在Linux系统中,主机的网络接口卡通常称为“网络接口”,我们可以使用ifconfig命令来查看网络 接口的信息(普通用户使用/ ...

  2. Python基础之迭代器

    迭代器的优点: 1.可以使用for循环遍历: 2.可以节省内存空间: 3.可以有序的访问集合(set)数据结构内的元素. 迭代器的缺点: 只能向前,不能后退. 可迭代对象与不可迭代对象: 可迭代对象: ...

  3. iOS collectionView添加类似tableView的tableHeaderView

    我们都知道UITableview有一个tableHeaderFooterView,这样我们在布局页面的时候,如果顶部有轮播图,可以直接把轮播图设置为tableView的HeaderFooterView ...

  4. [译]GLUT教程 - 整合代码1

    Lighthouse3d.com >> GLUT Tutorial >> Input >> The Code So Far 以下是前面几节的完整整合代码: #inc ...

  5. c++学习笔记4,派生类的构造函数与析构函数的调用顺序(一)

    測试源代码: //測试派生类的构造函数的调用顺序何时调用 //Fedora20 gcc version=4.8.2 #include <iostream> using namespace ...

  6. 【转】【Python学习】之哪些 Python 库让你相见恨晚?

    感谢作者:赖明星 文章链接地址:<哪些 Python 库让你相见恨晚?>

  7. 下载某资源文件并加载其中的所有Prefab到场景中

    using System.Collections; using System.Collections.Generic; using UnityEngine; /// <summary> / ...

  8. Xcode8:"subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0" 的警告

    运行xcode8遇到这个警告: subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_lev ...

  9. CSS3 线性渐变(linear-gradient)

    CSS3 Gradient 分为 linear-gradient(线性渐变)和 radial-gradient(径向渐变).而我们今天主要是针对线性渐变来剖析其具体的用法.为了更好的应用 CSS3 G ...

  10. 小团队Git协作流程

    git和svn 最大的差异在于git是分布式的管理方式而svn是集中式的管理方式. 集中式 集中式代码管理的核心是服务器,所有开发者在开始coding之前必须从服务器获取代码,然后开发,最后解决冲突, ...