11111UVa俄罗斯套娃
来源:互联网 发布:机枪升级数据 编辑:程序博客网 时间:2024/04/29 17:13
#include<stdio.h>#include<string.h>int stack[10000];int sum[10000];int main(){//freopen("input.txt","r",stdin);int top = 0; //count from 1while(true){top = 0;memset(sum, 0, sizeof(sum) );if(scanf("%d", &stack[++top]) != 1) break;bool ok = true;while(getchar() != '\n'){int temp;scanf("%d", &temp);if(ok == false) continue;if(temp <0){stack[++top] = temp; sum[top-1] += -(temp);}else if(temp > 0){if(-temp != stack[top] ){ok = false;}else{if(sum[top] >= - stack[top]){ok = false;}else{sum[top] =0;top--;}}}}if(top == 0 && ok)printf(":-) Matrioshka!\n");elseprintf(":-( Try again.\n");}}
0 0
- 11111UVa俄罗斯套娃
- 俄罗斯套娃
- 俄罗斯套娃奖品
- 俄罗斯套娃
- UVA1579,俄罗斯套娃
- 原创(俄罗斯套娃程序)
- 俄罗斯套娃问题(Java)
- “俄罗斯套娃问题”程序(能够处理稀疏矩阵)
- 17243 Huzi酱和他的俄罗斯套娃[C]
- 中兴捧月 俄罗斯套娃奖品
- (1)俄罗斯套娃_最大上升子序列
- leetcode(354)—— Russian Doll Envelopes(俄罗斯套娃信封)
- 【滴滴出行2017春招研发工程师笔试题】俄罗斯套娃
- web服务程序设计探索(1)——俄罗斯套娃模型
- leetcode 354. Russian Doll Envelopes 俄罗斯套娃 + DP动态规划
- 俄罗斯
- UVA 1401 Remember the Word(Trie树 套 DP)
- jzoj4064 JSOI2015 套娃 [贪心]
- java30天从入门到放弃心得
- 开发板linux中运行简单hello world应用程序的printf无输出的原因
- rollup、cube、grouping、rank、dense_rank、row_number函数简介
- 自动截取短信验证码
- JAX-RS规范-常用注解解析
- 11111UVa俄罗斯套娃
- Redis学习(三)-Java实现基于Jedis+Spring的通用工具类
- 玲珑-动态规划
- SDL库的学习笔记之二—初始化、退出
- Openstack源码分析 Ml2Plugin start_rpc_listener流程
- 【字符串】判断两字符串是否互为旋转词?
- 第五届蓝桥杯软件类国赛真题-C-A-2_六角幻方
- .Net多线程编程—使用Visual Studio 2012进行调试
- 关于CC2530存储器映射的讨论