题意:给你一个长度为1000的串以及一个数n 让你将串中的‘?’填上数字 使得该串是n的倍数而且最小(没有前导零) 题解:dp,令dp[len][mod]为是否出现过 填到第len位,余数为mod 的状态(dp=0 or 1) 用记忆化搜索来实现,dfs返回1或0. 如果搜到最后一位并且余数为0,返回1. 如果搜到已经更新过的dp状态,直接返回0. 将mod作为全局变量,不断更新mod. 对于每一位 的‘? ’ 暴力枚举0~9 #include<stdio.h> #include<std…
Problem H: Two EndsIn the two-player game “Two Ends”, an even number of cards is laid out in a row. On each card, faceup, is written a positive integer. Players take turns removing a card from either end of the row andplacing the card in their pile.…
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=25844 思路:首先预处理出点在同一直线上的所有的点集状态(dp[i][j]),然后记忆化搜索. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define inf 1<<…
题意: 小兔的棋盘 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 6193 Accepted Submission(s): 3373 Problem Description 小兔的叔叔从外面旅游回来给她带来了一个礼物,小兔高兴地跑回自己的房间,拆开一看是一个棋盘,小兔有所失望.不过没过几天发现了棋盘的好玩之处.从起点(0,0)走到终点(n,…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game ju…
链接https://nanti.jisuanke.com/t/31454 思路 开始没读懂题,也没注意看数据范围(1000*200的状态,记忆化搜索随便搞) 用记忆化搜索处理出来每个状态的胜负情况 因为每个人都会选择最优的,因此记忆化搜索的过程其实就是在模拟两个人每一步决策所带来的胜负情况, 只要返回一个必胜,就直接返回(因为会选择最优) 然后在没有返回必胜的状态下,有平局就选择平局,没有平局就只能输了 #include<bits/stdc++.h> #define st 100 #defin…
[来源]: 2008年哈尔滨区域赛题目 [题目链接]: http://acm.hdu.edu.cn/showproblem.php?pid=2452 [参考博客]: https://blog.csdn.net/watermuch/article/details/9465185 [题意]: 真的要好好检讨,英语不好,这个题就别想做了. 意译一波,就是船是有两位领导  进行领航,一位叫做V,另一位叫G. 给出一幅有向无环图,每一个节点都有一个权值,如果经过这个节点都会获得对应的权值. 从一个入度为0…
http://acm.hdu.edu.cn/showproblem.php?pid=3555 Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 7316    Accepted Submission(s): 2551 Problem Description The counter-terrorists found a time…
一.引例 #1033 : 交错和 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定一个数 x,设它十进制展从高位到低位上的数位依次是 a0, a1, ..., an - 1,定义交错和函数: f(x) = a0 - a1 + a2 - ... + ( - 1)n - 1an - 1 例如: f(3214567) = 3 - 2 + 1 - 4 + 5 - 6 + 7 = 4 给定 l, r, k,求在 [l, r] 区间中,所有 f(x) = k 的 x 的和,…
#1033 : 交错和 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描写叙述 给定一个数 x,设它十进制展从高位到低位上的数位依次是 a0, a1, ..., an - 1,定义交错和函数: f(x) = a0 - a1 + a2 - ... + ( - 1)n - 1an - 1 比如: f(3214567) = 3 - 2 + 1 - 4 + 5 - 6 + 7 = 4 给定 输入 输入数据仅一行包括三个整数.l, r, k(0 ≤ l ≤ r ≤ 1018, |…