noip模拟赛 希望
2024-08-31 02:18:07
分析:题目中说用栈实现,我觉得这样很麻烦,就用了一个数组+指针解决了.其实就是大模拟.
#include <stack>
#include <string>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm> using namespace std; string s, ss;
stack <string> s1, s2;
string q[];
int cnt = , maxx = ; int main()
{
q[] = "http://www.acm.org/";
while (cin >> s && s != "QUIT")
{
if (s == "VISIT")
{
cin >> ss;
q[++cnt] = ss;
maxx = cnt;
cout << ss << endl;
}
else
if (s == "BACK")
{
if (cnt - <= )
printf("Ignored\n");
else
{
cnt--;
cout << q[cnt] << endl;
}
}
else
{
if (cnt + > maxx)
printf("Ignored\n");
else
{
cnt++;
cout << q[cnt] << endl;
}
}
}
return ;
}
最新文章
- C# 基础排序与查找算法
- N的阶乘末尾0的个数和其二进制表示中最后位1的位置
- 第一周Web类WriteUp
- nginx 配置多个二级域名
- mtool安装
- 接入新浪、腾讯微博和人人网的Android客户端实例 接入新浪、腾讯微博和人人网的Android客户端实例
- STL 源代码剖析 算法 stl_algo.h -- partition
- Jmeter之基本介绍
- panic和recover的使用规则
- 学生ID查询
- 《剑指offer》字符串的排列
- sass动态实现颜色平铺显示
- API测试:Chai &; Mocha
- (Catalan数 大数) Game of Connections poj2084
- java中静态代码执行顺序
- 题解——洛谷P3390 【模板】矩阵快速幂(矩阵乘法)
- [从零开始搭网站三]CentOS配置JDK
- Java理论学时第五节。课后作业。
- 请教如何用ASP.NET实现http://abc.com/orderID这样的URL???
- MySQL 存储过程传参数实现where id in(1,2,3,...)示例
热门文章
- bzoj3105 [cqoi2013]新Nim游戏——贪心+线性基
- QT Creater环境搭建
- bzoj4668
- bzoj4561
- shell脚本-数组
- JS连续滚动幻灯片:原理与实现
- python配置文件编写
- 2 我们的C#学习方法
- .net framework 3.5 安装报错 0x800F0954问题
- Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named &#39;empid&#39; in &#39;class cn.happy.entity.Emp&#39;