C - ACboy needs your help again!

PX4从放弃到精通(二十一):使用git管理PX4代码 文章目录前言一、设置git密钥二、将代码上传至gitee 前言 Ubuntu 18.04 PX4 1.11.3 由于github有时网速较慢,本文使用gitee。 一、设置git密钥 ssh-keygen -t rsa -C “your_email@youremail.com” your_email@youremail.com为自己注册的gitee账户邮箱.设置路径与密码时,也直接回车不设置,如下图,密钥生成的位置在红框处. 在密钥目录下按Ctrl+H显示隐藏文件,进入.ssh文件夹用gedit打开id 阅读详情

ACboy was kidnapped!!

he miss his mother very much and is very scare now.You can't image how dark the room he was put into is, so poor :(. 
As a smart ACMer, you want to get ACboy out of the monster's labyrinth.But when you arrive at the gate of the maze, the monste say :" I have heard that you are very clever, but if can't solve my problems, you will die with ACboy." 
The problems of the monster is shown on the wall: 
Each problem's first line is a integer N(the number of commands), and a word "FIFO" or "FILO".(you are very happy because you know "FIFO" stands for "First In First Out", and "FILO" means "First In Last Out"). 
and the following N lines, each line is "IN M" or "OUT", (M represent a integer). 
and the answer of a problem is a passowrd of a door, so if you want to rescue ACboy, answer the problem carefully!
Input
The input contains multiple test cases. 
The first line has one integer,represent the number oftest cases. 
And the input of each subproblem are described above.
Output
For each command "OUT", you should output a integer depend on the word is "FIFO" or "FILO", or a word "None" if you don't have any integer.
Sample Input
4
4 FIFO
IN 1
IN 2
OUT
OUT
4 FILO
IN 1
IN 2
OUT
OUT
5 FIFO
IN 1
IN 2
OUT
OUT
OUT
5 FILO
IN 1
IN 2
OUT
IN 3
OUT
Sample Output
1
2
2
1
1
2
None
2
3

栈和队列:


#include<iostream>
#include<stdio.h>
#include<string.h>
#include<queue>
#include<stack>

using namespace std;
int main()
{

    int n;
    scanf("%d",&n);
   while(n--)
   {
       char str1[10];
          int m;
        scanf("%d%s",&m,str1);
            if(!strcmp(str1,"FIFO"))
            {
                queue <int >sq;
                while(m--)
                {
                    char str2[10];

               scanf("%s",str2);
                  if(!strcmp(str2,"IN"))
                {
                    int b;
                    scanf("%d\n",&b);
                    sq.push(b);
                }
                else
                {
                    if(sq.empty())
                    printf("None\n");
                    else
                     {

                       printf("%d\n",sq.front());
                        sq.pop();
                     }
                }
                }
            }
            else
            {
                 stack <int >st;
                 while(m--)
                 {
                     char str2[10];
                  scanf("%s",str2);

                 if(!strcmp(str2,"IN"))
                {
                    int b;
                    scanf("%d\n",&b);
                    st.push(b);
                }
                else
                {
                    if(st.empty())
                    printf("None\n");
                     else
                    {

                        printf("%d\n",st.top());
                       st.pop();
                    }
                }
               }
            }

    }
    return 0;
}
【 注释: 】int strcmp( string str1 , string str2 )

注意该比较区分大小写。
参数
str1第一个字符串。
str2第二个字符串。
返回值
如果 str1小于 str2,返回负数;如果 str1大于 str2,返回正数;二者相等则返回 0。(相等时返回0)

第16课:动手实战中文句法依存分析 句法分析是自然语言处理(NLP)中的关键技术之一,其基本任务是确定句子的句法结构或者句子中词汇之间的依存关系。主要包括两方面的内容:一是确定语言的语法体系,即对语言中合法句子的语法结构给予形式化的定义;另一方面是句法分析技术,即根据给定的语法体系,自动推导出句子的句法结构,分析句子所包含的句法单位和这些句法单位之间的关系。 句法分析被用在很多场景中,比如搜索引擎用户日志分析和关键词识别,比如信息抽... 阅读详情

相关推荐

银河麒麟V10系统grub崩溃急救指南:从光盘救援到完整恢复(附常见错误排查)

本文详细介绍了银河麒麟V10系统grub崩溃的急救方法,从使用安装光盘进入救援环境到完整恢复系统的全流程。针对不同损坏程度(轻度、中度、严重)提供了分级恢复策略,包括grub2-install和grub2-mkconfig等关键命令的使用,并附有常见错误排查表,帮助用户快速解决引导问题。

weixin_30955617的博客 483

ACboy needs your help again! (队列问题)

ACboy needs your help again! 目录 ACboy needs your help again! 题意描述:多实例,根据输入单词是"FIFO"或"FILO",即是queue还是stack以及输入in求每个命令"OUT",应该输出的整数,没有任何整数输出“None"。 解题思路:分两个大方向fifo为队列先进先出、filo栈先进后出,然后当in时再输入数字加入队列、栈顶,out时若建立的队列和栈不空时,根据队列和栈的输出格式进行输出;当栈或队列里面元素为空时,输出Non...

m0_58245389的博客 622

Visual Studio Git 使用指南

Visual Studio 2022深度集成了Git功能,提供了直观的图形界面管理源代码。本文详细介绍了VS中Git的使用方法:从环境准备、克隆/创建仓库开始,重点讲解了"Git更改"窗口的日常操作,包括查看修改、暂存文件、提交推送等。同时涵盖了分支管理、查看历史、解决冲突等核心功能,以及储藏、重置等高级操作。文章还提供了实用技巧,如提交规范、频繁提交等最佳实践。VS的Git集成覆盖了日常开发需求,图形界面与命令行可互补使用,适合各层次开发者高效管理代码版本。

