登录
首页 » Asm » q1

q1

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

  • WebService
    一个简单的Webservice实例,包括Server端接口和Client端请求服务,可在生产环境中使用(A simple example of webservice that can be deployed on production env.)
    2015-01-21 16:39:52下载
    积分:1
  • neicun_Ex
    本源码是用Ex_DirectUI 2.0模块扩展的内存 CPU查看源码 有能力的朋友可以继续完善!(The source is Ex_DirectUI 2.0 expanded memory CPU module has the ability to view the source code of a friend can continue to improve! )
    2013-11-30 21:57:49下载
    积分:1
  • multiview_for_doc3_demo
    说明:  动态实现多视图,作者好象是印度的,从国外站点下载的代码,并且每个视图有具体的view类进行支撑,可用于多场景显示(Realize the dynamic multi-view, the author seems to be in India from the foreign site to download the code, and view each specific type of view to support, can be used for multi-scene display)
    2008-10-01 10:34:24下载
    积分:1
  • js源码
    使用javascrip绘制等值线,用于气象等行业数据绘制成等值线在web上显示(Javascrip is used to draw contour lines, which are used for meteorological and other industries to draw contour lines and display them on Web)
    2017-10-13 12:35:05下载
    积分:1
  • 2006_31_3_54
    面向对象的信息融合黑板框架的建立,我有一系列关于黑板系统的文章哈(Object-oriented information fusion blackboard framework in place, I have a series of articles on the blackboard system ha)
    2010-06-12 11:44:03下载
    积分:1
  • 年底大放送,比IE更好的浏览器源码,16岁少年写的。经典力作。...
    年底大放送,比IE更好的浏览器源码,16岁少年写的。经典力作。-talk about the end, better than IE browser source code, the 16-year-old boy wrote. Classical Masterpiece.
    2022-03-25 06:27:50下载
    积分:1
  • C语言图形
    C语言 关于图形编程的 一些方法函数以及相关使用方法。(C language graphics programming on some methods, functions and related methods of use.)
    2017-11-10 08:20:07下载
    积分:1
  • 427564
    系统软件运行快捷打开易语言源码,程序实现了添加在win+R运行里面的快捷运行文件。(System software runs fast and easy language open source program to achieve the added win+ R shortcut to run the file to run inside .)
    2016-07-22 10:26:21下载
    积分:1
  • Panasonic
    A series of Panasonic servo directory
    2014-05-06 02:38:16下载
    积分:1
  • 打字训练
    采用VB6.0编写的小软件,可以实现打字检查正确率,用来学习文本操作。(The small software written by VB6.0 can achieve the correct rate of typing checking, and is used to learn text operation.)
    2018-05-22 17:13:15下载
    积分:1
  • 696518资源总数
  • 105578会员总数
  • 20今日下载