Web Navigation poj 1028

FAA和EASA在机载电子硬件适航中的发展历史与差异 FAA和EASA在机载电子硬件的适航审查中虽然存在一些差异,但通过近年来的合作,这些差异正在逐步缩小。两者通过。 阅读详情

题目链接:http://poj.org/problem?id=1028

Web Navigation

Time Limit: 1000MS

Memory Limit: 10000K

Total Submissions: 25407

Accepted: 11317

Description

Standard webbrowsers contain features to move backward and forward among the pages recentlyvisited. One way to implement these features is to use two stacks to keep trackof the pages that can be reached by moving backward and forward. In thisproblem, you are asked to implement this. 
The following commands need to be supported: 
BACK: Push the current page on the top of the forward stack. Pop the page fromthe top of the backward stack, making it the new current page. If the backwardstack is empty, the command is ignored. 
FORWARD: Push the current page on the top of the backward stack. Pop the pagefrom the top of the forward stack, making it the new current page. If theforward stack is empty, the command is ignored. 
VISIT : Push the current page on the top of the backward stack, and makethe URL specified the new current page. The forward stack is emptied. 
QUIT: Quit the browser. 
Assume that the browser initially loads the web page at the URLhttp://www.acm.org/

Input

Input is asequence of commands. The command keywords BACK, FORWARD, VISIT, and QUIT are allin uppercase. URLs have no whitespace and have at most 70 characters. You mayassume that no problem instance requires more than 100 elements in each stackat any time. The end of input is indicated by the QUIT command.

Output

For each commandother than QUIT, print the URL of the current page after the command isexecuted if the command is not ignored. Otherwise, print "Ignored".The output for each command should be printed on its own line. No output isproduced for the QUIT command.

Sample Input

VISIT http://acm.ashland.edu/

VISIT http://acm.baylor.edu/acmicpc/

BACK

BACK

BACK

FORWARD

VISIT http://www.ibm.com/

BACK

BACK

FORWARD

FORWARD

FORWARD

QUIT

Sample Output

http://acm.ashland.edu/

http://acm.baylor.edu/acmicpc/

http://acm.ashland.edu/

http://www.acm.org/

Ignored

http://acm.ashland.edu/

http://www.ibm.com/

http://acm.ashland.edu/

http://www.acm.org/

http://acm.ashland.edu/

http://www.ibm.com/

Ignored

 


题意:就像浏览器的前进,后退,浏览新页面的功能,用2个栈实现,一个存放前进的页面,一个存放后退的页面


#include <iostream>
#include<stdio.h>
#include<stack>
#include<string>
#include<string.h>
using namespace std;

struct strWeb
{
    char str[110];
};


stack<string> sIn;
stack<string> sOut;

int main()
{
    string strInit = "http://www.acm.org/";
    string ERROR = "Ignored";
    sIn.push(strInit);
    while(true)
    {
        string operate;
        cin>>operate;
        if(operate[0]=='Q')
            return 0;
        else if(operate[0]=='V')
        {//访问网址
            string url;
            cin>>url;
            sIn.push(url);
            /*VISIT : Push the current page on the top of the backward stack, and make the URL specified the new current page. The forward stack is emptied. */
            while(!sOut.empty())
                sOut.pop();
            cout<<sIn.top()<<endl;
        }
        else if(operate[0]=='F')
        {//前进
            if(sOut.size()>0)
            {
                sIn.push(sOut.top());
                sOut.pop();
                cout<<sIn.top()<<endl;
            }
            else
            {
                cout<<ERROR<<endl;
            }
        }
        else if(operate[0]=='B')
        {//回退
            if(sIn.size()>1)
            {//第一个值不回退
                sOut.push(sIn.top());
                sIn.pop();
                cout<<sIn.top()<<endl;
            }
            else
            {
                cout<<ERROR<<endl;
            }
        }

    }

    return 0;
}








YOLO26改进策略【卷积层】| CVPR 2024 可变形卷积 v4(DCNv4)无界权重提表达 + 线程合并降冗余,强化模型收敛速度 DCNv4(Deformable Convolution v4)是一种专为广泛视觉应用设计的高效算子,它对DCNv3进行了关键改进,有效解决了DCNv3存在的速度慢和表达能力受限等问题。 阅读详情

相关推荐

YOLOv5实战:无人机巡检图片差异对比与违建标记(附完整代码)

