hdu 4891The Great Pan -----------2014 Multi-University Training Contest 3
来源:互联网 发布:沈阳直销软件 编辑:程序博客网 时间:2024/06/06 16:24
题目大意:
结果ans开始为1,当遇到{||||||} 结构时ans=ans*(|的个数+1),当遇上$ 888 888 $结构时,看其中连续空格数,例子中有三段连续空格每段为n,m,q(n=m=q=1),ans=ans*(n+1)*(m+1)*(q+1),最后如果ans<=100000 输出ans 否则输出doge。
按照要求写就行了,但是要注意细节决定成败。
我的代码:
#include <cstdio>#include <iostream>#include <string>using namespace std;int main (){ //freopen("input.in","r",stdin); //freopen("output.out", "w", stdout); int n; while (scanf("%d",&n)!=EOF){ string s1,s2; getline (cin,s2); for (int i=0;i<n;i++){ getline (cin,s2); s1=s1+s2; } //cout<<"n="<<n<<endl; //cout<<s1<<endl; long long x=1,y=1,ans=1; bool hx;hx=false; bool lh;lh=false; for (int i=0;i<s1.size();i++){ if (s1[i]=='|'&&lh) x++; if (s1[i]=='{'&&!lh) lh=true; if (s1[i]=='}'&&lh) { lh=false; ans=ans*x; if (ans>100000) break; x=1; } if (s1[i]=='$'){ if (hx) { hx=false; } else hx=true; } if (hx&&s1[i]==' '){ long long yy=1; while (s1[i]==' '&&i<=s1.size()) { yy++;i++; } ans=ans*yy; if (ans>100000) break; i--; } if (x>100000) { ans=100001; break; } } if (ans<=100000) cout<<ans<<endl; else cout<<"doge"<<endl; } return 0;}
0 0
- hdu 4891 The Great Pan---2014 Multi-University Training Contest 3
- hdu 4891The Great Pan -----------2014 Multi-University Training Contest 3
- 【2014 Multi-University Training Contest 3】 The Great Pan
- hdu4891 The Great Pan 2014 Multi-University Training Contest 3
- 【阅读理解】【2014 Multi-University Training Contest 3】The Great Pan
- 2017 Multi-University Training Contest 9 && HDU 6166 Senior Pan 【最短路+思维】
- 2014 Multi-University Training Contest 3小记
- 2017 Multi-University Training Contest 9 1006 Senior Pan spfa
- HDU 4898 The Revenge of the Princess’ Knight ( 2014 Multi-University Training Contest 4 )
- hdu-5318 The Goddess Of The Moon(2015 Multi-University Training Contest 3)
- HDU HDU 3861 The King’s Problem 2011 Multi-University Training Contest 3 - Host by BIT
- Hdu 4891 The Great Pan
- HDU 4891 The Great Pan
- hdu 4891 The Great Pan
- HDU 4891 The Great Pan
- hdu 4891 The Great Pan
- hdu 4901 The Romantic Hero 2014 Multi-University Training Contest 4 E
- hdu 4901 The Romantic Hero--2014 Multi-University Training Contest 4
- 不要浮躁
- 浅析UML之组件图
- LeetCode-Single Number II
- 用ORACHK自动化检查数据库系统的健壮性
- sql必知必会读书笔记二
- hdu 4891The Great Pan -----------2014 Multi-University Training Contest 3
- leetcode 虐我篇之(四)Remove Duplicates from Sorted List II
- 为什么呢????没有封号啊
- Prevent the user click a button twice
- 浅析UML之组织结构图
- android项目解刨之时间轴
- 队列的实现
- cocos2d-x-3.2版本win7环境中的搭建
- ReportStudio入门教程(七十五) - 计算项的运算顺序