hdu 4891---水的问题 但WA非常多
这个问题是在一个坑----即使在使用long long 这将是超出范围
自己显得很长的时间去阅读很多次的称号仍然没想到
当时的想法是要记住----无论如何,我用long long 已经最大范围。当然不能用更大的类型--即使unsigned它是唯一的 比long long 大一倍。如今回头看,这样的想法太唯心,不是理性分析的结果啊,,
代码:
//1005
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <iostream>
using namespace std;
#define ll long long
const ll lim=1e5; int main()
{
//freopen("hdu1005.txt","r",stdin);
ll cnt,ans,kr,sp,n;
char c;
int last;
bool flag=0;
while(~scanf("%I64d",&n))
{
flag=0;
getchar();
cnt=kr=sp=0;
ans=1;
while(1)
{
c=getchar();
if(c == '\n')cnt++;
if(cnt>=n || c==EOF)break;
//{}
if(c == '$')
{
kr=last=0;
while(1)
{
c=getchar();
if(c == '\n'){cnt++;if(kr)last=1;continue;}
if(c == ' ')kr++;
//if(c != ' ' && c == '\n')conti
if(c != ' ' && kr){if(ans>lim)flag=1;ans*=(kr+1);kr=0;}
if(c == '$')break;
}
if(c != ' ' && kr){if(ans>lim)flag=1;ans*=(kr+1);kr=0;}
////
}
if(c == '{')
{
sp=0;
while(1)
{
c=getchar();
if(c == '\n'){cnt++;}
if(c == '|'){sp++;}
if(c == '}')break;
}
if(ans>lim)flag=1;
ans*=(sp+1);
sp=0;
}
}
if(ans>lim||flag)printf("doge\n");
else printf("%I64d\n",ans);
}
return 0;
}
hdu 4891---水的问题 但WA非常多的更多相关文章
- 2014联合三所学校 (HDU 4888 HDU 4891 HDU 4893)
HDU 4891 The Great Pan 注册标题 他怎么说,你怎么样 需要注意的是乘法时,它会爆炸int 代码: #include<iostream> #include<c ...
- HDU 4891 The Great Pan (字符串处理)
题目链接:HDU 4891 The Great Pan 求一串字符有多少种不同的意思,当中关心'{','}'之间的'|'. 和'$','$'之间的空格,连续N个空格算N+1种. AC代码: #incl ...
- HDU-1042-N!(Java大法好 && HDU大数水题)
N! Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Subm ...
- hdu 4891 模拟水题
http://acm.hdu.edu.cn/showproblem.php?pid=4891 给出一个文本,问说有多少种理解方式. 1. $$中间的,(s1+1) * (s2+1) * ...*(sn ...
- hdu 4464 水
http://acm.hdu.edu.cn/showproblem.php?pid=4464 现场赛总会有水题,这就是最水的一道,预计也就是能当高校的上机题,保研用,呵呵~~~ #include &l ...
- HDU 5391 水题。
E - 5 Time Limit:1500MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- 2014多校第三场1005 || HDU 4891 The Great Pan(模拟)
题目链接 题意 : 给你n行字符串,问你有多少种理解方式.有两大类的理解 (1){A|B|C|D|...}代表着理解方式可以是A,可以是B或C或者D. (2)$blah blah$,在$$这两个符号中 ...
- hdu 1544 水题
水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...
- hdu 3357 水题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3357 #include <cstdio> #include <cmath> # ...
随机推荐
- 向大家推荐个android的游戏引擎——cocos2d-x
最近发现单单用android自带的功能函数来编写游戏,往往有很大的局限性,即耗时长,调试繁琐,没有一定的框架.所以博主发现了游戏引擎这个好东西,游戏引擎所拥有的架构和功能函数,使得游戏的编写更加得心应 ...
- ExtJs4 笔记(6) Ext.MessageBox 消息对话框
本篇演示消息对话框的用法,ExtJs封装了可能用到的各类消息框,并支持自定义的配置. 如下是用到的html: [html] <h1>各种消息框</h1> <div id= ...
- 绘制FastMM内存分配流程图(小块内存分配)
http://blog.csdn.net/henreash/article/details/38751353
- 定位vc运行时库问题 依赖问题,屡试不爽的一招
用vc 菜单 文件| 打开|指定EXE或DLL,如有指定运行时库,则PE文件的资源中可以看到manifest 配置节 然后据此判断EXE依赖的运行时库, 再根据编译选项调整 运行时库设置
- java定义和实现接口
1.定义接口 使用interface来定义一个接口.接口定义同类的定义类似,也是分为接口的声明和接口体.当中接口体由常量定义和方法定义两部分组成.定义接口的基本格式例如以下: [修饰符] in ...
- HNCU1100:彩票
http://hncu.acmclub.com/index.php?app=problem_title&id=111&problem_id=1100 题目描述 有一种彩票的玩法是从1~ ...
- How to write simple HTTP proxy with Boost.Asio
How to write simple HTTP proxy with Boost.Asio How to write simple HTTP proxy with Boost.Asio Russia ...
- a++为啥不能用作左值
原地址:http://wy892648414.blog.163.com/blog/static/212212135201378496591/ 1)首先说左值和右值的定义: 变量和文字常量都有存储区,并 ...
- RH033读书笔记(17) - Summary
End of Unit 1 • Questions and Answers • Summary • Open source and the right to modify • The GNU Proj ...
- 第二篇Activity:2、任务和返回堆栈(Tasks and Back Stack)之基本介绍
参考:http://developer.android.com/guide/components/tasks-and-back-stack.html 在Android中,一个应用程序里面,通常包含了多 ...