精华内容
下载资源
问答
  • enum code { a = 1 << 0, b = 1 << 1, c = 1 << 2, d = 1 << 3, e = 1 << 4, f = 1 << 5, g = 1 << 6, MAX = 7 ...这个表达式什么意思
  • 最近在工作的时候遇到一个问题: 后台的枚举类的成员value值1、2、3三个成员,通过前端传递json指定枚举数据,原本以为...啥意思呢?如下: 我传递的数值0和1 后台枚举成员绑定的却1和2 经过多次测试之后我发现

    最近在工作的时候遇到一个问题:
    后台的枚举类的成员value值是1、2、3三个成员,通过前端传递json指定枚举数据,原本以为我传递1就能绑定到枚举中value为1的成员,但是结果确实绑定的是value为2的成员。
    刚开始的时候我以为是项目的拦截器会将字段+1,经过debug之后发现,当你从前台传递一个数值类型给后台的枚举类型的时候,后台并不是根据枚举成员的value值进行绑定的,而是根据枚举的ordinal。
    啥意思呢?如下:
    在这里插入图片描述
    我传递的数值是0和1
    在这里插入图片描述
    后台枚举成员绑定的却是1和2
    经过多次测试之后我发现,有一个数值和我的前台请求是对应的:
    在这里插入图片描述
    查阅资料之后发现这个是枚举成员在枚举之中出现的顺序序号。
    为了确认前端数值绑定的是序号而不是value的时候,再将枚举类中value为2的成员移动到枚举成员的最前面,发现结果为:
    在这里插入图片描述
    果然传递0绑定的枚举成员变成了value为2的成员。

    所以得出结论:当前台传递数值给枚举类的时候,后台绑定的并不是枚举类的value,而是枚举类的顺序序号。如果想要通过前台数值绑定到对应的value值的枚举成员,就要保证枚举成员的value值是从0开始不间断且按顺序书写。

    展开全文
  • Java之枚举

    2019-12-08 17:04:11
    Java的枚举到底?为用法那么奇怪?这篇文章带你探究一下. 枚举类其实继承于java.lang.Enum类的.用enum关键字声明的类会被编译器默认编译为继承于Enum且加上final关键字.所以,如下的枚举: public enum MyEnum...

    Java的枚举到底是个啥?为啥用法那么奇怪?这篇文章带你探究一下.
    枚举类其实是继承于java.lang.Enum类的.用enum关键字声明的类会被编译器默认编译为继承于Enum且加上final关键字.所以,如下的枚举:

    public enum MyEnum {
    	field1, field2;
    }
    

    其实是这个意思:

    public final class MyClass extends java.lang.Enum<MyClass> {
    	 public static final MyClass field1 = new MyClass();
    	 public static final MyClass field2 = new MyClass();
    }
    

    但是如果手动继承Enum则报错, 是因为编译器限制了枚举类的继承.不过枚举的原理大概就是这样. 因为枚举继承了Enum, 而java又是单继承,只能有一个父类, 所以enum的类不能再继承于其他类. 以下是更多枚举类写法的改编:

    enum MyEnum {
    	field1("a"), field2(4);
    	MyEnum(int i) {
    		System.out.println(i);
    	}
    	MyEnum(String s) {
    		System.out.println(s);
    	}
    }
    

    等同于

    final class MyClass extends java.lang.Enum<MyClass> {
    	public static final MyClass field1 = new MyClass("a");
    	public static final MyClass field2 = new MyClass(4);
    
    	public MyClass(int i){
    		System.out.println(i);
    	}
    	public MyClass(String s) {
    		System.out.println(s);
    	}
    }
    

    枚举加上field和方法:

    enum MyEnum {
    	field1("a"), field2(4);
    
    	private String val;
    
    	MyEnum(int i) {
    		System.out.println(i);
    	}
    
    	MyEnum(String s) {
    		this.val = s;
    		System.out.println(s);
    	}
    
    	public void printVal() {
    		System.out.println(val);
    	}
    }
    

    等同于:

    final class MyClass extends java.lang.Enum<MyClass> {
    	public static final MyClass field1 = new MyClass("a");
    	public static final MyClass field2 = new MyClass(4);
    	private String val;
    
    	public MyClass(int i) {
    		System.out.println(i);
    	}
    
    	public MyClass(String s) {
    		System.out.println(s);
    	}
    
    	public void printVal() {
    		System.out.println(val);
    	}
    }
    

    枚举实际上就是一个持有自身类型的若干个对象的一个普通类.
    由于枚举类型是继承了java.lang.Enum类,所以这个类里的所有方法都可以供枚举类型调用. Enum类的valueOf方法根据传入的名字返回对应的枚举对象.
        由于枚举对象是public static final 的对象,因此是单例的,全局唯一, 虽然final指定了该对象引用不可变, 但对象本身还是可变的. 若对象本身有一些field, 则对field重新设值会一直影响后面所有使用的地方.
        总之,知道了枚举的原理, 关于枚举的一切,再怎么变都不用怕了.

    展开全文
  • Swift 枚举和switch

    2017-03-01 15:37:52
    Ok 来看看,枚举和switch枚举我认为啊,枚举就是把一些集合,给上名字,就避免了硬编码的尴尬,谁知道数字代表啥意思,肯定不如打一串有意义的字符好,而且还不会输入错误 一般来收就酱就好啦enum SomeEnumeration ...

    Ok 来看看,枚举和switch
    ###枚举
    我认为啊,枚举就是把一些集合,给上名字,就避免了硬编码的尴尬,谁知道数字代表啥意思,肯定不如打一串有意义的字符好,而且还不会输入错误
    一般来收就酱就好啦

    enum SomeEnumeration {
      //里面定义枚举
    }
    

    举个栗子,我定义了两个类型,一个是Beitie,一个是Renwu

    enum Leixing {
        case Beitie
        case Renwu
    }
    

    用的时候就先申明一个变量来 ,不赋值

    var haha:Leixing?
    

    而后呢,赋值就这样子写

    haha = .Beitie 
    // haha = .Renwu
    

    这样就可以了,既然我们有了这个变量后,拿着它就得去判断这用了
    一般会用switch,像这个样子

    switch haha! {
            case .Beitie:
                //code
            default:
                //code
            }
    

    开始的时候我没有在haha后面加上感叹号,一直报错,因为switch他没办法去匹配Leixing这里面的东西所以得强加上感叹号才行

    当然不加感叹号的话得在 .Beitie后面加?,感觉swift对这个类型有这变态的控制

    switch

    switch case 这个不陌生
    可以不写break,如果都能概括的话可以不写default,fallthrough是强行执行下面的语句

    switch expression {
       case expression1  :
          statement(s)
          fallthrough /* 可选 */
       case expression2, expression3  :
          statement(s)
          fallthrough /* 可选 */
      
       default : /* 可选 */
          statement(s);
    }
    

    就酱

    展开全文
  • USB枚举过程

    2012-11-01 14:23:00
    USB枚举,USB Emulation,从字面意思看,就是去列举USB,而列举呢,其实就是USB的初始化。 简单来说,USB的枚举,对应的就是USB的Host和Device之间的对话,即Host根据Device所报告上来的参数,得知USB的devi...

    USB枚举,USB Emulation,从字面意思看,就是去列举USB,而列举啥呢,其实就是USB的初始化。

    简单来说,USB的枚举,对应的就是USB的Host和Device之间的对话,即Host根据Device所报告上来的参数,得知USB的device是啥类型的,具有啥功能,然后初始化相关参数。

    接下来,就USB Device就可以正常工作了。

    所以,可以简单的理解为,USB枚举,就是USB设备的初始化(init)。

    USB枚举过程

    1 获取USB设备的设备描述符 : 使用默认地址0

    2 成功后复位设备

    3 对设备进行地址设置  : 使设备从地址状态进入寻址状态

    4 再次获取设备描述符 : 使用新的地址

    5 获取设备配置符

    6 根据设备配置符中的配置符总长度,获取其他配置符(接口,端点等)

    7 设置配置 : 使设备从地址状态进入配置状态

     

    http://www.lvr.com/usbcenum.htm

     

    Enumeration Steps

    The USB 2.0 specification defines six device states.

    During enumeration, a device moves through the Powered, Default, Address, and Configured states.

    (The other states are Attached and Suspend.)

    In each state, the device has defined capabilities and behavior.

    Typical USB 2.0 Sequence

    The steps below are a typical sequence of events that occurs during enumeration of a USB 2.0 device under Windows.

    Device firmware shouldn’t assume that enumeration requests and events will occur in a particular order.

    To function successfully, a device must detect and respond to any control request or other bus event at any time.

    1. The system has a new device.

    A user attaches a device to a USB port, or the system powers up with a device attached.
    The port may be on the root hub at the host or on a hub that connects downstream from the host.
    The hub provides power to the port, and the device is in the Powered state.
    The device can draw up to 100 mA from the bus.

    2. The hub detects the device.

    The hub monitors the voltages on the signal lines (D+ and D-) at each of its ports.
    The hub has a pull-down resistor of 14.25k–24.8kW on each line.
    A device has a pull-up resistor of 900–1575W on D+ for a full-speed device or D- for a low-speed device.
    High-speed-capable devices attach at full speed.
    On attaching to a port, the device’s pull-up brings its line high, enabling the hub to detect that a device is attached.
    On detecting a device, the hub continues to provide power but doesn’t yet transmit USB traffic to the device.
    Chapter 15 has more on how hubs detect devices.

    3. The host learns of the new device.

    Each hub uses its interrupt endpoint to report events at the hub.
    The report indicates only whether the hub or a port (and if so, which port) has experienced an event.
    On learning of an event, the host sends the hub a Get Port Status request to find out more.
    Get Port Status and the other hub-class requests described are standard requests that all hubs support.
    The information returned tells the host when a device is newly attached.

    4. The hub detects whether a device is low or full speed.

    Just before resetting the device, the hub determines whether the device is low or full speed
    by examining the voltages on the two signal lines.
    The hub detects the device’s speed by determining which line has a higher voltage when idle.
    The hub sends the information to the host in response to the next Get Port Status request.
    A USB 1.x hub may instead detect the device’s speed just after a bus reset.
    USB 2.0 requires speed detection before the reset so the hub knows
    whether to check for a high-speed-capable device during reset as described below.

    5. The hub resets the device.

    When a host learns of a new device, the host sends the hub a Set Port Feature request that asks the hub to reset the port.
    The hub places the device’s USB data lines in the Reset condition for at least 10 ms.
    Reset is a special condition where both D+ and D- are logic low.
    (Normally, the lines have opposite logic states.)
    The hub sends the reset only to the new device.
    Other hubs and devices on the bus don’t see the reset.

    6. The host learns if a full-speed device supports high speed.

    Detecting whether a device supports high speed uses two special signal states.
    In the Chirp J state, only the D+ line is driven and in the Chirp K state, only the D- line is driven.
    During the reset, a device that supports high speed sends a Chirp K.
    A high-speed-capable hub detects the Chirp K and responds with a series of alternating Chirp K and Chirp J.
    On detecting the pattern KJKJKJ, the device removes its full-speed pull-up
    and performs all further communications at high speed.
    If the hub doesn’t respond to the device’s Chirp K, the device knows it must continue to communicate at full speed.
    All high-speed devices must be capable of responding to control requests at full speed.

    7. The hub establishes a signal path between the device and the bus.

    The host verifies that the device has exited the reset state by sending a Get Port Status request.
    A bit in the returned data indicates whether the device is still in the reset state.
    If necessary, the host repeats the request until the device has exited the reset state.
    When the hub removes the reset, the device is in the Default state.
    The device’s USB registers are in their reset states, and the device is ready to respond to control transfers at endpoint zero.
    The device communicates with the host using the default address of 00h.

    8. The host sends a Get Descriptor request to learn the maximum packet size of the default pipe.

    The host sends the request to device address 00h, endpoint zero.
    Because the host enumerates only one device at a time,
    only one device will respond to communications addressed to device address 00h even if several devices attach at once.
    The eighth byte of the device descriptor contains the maximum packet size supported by endpoint zero.
    A Windows host requests 64 bytes but after receiving just one packet (whether or not it has 64 bytes),
    the host begins the Status stage of the transfer.
    On completing the Status stage, Windows requests the hub to reset the device as in step 5 above.
    The USB 2.0 specification doesn’t require a reset here.
    The reset is a precaution that ensures that the device will be in a known state when the reset ends.

    9. The host assigns an address.

    When the reset is complete, the host controller assigns a unique address to the device by sending a Set Address request.
    The device completes the Status stage of the request using the default address and then implements the new address.
    The device is now in the Address state.
    All communications from this point on use the new address.
    The address is valid until the device is detached, a hub resets the port, or the system reboots.
    On the next enumeration, the host may assign a different address to the device.

    10. The host learns about the device’s abilities.

    The host sends a Get Descriptor request to the new address to read the device descriptor.
    This time the host retrieves the entire descriptor.
    The descriptor contains the maximum packet size for endpoint zero,
    the number of configurations the device supports, and other basic information about the device.
    The host continues to learn about the device by requesting the one or more configuration descriptors specified in the device descriptor.
    A request for a configuration descriptor is actually a request for the configuration descriptor
    followed by all of its subordinate descriptors up to the number of bytes requested.
    A Windows host begins by requesting just the configuration descriptor’s nine bytes.
    Included in these bytes is the total length of the configuration descriptor and its subordinate descriptors.

    Windows then requests the configuration descriptor again, this time requesting the number of bytes in the retrieved total length.
    The device responds by sending the configuration descriptor followed by all of the configuration’s subordinate descriptors,
    including interface descriptor(s), with each interface descriptor followed by any endpoint descriptors for the interface.
    Some configurations also have class- or vendor-specific descriptors. This chapter has more on what the descriptors contain.

    11. The host assigns and loads a device driver (except for composite devices).

    After learning about a device from its descriptors, the host looks for the best match in a driver to manage communications with the device.
    Windows hosts use INF files to identify the best match.
    The INF file may be a system file for a USB class or a vendor-provided file that contains the device’s Vendor ID and Product ID.
    Chapter 9 has more about selecting a driver.

    For devices that have been enumerated previously, Windows may use stored information instead of searching the INF files.
    After the operating system assigns and loads the driver, the driver may request the device to resend descriptors or send other class-specific descriptors.

    An exception to this sequence is composite devices, which can have different drivers assigned to multiple interfaces in a configuration.
    The host can assign these drivers only after enabling the interfaces, so the host must first configure the device as described below.

    12. The host’s device driver selects a configuration.

    After learning about a device from the descriptors, the device driver requests a configuration
    by sending a Set Configuration request with the desired configuration number.
    Many devices support only one configuration.
    If a device supports multiple configurations, the driver can decide
    which configuration to request based on information the driver has about how the device will be used,
    or the driver can ask the user what to do or just select the first configuration.
    (Many drivers only select the first configuration.)
    On receiving the request, the device implements the requested configuration.
    The device is now in the Configured state and the device’s interface(s) are enabled.

    For composite devices, the host can now assign drivers.
    As with other devices, the host uses the information retrieved from the device
    to find a driver for each active interface in the configuration.

    The device is then ready for use.

    Hubs are also USB devices, and the host enumerates a newly attached hub in the same way as other devices.
    If the hub has devices attached, the host enumerates these after the hub informs the host of their presence.

    Attached state.

    If the hub isn’t providing power to a device’s VBUS line, the device is in the Attached state.
    The absence of power may occur if the hub has detected an over-current condition or
    if the host requests the hub to remove power from the port.
    With no power on VBUS, the host and device can’t communicate,
    so from their perspective, the situation is the same as when the device isn’t attached.

    Suspend State.

    A device enters the Suspend state after detecting no bus activity, including SOF markers, for at least 3 ms.
    In the Suspend state, the device should limit its use of bus power.
    Both configured and unconfigured devices must support this state.
    Chapter 16 has more about the Suspend state.

    SuperSpeed Differences

    Enumerating SuperSpeed devices has some differences compared to USB 2.0:

    • On detecting a downstream SuperSpeed termination at a port, a hub initializes and trains the port’s link. Enumeration then proceeds at SuperSpeed with no need for further speed detecting.
    • The host isn’t required to reset the port after learning of a new device.
    • The bus-current limits are 150 mA before configuration and 900 mA after configuration.
    • The host sends a Set Isochronous Delay request to inform the device of the bus delay for isochronous packets.
    • The host sends a Set SEL request to inform the device of the system exit latency (the amount of time required to transition out of a low-power state).
    • Protocols for entering and exiting the Suspend state differ.
    • For hubs, the host sends a Set Hub Depth request to set the hub-depth value.

     

    http://www.kernelsword.com/article.asp?id=104

     

    1、集线器检测新设备
    主机集线器监视着每个端口的信号电压,当有新设备接入时便可觉察。(集线器端口的两根信号线的每一根都有15kΩ的下拉电阻,而每一个设备在D+都有一个1.5kΩ的上拉电阻。当用USB线将PC和设备接通后,设备的上拉电阻使信号线的电位升高,因此被主机集线器检测到。)


    2、主机知道了新设备连接
    每个集线器用中断传输来报告在集线器上的事件。当主机知道了这个事件,它给集线器发送一个Get_Status请求来了解更多的消息。返回的消息告诉主机一个设备是什么时候连接的。

    3、集线器重新设置这个新设备
    当主机知道有一个新的设备时,主机给集线器发送一个Set_Feature请求,请求集线器来重新设置端口。集线器使得设备的USB数据线处于重启(RESET)状态至少10ms。

    4、集线器在设备和主机之间建立一个信号通路
    主机发送一个Get_Status请求来验证设备是否激起重启状态。返回的数据有一位表示设备仍然处于重启状态。当集线器释放了重启状态,设备就处于默认状态了,即设备已经准备好通过Endpoint 0 的默认流程响应控制传输。即设备现在使用默认地址0x0与主机通信。

    5、集线器检测设备速度
    集线器通过测定那根信号线(D+或D-)在空闲时有更高的电压来检测设备是低速设备还是全速设备。(全速和高速设备D+有上拉电阻,低速设备D-有上拉电阻)。

    6、获取最大数据包长度
    向address0发送USB协议规定的Get_Device_Descriptor命令,以取得却缺省控制管道所支持的最大数据包长度,并在有限的时间内等待USB设备的响应,主机一次只能列举一个USB设备,所以同一时刻只能有一个USB设备使用缺省地址0。

    7、主机分配一个新的地址给设备
    主机通过发送一个Set_Address请求来分配一个唯一的地址给设备。设备读取这个请求,返回一个确认,并保存新的地址。从此开始所有通信都使用这个新地址。

    8、主机向新地址重新发送Get_Device_Descriptor命令,此次读取其设备描述符的全部字段,以了解该设备的总体信息,如VID,PID。

    9、主机向设备循环发送Get_Device_Configuration命令,要求USB设备回答,以读取全部配置信息。

    10、主机发送Get_Device_String命令,获得字符集描述(unicode),比如产商、产品描述、型号等等。

    11、此时主机将会弹出窗口,展示发现新设备的信息,产商、产品描述、型号等。

    12、根据Device_Descriptor和Device_Configuration应答,PC判断是否能够提供USB的Driver,一般能提供几大类的设备,如游戏操作杆、存储、打印机、扫描仪等,操作就在后台运行。但是有的不可以,所以在此时将会弹出对话框,索要USB的Driver。

    13、加载了USB设备驱动以后,主机发送Set_Configuration(x)命令请求为该设备选择一个合适的配置(x代表非0的配置值)。如果配置成功,USB设备进入“配置”状态,并可以和客户软件进行数据传输。此时,常规的USB完成了其必须进行的配置和连接工作。查看注册表,能够发现相应的项目已经添加完毕,至此设备应当可以开始使用。不过,USB协议还提供了一些用户可选的协议,设备如果不应答,也不会出错,但是会影响到系统的功能。 

     

    转载于:https://www.cnblogs.com/shangdawei/archive/2012/11/01/2749619.html

    展开全文
  • java枚举常量的使用

    2017-07-25 10:02:54
    —–第二种方法是根据code来获取内容,可用于对接第三方接口时,对面只给返回码,不给描述信息,让自己去对照文档看是啥意思(特别坑),这时候可以用枚举常量来把其全部列出。 方法一:package ...
  • USB_17、USB的枚举

    2020-09-05 13:20:45
    一、什么是枚举? USB枚举,USB Emulation,从字面意思看,...简单来说,USB的枚举,对应的就是USB的Host和Device之间的对话,即Host根据Device所报告上来的参数,得知USB的device是啥类型的,具有啥功能,然后初...
  • 从零开始学USB(十七、USB的枚举

    千次阅读 多人点赞 2019-01-05 23:52:33
    简单来说,USB的枚举,对应的就是USB的Host和Device之间的对话,即Host根据Device所报告上来的参数,得知USB的device是啥类型的,具有啥功能,然后初始化相关参数,这样主机就可以根据这些信息来加载合适的驱动程序...
  • 以前的Java是没有枚举的,凡是...当我们得到了一个枚举的状态,想打印出状态时我们只能看到一个数字,要想知道这数字是啥意思还得查;当我们使用这个状态时,有些程度员可能图方便用数字来填,有可能这数字完全不在枚举
  • HDU1017暴力枚举

    2019-12-03 19:24:39
    题目大意:没大意就那个意思但是输出格式巨坑,我看了discuss才得到结果我真的我吐了 康代码: #include<stdio.h> int main() { int N,n,m; scanf("%d",&N); while(N--) { int cnt=1; while...
  • 什么意思呢,就是结构体的每一个都可以存储,但如果你也不知道即将存储的是啥,是整型变量还是一个字符串,或者其他的什么什么。如果为每一个都分配空间,对一个足够大的设备确实是无所谓了,开心就好,但是还是之前...
  • (1)字面意思是啥就是啥,看其表示就可以知道其 值和类型。 (2)有值无名,一般用来初始化变量,与一种字符相关联。 #include <stdio.h> int main() { 10;//int型数字10 'c';//char型字符c "Hello wor
  • 【BZOJ1295】最短路

    2019-06-12 20:23:14
    题目没搞懂是啥意思,看了别人的题解才知道是啥意思 分析 这题没啥难度。 可以删除最多T个点,意思就是两点之间最多有T个障碍,意思就是没有障碍权值是0,有障碍权值是1,意思就是两点之间的最短路<=T即可行。 ...
  • 只传输一个)0或者1过去给第三方(此处不包括给前端),如果没有契约第三方会不认识你这个什么意思,那我们在平时写业务逻辑的时候使用枚举很轻易就知道了什么状态什么值。所以我们在构建DTO对象的时候里面放一个...
  • 只传输一个)0或者1过去给第三方(此处不包括给前端),如果没有契约第三方会不认识你这个什么意思,那我们在平时写业务逻辑的时候使用枚举很轻易就知道了什么状态什么值。所以我们在构建DTO对象的时候里面放一个...
  • 关联式容器查找非常快,插入也很快。 key_compare理论上1个字节(由0变1),他不含任何内存。...这里identity进去就返回,本身的意思。 测试: 新版本: 其中_M_color一个枚举类型。 ...
  • vulnhub靶场之HA: Joker

    2020-02-15 17:54:57
    难度:低级 该实验室将引入一些无政府状态。...没看过小丑的电影,不知道这些台词啥意思。 访问8080端口,发现需要http认证。我怀疑账号密码需要在这些注释里找线索, 在这里浪费的大量时间。 做不出...
  • P1014 Cantor表

    2021-02-15 21:21:24
    思路:一开始我没看懂它那个z字形啥意思,后面我在网上找了找才知道这个样子: 好家伙,不说谁知道 知道题意就还好了,观察发现分子分母为1的时候转折点,而且转折后方向会变化,那我们就可以设置临界情况和一...
  • 蓝桥杯2015省赛

    2017-03-19 16:12:35
    1.方程整数解 方程: a^2 + b^2 + c^2 = 1000 (或参见【图1.jpg】) 这个方程有整数解吗?有:a,b,c=6,8,30 就是一组解。...这道题枚举就可以了,不过不知道题目是啥意思 2.星系炸弹 get到了Excel的一个新
  • 用学长的题解来说这个叫做预设性dpdp(其实也不知道啥意思)。意思大概就是枚举当前放哪个数(因为这几个题貌似都这样)。 这个题我们考虑往里边插入数,因为每一次要取maxmax,所以我们根据当前插入的值两边...
  • [POI2008]STA-Station

    2020-10-22 16:50:44
    之前都看过有这个dp,一直不知道是啥意思,本来弱弱树形dp都不太熟悉,不过今天工数课的时候突然想看一下,写个板子题练练吧。 对于我的理解,换根的题目一般是根不确定,而求得答案与根是谁有关,而且通过暴力枚举...
  • 题意:黑白棋都翻转成白色。规则当我翻转其中一个时,它周围的4个棋子跟着它一块翻转。...这道题一看我就觉得不会,看了博客分析了一会儿,才看懂啥意思。(估计自己过不了几天就会忘了,毕竟不是自
  • 公式的意思是先两个for枚举两个点,然后再两个for枚举两个子路径,如果子路径异或和是0 那就答案加一。 题解:先找子路径异或和是0的,然后两边节点乘一下就好。 因为异或,可以处理一下每个点到根节点的异或。...
  • 最后几分钟才看这题,看了题解才看懂啥意思枚举gcd(gcd>1),比如gcdb,找到b的倍数(包括b)的个数t,则,这t个数的因子都有b,则这些序列的价值就是∑ti=0i∗(ti)\sum_{i=0}^{t}i*\bigl(\begin{smallmatrix...
  • uva 10132 File Fragmentation

    2014-12-01 13:16:01
    首先一个没看懂"any of the possible solutions may be output"啥意思,以为要输出所有解,搞去重搞了半天还加了个set,然后没看见输出之间要加空行,黑体居然被我无视了-_-||,这个题其实只需要排个序然后枚举...
  • AFO && OI回忆录

    2019-04-06 21:04:00
    T1 2h写个跟\(k\)无关的假算法写到最后发现三个log,出考场才发现K很小可以直接枚举 T2 神仙题没时间写。 T3 神仙题没猜出后面的题目意思。 Day2就算翻盘也翻不了几分吧。 今晚趁着在酒店有空赶紧写写想说的话。...
  • [恢]hdu 1239

    2012-01-07 00:13:00
    2011-12-31 01:58:02 ... 题意:给m、a、b。求一对素数p,q(p<q)使得p*q<=m且p/q >...mark:刚开题看了半天,才看明白啥意思。 看到m10w,然后case2000组,一下懵了,以为不能枚举。后来...

空空如也

空空如也

1 2
收藏数 36
精华内容 14
关键字:

枚举是啥意思