当前位置:网站首页>hdu 1870 愚人节的礼物 (栈)
hdu 1870 愚人节的礼物 (栈)
2022-08-05 11:02:00 【51CTO】
愚人节的礼物
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6260 Accepted Submission(s): 3788
Problem Description
四月一日快到了,Vayko想了个愚人的好办法——送礼物。嘿嘿,不要想的太好,这礼物可没那么简单,Vayko为了愚人,准备了一堆盒子,其中有一个盒子里面装了礼物。盒子里面可以再放零个或者多个盒子。假设放礼物的盒子里不再放其他盒子。
用()表示一个盒子,B表示礼物,Vayko想让你帮她算出愚人指数,即最少需要拆多少个盒子才能拿到礼物。
Input
本题目包含多组测试,请处理到文件结束。
每组测试包含一个长度不大于1000,只包含'(',')'和'B'三种字符的字符串,代表Vayko设计的礼物透视图。
你可以假设,每个透视图画的都是合法的。
Output
对于每组测试,请在一行里面输出愚人指数。
Sample Input
((((B)()))()) (B)
Sample Output
4 1
Author
Kiki
Source
不是栈的方法
栈的方法
边栏推荐
猜你喜欢

Opencv算术操作

.NET in-depth analysis of the LINQ framework (6: LINQ execution expressions)

软件测试之集成测试

sqlserver编写通用脚本实现获取一年前日期的方法

The host computer develops C# language: simulates the STC serial port assistant to receive the data sent by the microcontroller

TiDB 6.0 Placement Rules In SQL Usage Practice

张朝阳对话俞敏洪:一边是手推物理公式,一边是古诗信手拈来

PCB layout must know: teach you to correctly lay out the circuit board of the op amp

登录功能和退出功能(瑞吉外卖)

智能算力的枢纽如何构建?中国云都的淮海智算中心打了个样
随机推荐
L2-042 老板的作息表
PPOCR 检测器配置文件参数详解
反射修改jsessionid实现Session共享
支持向量机SVM
脱光衣服待着就能减肥,当真有这好事?
MySQL 中 auto_increment 自动插入主键值
Use KUSTO query statement (KQL) to query LOG on Azure Data Explorer Database
时间格式2020-01-13T16:00:00.000Z中的T和Z分别表示什么,如何处理
Android development with Kotlin programming language three loop control
Go学习笔记(篇二)初识Go
What are the standards for electrical engineering
[Translation] Chaos Net + SkyWalking: Better observability for chaos engineering
MMDetection in action: MMDetection training and testing
苹果Meta都在冲的Pancake技术,中国VR团队YVR竟抢先交出产品答卷
Guys, I am a novice. I use flinksql to write a simple count of user visits according to the document, but it ends after executing it once.
GPU-CUDA-图形渲染分析
PG优化篇--执行计划相关项
一张图看懂 SQL 的各种 join 用法!
hdu4545 Magic String
STM32 entry development: write XPT2046 resistive touch screen driver (analog SPI)