登录
首页 » Asm » q1

q1

于 2015-01-18 发布 文件大小:2KB
0 142
下载积分: 1 下载次数: 0

代码说明:

说明:  Pokeface 题目描述 魔术师将一叠扑克顺次在桌上排成一行,初始全部正面朝上。随后,他每次挥一挥衣袖,都会翻转一连串的扑克,改变它们的正反朝向。从古代传下来的规矩,魔术师皆有师傅,他们要随时准备回答师傅的问题。问题形如:目前从第i张扑克牌到第j张扑克牌中,有几张正面朝上? 作为魔术师的助手,你被要求学习程序设计、算法与数据结构。现在,魔术师把这个问题交给了你,你需要编写一个程序,维护相应的数据结构来保存桌子上牌面的情况,同时对于师傅的每一个问题,你要用尽量快的速度计算出答案。 输入 第一行包含三个正整数n、p和q。n表示扑克牌的数量,p表示魔术师的挥一挥次数,q表示师傅的问话次数。 接下来共p+q行,每行包含一个操作,操作分为2种: H i j 魔术师挥一挥,改变了第i张牌到第j张牌的正反 Q i j 师傅问话:截至目前,第i张到第j张牌中有多少张正面朝上 操作中恰好包含p次H操作,q次Q操作,与第一行的p和q吻合。H操作和Q操作的范围均包含边界(即第i张和第j张牌)。 对于每个操作,输入保证1 ≤ i ≤ j ≤ n。 输出 对于每次Q操作,输出一行,包含一个整数,表示问题的答案。 提示:线段树(Pokeface Title Description The magician will stack poker table sequentially in a row, all the initial face-up. He then every wisp will flip a series of poker pros and cons of changing their orientation. The rules handed down ancient times, the master magician Jie, they be ready to answer the teacher s questions. Question of the form: Currently playing cards i to j-card poker, there are a few face-up? As a magician s assistant, you are required to learn programming, algorithms and data structures. Now, the magician put this question to you, you need to write a program to maintain appropriate data structure to hold the cards on the table face the situation, while the master for each question, and you want to use as quickly calculate the answer. Enter The first line contains three positive integers n, p and q. n represents the number of poker, p represents the wave of the magic number, q represents the number of master s questioning. Next, a total of p+ q rows, each containi)

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • DSP-FIR
    TI公司生产的C54系列DSP有限冲击响应滤波器(FIR)算法实验程序(TI produced C54 series DSP finite impulse response filter (FIR) algorithm for experimental procedures)
    2008-05-23 13:34:09下载
    积分:1
  • SPWM
    实现dsp tms320lf2407为控制核心的三相逆变器控制的程序代码。实现全数字ups逆变器设计。(DSP TMS320LF2407 as the control core three-phase inverter control program code. All-digital UPS inverter design.)
    2013-04-20 17:11:30下载
    积分:1
  • wincczqtk
    西门子HMI软件WINCC编辑图库,可以直接复制粘贴到WINCC软件中.(Siemens HMI editing software WINCC gallery, you can copy and paste directly into WINCC software.)
    2013-12-06 04:38:39下载
    积分:1
  • 网络爬虫,用于在指定页面中抓取内容.调试环境windows xp,数据库为oracle
    网络爬虫,用于在指定页面中抓取内容.调试环境windows xp,数据库为oracle-Network reptiles for the specified page content to crawl. Debug environment for windows xp, database oracle
    2022-04-29 18:58:57下载
    积分:1
  • Evaluate_Score
    说明:  利用已经使用的分数文本判断文本的分数等级。(The score level of the text is judged using the score text that has been used.)
    2020-06-17 17:20:02下载
    积分:1
  • p4
    为了让您在使用数组,指针,结构,枚举,和不同的I/ O流的经验。为了让你有乐趣的应用程序是非常迷人的。 世界的简单的程序,我们将编写此项目模拟运行的生物围绕在一个简单的方形的世界。世界是一个m-n的平方二维网格(数m代表网格的高度的个数n表示宽度的网格。)。 每个生物生活的广场之一,面临的一个主要罗盘方向(北, 东,南,西),属于一个特定的物种,这就决定了该生物如何 行为方式。(To give you experience in using arrays, pointers, structs, enums, and different I/O streams. To let you have fun with an application that is extremely captivating. The simple world program we will write for this project simulates a number of creatures running around in a simple square world. The world is an m-by-n two-dimensional grid of squares (The number m represents the height of the grid and the number n represents the width of the grid.). Each creature lives in one of the squares, faces in one of the major compass directions (north, east, south, or west) and belongs to a particular species, which determines how that creature behaves. )
    2013-11-16 14:15:33下载
    积分:1
  • shoupiao
    列车购票系统,列车员,用户,购票查询增删改等功能(Train ticketing systems, conductor, users, ticket inquiries CRUD functions)
    2014-06-18 22:59:40下载
    积分:1
  • jinhuopingtai
    电脑城渠道报价平台,多会员制,管理员上传excel文件,渠道帐号可以登入后查看并下载(Computer City channels offer platform, multi-membership, administrator excel file upload, channel account can log in to view and download)
    2013-10-06 10:09:25下载
    积分:1
  • 图书馆管理系统
    简单实现图书馆管理的功能,实现借书还书等简单的功能需求(Simple realization of the function of library management)
    2018-04-01 20:08:11下载
    积分:1
  • Attach
    javaSystem will automatically delete the directory of debug and release
    2009-03-11 21:22:35下载
    积分:1
  • 696518资源总数
  • 104226会员总数
  • 33今日下载