You have nn lights, each with its own button, in a line. Pressing a light’s button will toggle that light’s state; if the light is on, it will turn off, and if the light is off, it will turn on. The lights change at 1 second timesteps. You can press…
Flashing Fluorescents 时间限制: 1 Sec 内存限制: 128 MB提交: 56 解决: 19[提交] [状态] [讨论版] [命题人:admin] 题目描述 You have n lights, each with its own button, in a line. Pressing a light’s button will toggle that light’s state; if the light is on, it will turn off, and…
You are given a rooted tree with n nodes. The nodes are numbered 1..n. The root is node 1, and m of the nodes are colored red, the rest are black. You would like to choose a subset of nodes such that there is no node in your subset which is an ancest…
问题描述 蒜头君酷爱搭积木,他用积木搭了 n 辆重量为 wi的小车和一艘最大载重量为 W 的小船,他想用这艘小船将 n 辆小车运输过河.每次小船运载的小车重量不能超过 W.另外,小船在运载小车时,每辆小车会对小船有一个损坏值si,当多辆小车一起运载时,该趟运载对小船的损坏值为船上所有小车的最大损坏值.现在蒜头君想知道,如何用小船运载 n 辆小车,可以使得对小船造成的总损坏值最小.输入格式第一行输入两个数 W 和 n(100≤w≤400,1≤n≤16),分别表示小船的最大载重量和小车总数.接下来输…
题目链接:https://nanti.jisuanke.com/t/31434 小 D 是一位著名的车手,他热衷于在广场上飙车.每年儿童节过后,小 D 都会在广场上举行一场别样的车技大赛. 小 D 所在的广场可以看作一个 W×H 的网格,初始时小 D 位于左下角的 (1,1) 处,他的目的地是位于右上角的 (W,H). 每次移动时,小 D 会选择位于他右上方的一个方格,并移动到这个方格.由于车技的限制,每次移动小 D 的横坐标变化和纵坐标变化都不能超过 K. 也就是说,每次小 D 会在以当前位置…
题目链接:https://cn.vjudge.net/problem/HDU-1565 Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description 给你一个n*n的格子的棋盘,每个格子里面有一个非负数.从中取出若干个数,使得任意的两个数所在的格子没有公共边,就是说所取的数所在的2个格子不能相邻,并且取出的数的和最大. Input 包括多个测试实例,每…