guigenyi的专栏 1572

ACboy needs your help again!(栈和队列)HDU - 1702

题目:ACboy needs your help again! 中文大意 ACboy was kidnapped!! he miss his mother very much and is very scare now.You can’t image how dark the room he was put into is, so poor : (. As a smart ACMer, you want to get ACboy out of the monster’s labyrinth.But when

R_711的博客 445

便携式水下动态实时视频色彩还原设备,一键快速实现对水下偏色视频和图像的色彩还原处理

便携式水下动态实时视频色彩还原,一键快速对水下图像进行色彩校正,清晰度提升和亮度均衡处理,为水下资源勘探和科学考古,海洋生态环境监测,水下机器作业等应用提供有力的协助

weixin_43518680的博客 633

Yolo8行人车辆目标检测实战分享 完整项目代码可直接运行

Yolo8行人车辆目标检测实战分享 完整项目代码可直接运行

1294

【题解】HDU 1702 ACboy needs your help again!

目录 题目描述 题意分析                                                                                                                     题目描述 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768...

飒然霜林的博客 355

芒果YOLOv5改进05:损失函数IoU 篇之Repulsion Loss:原创改进损失函数 Repulsion:解决目标遮挡场景下检测,为解决密集人群检测中遮挡设计的损失函数,打造高效检测器涨点

YOLOv5改进代码实践|结合Repulsion 解决目标遮挡场景下检测🚀

包括YOLOv5、YOLOv7、YOLOv8等模型改进 4566

HDU-1702 ACboy needs your help again!【栈与队列】

Problem Description ACboy was kidnapped!! he miss his mother very much and is very scare now.You can't image how dark the room he was put into is, so poor :(. As a smart ACMer, you want to get ACb

不忘初心,知行统一 404

学Simulink--基础微电网场景实例:基于Simulink的微电网经济调度优化策略仿真

指标传统调度PSO经济调度(本文)目标值总运行成本(元/h)45.232.5(工况1)降低≥20%调度响应时间(s)25<30储能SOC范围(%)50~50(不变)28~56(动态优化)20~80弃风弃光率(%)0(强制满发)0(优化消纳)0原理:微电网经济调度通过PSO算法优化各单元出力,以总成本最小化为目标,平衡功率平衡与设备约束;建模:Simulink中用实现PSO控制器,结合PV/WT/DG/ESS模型,完成闭环优化;验证。

amy_mhd的博客 68

基于YOLO26深度学习框架的文档表格识别系统的算法研究实现方法

本文研究了基于YOLO26深度学习框架的文档表格识别系统实现方法。系统采用YOLO26网络架构,通过数据预处理、模型训练、检测推理和表格分析四个模块实现高效表格识别。研究详细阐述了数据归一化、增强等技术处理,以及采用迁移学习策略优化模型训练过程。实验表明,该系统能有效识别多种表格结构并生成结构化数据,为文档自动化处理提供了可靠解决方案。

一键难忘的博客 973

HDU 1702 ACboy needs your help again! 【栈+队列】

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1702 思路:模拟题,大家看下代码就会了,刚开始我也是一头雾水,看来下大佬的代码感觉~嘿~嘿~嘿【栈和队列的最基本的应用】代码如下: #include&lt;bits/stdc++.h&gt; //栈和队列的最基本的应用 #include&lt;algorithm&gt; using nam...

甜晨流年 292

手把手教你学SOC芯片架构--NoC(片上网络,Network on Chip)全方位解析

​、​。

MHD0815的博客 865

ACM-C - ACboy needs your help again!

C - ACboy needs your help again! Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Description ACboy was kidnapped!! he miss his mother very much and is...

AC_dream 900

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

ACboy needs your help again!

ACboy needs your help again! Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4431    Accepted Submission(s): 2261 Problem Description A

yanghui07216的博客 486

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

杭电ACboy needs your help again!

 /*Problem Description ACboy was kidnapped!! he miss his mother very much and is very scare now.You can't image how dark the room he was put into is, so poor :(.  As a smart ACMer, you want to g

u013439063的专栏 284

ACboy needs your help again!(1702)

ACboy needs your help again!

cwl353253492的专栏 429

HDU 1702-ACboy needs your help again!

ACboy needs your help again! Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8632    Accepted Submission(s): 4328 题目链接:点击打开链接 P

别止的博客 364

HDU -1702 ACboy needs your help again!

ACboy needs your help again! Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description ACboy was kidnapped!! he miss his mother very much and is very ...

名字太长容易被发现并打死 271

ACboy needs your help again! HDU - 1702

ACboy needs your help again! HDU - 1702 stl #include<cstdio> #include<iostream> #include<queue> #include<stack> using namespace std; int n,m; string s; int main(){ scanf("%d",...

weixin_45917279的博客 156

HDU 1072 ACboy needs your help again!(栈和队列)

ACboy needs your help again! 题目

Sometimes__的专栏 693

hdu1702ACboy needs your help again!(栈和队列的简单应用)

ACboy needs your help again! Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3508    Accepted Submission(s): 1794 Problem Description A

千言万语ROOM 429
上一篇: Uva 3n+1 问题
下一篇: 刘汝佳--开灯问题
张今天
博客等级 码龄10年 111粉丝 299原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值