登录
首页 » Asm » q1

q1

于 2015-01-18 发布 文件大小:2KB
0 292
下载积分: 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 个回复

  • Tencent
    VBS 运行 调用 腾讯验证码 通过maxthon 可 实现自动调用 (VBS operation called Tencent authentication code can be realized through maxthon Automatic Call)
    2007-04-30 10:19:07下载
    积分:1
  • C-and-Pointers
    C和指针,用于介绍C中指针的用法,是一本不可多得的书籍(C-and-Pointers)
    2010-10-23 14:55:39下载
    积分:1
  • TortoiseGit-2.8.0.0-64bit
    说明:  TortoiseGit 2.8.0 on windows platform
    2020-06-18 21:20:02下载
    积分:1
  • 最新的迅雷下载工具 具有快速下载 直接收索等强大的功能
    最新的迅雷下载工具 具有快速下载 直接收索等强大的功能-Xunlei download the latest tools with fast download cable, such as direct admission powerful
    2022-04-22 03:32:00下载
    积分:1
  • MPS-140801VBCode
    数据采集例程suju cjsuju cj据采集例程据采集例程(suju cj suju cj suju cj suju cj suju cj suju cjsuju cjsuju cjsuju cj)
    2016-04-06 11:33:38下载
    积分:1
  • Counter_dll
    基于研华PCI-1710HG数据采集卡基于动态链接库的计数器程序。用VC++6.0MFC实现。程序功能实现实时计数值显示及频率值显示。(Advantech PCI-1710HG-based data acquisition card is based on the dynamic link library counter program. With VC++6.0MFC achieved. Program features real-time count value display and frequency display.)
    2020-09-10 10:58:00下载
    积分:1
  • 卫星开发工具包STK Iridium-STK-orbit
    卫星开发工具包STK,对铱星系统的系统建模分析,三维仿真场景(Satellite Development Kit STK, the Iridium system modeling, 3D simulation scene)
    2013-04-27 11:39:44下载
    积分:1
  • SDKDDKVer
    在用C++编程时可能需要使用的头文件,能用,挺好(Header files that may need to be used when programming in C++ can be used, very good)
    2020-07-14 16:48:52下载
    积分:1
  • SlidingMenu
    slidingView的实现,点击右边按钮显示右边的view,点击左边的按钮显示左边的view(slidingView realization, click on the right button to display the right of the view, click the left button to display the left view)
    2013-11-20 10:12:17下载
    积分:1
  • jBox
    仿腾讯QQ空间的DIV窗口,淡蓝色风格看上去很漂亮,不过源代码扣下来相当麻烦,这里使用jQuery的一款插件jBox来修改代替,效果还算行吧,它有两种方式调用 ,第一种是iframe,就是把另一个页面嵌入到div窗口中来;另一种是控制div标签,你可将显示的内容写到DIV标签内,然后在JS中引入需要控制的DIV ID号就行了。(Imitation Tencent QQ space DIV window, light blue style looks very nice, but the source code is quite troublesome buckle down, here s a plug jBox use jQuery instead to modify the effect is fairly okay, there are two ways to call it, the first one is the iframe, is to another page to embed div window the other is to control the div tag, you can display the contents written in the dIV tag, then the introduction of the need to control the dIV ID number on the line in JS a.)
    2015-02-07 15:07:34下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载