本文详细介绍了如何利用YOLOv5目标检测技术实现无人机巡检图片差异对比与违建标记。通过图像对齐、目标检测、差异分析和可视化标记四个步骤,构建高效的违建识别系统,显著提升城市管理效率。文章包含完整代码实现和性能优化技巧,为计算机视觉在无人机巡检中的应用提供实用指南。

weixin_42535720的博客 288

POJ 1028 用栈模拟浏览器的前进与后退

poj 1028 Web Navigation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17718   Accepted: 7751 Description Standard web browsers contain features to move bac

Coding for Dreams 3029

浙政钉(专有钉钉)门户免登(超详细)

钉钉家族 介绍浙政钉门户免登之前,首先搞清楚几个软件的关系,软件分别是:钉钉,专有钉钉,浙政钉 钉钉 是阿里巴巴集团专为中小企业打造的沟通和协同的多端平台。 专有钉钉 原名 政务钉钉,有更开放的设计能力、集成能力、更结构化协同产品、更定制化开发平台。支持专有化部署,数据落本地,更安全、客户可对该产品持牌运营、结构化编排,协助构建本地应用中心、提供移动应用全面安全保障体系。 浙政钉 为规范浙政钉整体架构体系,按照统分结合原则,由省政府办公厅统一设计整体工作界面和系统框架,统筹指导全省统建应用建设,各单

一缕南风的博客 2万+

stack的应用——Web Navigation

时间限制:  1000ms  内存限制:  65536kB 描述 Standard web browsers contain features to move backward and forward among the pages recently visit

acmyinshiyong的专栏 718

目标检测数据集 第069期-基于yolo标注格式的玻璃清洁状态检测数据集(含免费分享)

但这类技术的落地,离不开大量标注规范、场景丰富的数据集作为算法训练的支撑,玻璃清洁状态检测数据集的出现,正是为了满足这一市场与技术需求。在高校与科研机构的计算机视觉研究中,该数据集可作为基础研究素材,用于探索物体状态识别的算法优化方向,比如针对玻璃这类透明物体的检测算法改进,或是小样本场景下的状态识别研究。通过摄像头采集车窗、挡风玻璃的图像,算法自动检测玻璃清洁度,若识别到脏污影响视线,及时提醒运维人员清洁,避免因玻璃脏污引发的安全事故,提升交通出行的安全性。

深度学习算法工程师,专注于前沿算法研究与实战应用。在这里,我将分享深度学习领域的实战经验、优质数据集资源以及最新论文解读与精度分析,旨在与广大技术爱好者共同探索人工智能的奥秘,助力技术成长与创新。 135

Multisim实战:从8选1到32选1数据选择器的完整搭建指南(附常见问题解决)

本文提供了一份详尽的Multisim实战指南,手把手教你从基础的8选1数据选择器开始,逐步级联搭建16选1乃至32选1数据选择器。文章深入剖析了级联的核心逻辑、片选方案以及使用译码器的专业方法,并附带了电源连接、输出冲突、信号毛刺等常见问题的诊断与解决技巧,帮助电子工程学生和爱好者扎实掌握数字电路的系统设计与仿真调试。

dd012的博客 740

POJ1028 Web Navigation【堆栈+模拟】

Web Navigation Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 34314   Accepted: 15322 Description Standard web browsers contain features to move backward an

海岛Blog 2073

深入解析Buck开关电源中的死区时间设计及其对系统性能的影响

本文深入解析了Buck开关电源中死区时间的设计原理及其对系统性能的关键影响。死区时间通过防止上下管同时导通来避免穿通电流,确保系统安全。文章详细探讨了其工作机制、设置时的效率与安全权衡,以及不当设置对效率、稳定性和EMI的连锁反应,并提供了基于实测的调试方法与实战案例。

Apple的专栏 1151

POJ - 1028 Web Navigation(栈的各种基本操作)

前提:知识点在理解的前提下,一定题量的针对训练,才是提高熟练度的唯一方法。 题目链接:https://vjudge.net/contest/325203#problem/E Sample Input VISIT http://acm.ashland.edu/ VISIT http://acm.baylor.edu/acmicpc/ BACK BACK BACK FORWARD VISIT http...

zaiyang遇见 781

Hermes深入理解及源码解析(二):Hermes的记忆机制

