TOJ 4976: 新生数(深搜)】的更多相关文章

传送门:http://acm.tzc.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=4976 时间限制(普通/Java):1000MS/3000MS     内存限制:65536KByte 描述 我们定义十进制数中有6的为新生数.现在给你一些二进制数,叫你判断是不是新生数.当然这个太简单了,我们换种玩法,给你一个不完全的二进制数,其中有些数字是未知的用x表示,问,这个未知的二进制数最多可以有几种新生数的表示. 输入 输入有多组数…
https://www.luogu.org/problem/P1004 题目描述 设有N×N的方格图(N≤9),我们将其中的某些方格中填入正整数,而其他的方格中则放入数字0.如下图所示(见样例): 某人从图的左上角的A点出发,可以向下行走,也可以向右走,直到到达右下角的B点.在走过的路上,他可以取走方格中的数(取走后的方格中将变为数字0).此人从A点到B点共走两次,试找出2条这样的路径,使得取得的数之和为最大. 输入格式 输入的第一行为一个整数N(表示N×N的方格图),接下来的每行有三个整数,前…
leetcode104 二叉树的最大深度 https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/ 深度搜索分两种:递归(使用栈) 广度搜索:非递归(使用队列) 1. 广度搜索bfs:(标准模板)(也可建议用c++的queue,deque是双端队列,可以实现头尾的插入和弹出) 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int va…
题目链接 https://acm.bnu.edu.cn/v3/problem_show.php?pid=52310 problem description Define the depth of a node in a rooted tree by applying the following rules recursively: • The depth of a root node is 0. • The depths of child nodes whose parents are with…
题目链接 https://acm.bnu.edu.cn/v3/problem_show.php?pid=52305 problem  description In ICPCCamp, there are n cities and (n−1) (bidirectional) roads between cities. The i-th road is between the ai-th and bi-th cities. It is guaranteed that cities are conne…
题目链接:HDU 5355 http://acm.split.hdu.edu.cn/showproblem.php?pid=5355 Problem Description There are m soda and today is their birthday. The 1-st soda has prepared n cakes with size 1,2,…,n. Now 1-st soda wants to divide the cakes into m parts so that th…
codevs 1047 邮票面值设计 1999年NOIP全国联赛提高组  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond 题目描述 Description 给定一个信封,最多只允许粘贴N张邮票,计算在给定K(N+K≤40)种邮票的情况下(假定所有的邮票数量都足够),如何设计邮票的面值,能得到最大值MAX,使在1-MAX之间的每一个邮资值都能得到. 例如,N=3,K=2,如果面值分别为1分.4分,则在1分-6分之间的每一个邮资值都能得到(当然还有8分.9…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5648 题意:给定n,m(1<= n,m <= 15,000),求Σgcd(i|j,i&j);(1 <= i <= n,1<=j<=m); 至多三组数据,至多两组数据max(n,m) > 2000.至多一组数据max(n,m) > 8000; 很多题解是用递推打表,将数据压缩250倍,即[i][j]:代表[1...250*i][1...250*j],之后零…
最小生成树计数 Description 现在给出了一个简单无向加权图.你不满足于求出这个图的最小生成树,而希望知道这个图中有多少个不同的最小生成树.(如果两颗最小生成树中至少有一条边不同,则这两个最小生成树就是不同的).由于不同的最小生成树 可能很多,所以你只需要输出方案数对31011的模就可以了. Input 第 一行包含两个数,n和m,其中1<=n<=100; 1<=m<=1000; 表示该无向图的节点数和边数.每个节点用1~n的整数编号.接下来的m行,每行包含两个整数:a,…
Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small castle that has four openings through which to shoot. The fo…