登录
首页 » Asm » q1

q1

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

  • CDPro
    这是一个用于计算蛋白质或短肽二级结构的软件,内附有使用说明!(This is a used to calculate the protein or peptide secondary structure software, included with instructions!)
    2021-04-27 22:08:44下载
    积分:1
  • yxmfrpv
    这个程序可以说是对滚动条功能实现比较全面的编成,里面包括了对滚动条的初始化,左右箭头的操作及空白地方的操作()
    2018-04-29 10:28:06下载
    积分:1
  • socks5
    由易语言编写的sokcs5代理客户端,使用的HOOK方式拦截连接请求并转接到代理服务器。(The easy language sokcs5 proxy client, HOOK method used to intercept the connection request and forwarded to the proxy server.)
    2020-11-23 14:19:34下载
    积分:1
  • simulink-gui
    通过Matlab GUI界面控制simulink中模型进行仿真,可以在线修改参数,仿真方便快捷(Through the simulation of the model in the Simulink controlled by the interface of MATLAB GUI, the parameters can be modified online, and the simulation is convenient and fast.)
    2021-01-20 12:38:41下载
    积分:1
  • yuejnj
    c# 宝典源代码 详细注释 程序员必备 10 牛人写的专业代码,窗体设计、控件... 单像空间后方交会,是摄影测量学中,一种基础算法。本压缩包,用的是
    2010-10-24 11:27:53下载
    积分:1
  • This system belongs to a small local area network monitoring system that can car...
    本系统属于小型的局域网监控系统,可以对某一台计算机进行屏幕监控,本系统主要实现以下功能:  系统采用人机交互的方式,界面美观友好。  屏幕信息需要时时显示,网络延时不能大于1秒。  服务器端可以随时运行,只要客户端运行,就能够显示屏幕信息。  系统运行时占用内存不能大于10MB,以免影响系统性能。  客户端运行时需要隐藏显示窗口,起其感觉不到在运行。 -This system belongs to a small local area network monitoring system that can carry out the screen of a computer monitor, this system is mainly to achieve the following features:  system uses human-computer interaction approach, friendly and beautiful interface.  screen displays information needs from time to time, the network delay can not exceed 1 second.  server-side ready to run, as long as the client is running, you can display on-screen information.  memory for the system is running can not be larger than 10MB, so as not to affect system performance.  the client run-time to hide the display window, from the feel running.
    2023-07-21 17:50:07下载
    积分:1
  • 本人写的一个TCP/UDP通信的界面软件,支持UDP和TCP server端,简单易用...
    本人写的一个TCP/UDP通信的界面软件,支持UDP和TCP server端,简单易用-I wrote a TCP/UDP communications interface software, to support the UDP and TCP server-side, easy-to-use
    2022-01-22 17:20:05下载
    积分:1
  • 17739_daima
    Windows Phone 应用程序开发源码(Windows Phone application development source)
    2014-05-09 13:54:20下载
    积分:1
  • onduleur
    onduleur de tension monophase
    2012-04-30 13:20:10下载
    积分:1
  • tull-doreian
    说明:  哈夫曼树编码,利用哈夫曼树算法实现对数据的压缩,很好,不错(Huffman tree coding, using Huffman tree algorithm to achieve data compression, good, good)
    2018-12-31 00:04:48下载
    积分:1
  • 696518资源总数
  • 104269会员总数
  • 31今日下载