源码位置:tools/memory_tool.py存储内容为两个文件,放在 ~/.hermes/memories/:MEMORY.md:Agent 自己的笔记(环境事实、项目约定、工具坑、学到的东西)—— 上限 2200 字符USER.md:关于用户的画像(角色、偏好、沟通风格)—— 上限 1375 字符作为一个独立的工具注册在系统中(为了让智能体正确使用它,System Prompt()中明确下达了禁令存储目标存储位置数据类型持久偏好/事实MEMORY.md我是谁、我喜欢什么、环境配置。

qq_41984117的博客 572

库卡kuka仿真软件sim Pro 3.1简单实用教程

实验目的 建立机器人,自定义抓手,导入外部模型,掌握工具坐标、基坐标的使用,自动生成轨迹。 实验步骤 打开KUKA.Sim Pro 3.1.2仿真软件,依次点击KUKA Sim Library 3.1 → KUKA_ROBOTS→Small Robots(3kg-10kg)→Archiv→AGILUS-1 Series→sixx,双击KR 6 R700 sixx,加载机器臂到工作空间; 加载自定义抓手。双击Miscellaneous,再双击圆锥Cone设置上半径为0,下半径为40,高为100; 点击“捕

weixin_45168199的博客 4万+

POJ 1028 Web Navigation(双栈模拟)

Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can be re...

H4ppyD0g的博客 505

【A2DP】规范精讲[1]: 深入解析A2DP协议的核心架构

在蓝牙技术发展的早期阶段,音频传输主要通过SCO(同步面向连接)链路实现,这种设计主要针对语音通信,音质有限且功能单一。随着人们对无线高质量音频需求的增长,​​Advanced Audio Distribution Profile (A2DP)​​ 应运而生,成为蓝牙音频传输的技术基石。

byte轻骑兵的技术小窝 1万+

POJ 1028 - Web Navigation

STL练习题. 题意挺好理解, 不说了.

一只冰熊 1239

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

poj 1028-Web Navigation

仿真题。。。 其实题目里已经把实现方法介绍了,我没仔细审题,虽然实现了s_back和s_forward两个栈,但是漏考虑了新页面打开要清理s_forward栈的情况,考虑不周。 另外,我把s_back的栈顶当作current_page了,问题不大。 #include #include using namespace std; struct Item{ char *url; I

半亩地 517

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

POJ1028Web Navigation题解

按照题目翻译的用2个栈去实现就完了。

weixin_42178241的博客 513

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

POJ 1028 Web Navigation

注释代码: /* * Problem ID : POJ 1028 Web Navigation * Author : Lirx.t.Una * Language : C * Run Time : 0 ms * Run Memory : 176 KB */ #include //maximum size

源代码 769

poj 1028 Web Navigation

poj 1028    Web Navigation                   题目链接:http://poj.org/problem?id=1028 简单字符处理 题目大意:模拟浏览器四种功能 访问、前进、后退、关闭。以关闭为程序结束。 题目分析:水题一道,只需注意几点  后退再访问则前面的访问记录取消;首页为http://www.acm.org/不可变更。 以下是代码:

slicer的技术交流栈 817

Poj1028 Web Navigation 【简单模拟】

http://poj.org/problem?id=1028 题目大意:默认主页为“http://www.acm.org/”,输入为指令,输出为当前网站的网址。输入的指令有四种: (1)VISIT访问一个新的网站 (2)BACK返回之前访问的网站 (3)FORWARD前往后一个访问的网站 (4)QUIT退出 直接开个数组记录一下,模拟就行 #include ...

bantengbang8949的博客 179

poj 1028 Web Navigation

题目: Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can

继续微笑lsj 1667

POJ 1028 Web Navigation

Web Navigation Time Limit:1000MS Memory Limit:10000K Total Submissions:36919 Accepted:16528 Description Standard web browsers contain features to move backward and forward am...

~ 393

poj_1028 Web Navigation

#include #include #include #define C_MAX 70 struct weburl { char url[C_MAX]; struct weburl *next; struct weburl *prev; }; void web_navigation() { char temp[70]; struct weburl *head = (stru

重拾程序之路 668

POJ - 1028 Web Navigation

栈的应用

The Blog Of Uncle_Sugar 361

POJ1028 Web Navigation

Web NavigationTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 35451 Accepted: 15869Description    Standard web browsers contain features to move backward and forward among the pages recently...

Leo的博客 237

# 栈 ——Web Navigation POJ - 1028 ( 网络导航 POJ-1028)

Web Navigation POJ - 1028 Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track o...

仅仅是笔记。 1036

POJ-1028(Web Navigation)

POJ-1028#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <stack>using namespace std; const char VISIT[] = "VISIT"; const char BACK[] = "BACK"; const char FORWARD[]

YancyKahn 443
上一篇: Sliding Window poj 2823
下一篇: Count Color poj 2777
疯的世界
博客等级 码龄16年 69粉丝 128原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

疯的世界

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址