ZOJ 3435 Ideal Puzzle Bobble】的更多相关文章

ZOJ Problem Set - 3435 Ideal Puzzle Bobble Time Limit: 2 Seconds      Memory Limit: 65536 KB Have you ever played Puzzle Bobble, a very famous PC game? In this game, as a very cute bobble dragon, you must keep shooting powerful bubbles to crush all t…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4119 依然是三维空间内求(1,1,1)~(a,b,c)能看到的整点数,平移一下转化成(0,0,0)~(a-1,b-1,c-1)就和前一题就一样了 还是莫比乌斯反演求gcd(a,b,c)=1的组数,公式还是sigma{u(d) * ((a/d+1) * (b/d+1) * (c/d+1) - 1)} 但直接暴力会T...所以加了分块优化...因为当a/d,b/d,c/d的值保持…
题面戳我 题意:你现在处于\((1,1,1)\),问可以看见多少个第一卦限的整点. 第一卦限:就是\((x,y,z)\)中\(x,y,z\)均为正 sol 首先L--,W--,H--,然后答案就变成了 \[\sum_{i=1}^{L}\sum_{j=1}^{W}\sum_{k=1}^{H}[\gcd(i,j,k)==1]+\sum_{i=1}^{L}\sum_{j=1}^{W}[\gcd(i,j)==1]\] \[+\sum_{i=1}^{L}\sum_{j=1}^{H}[\gcd(i,j)==…
题意:n个数字的串,每取出一个数字的代价为该数字和左右的乘积(1.n不能取),问最小代价 思路:dp[i][j]表示把i~j取到只剩 i.j 的最小代价. 代码: #include<set> #include<map> #include<cmath> #include<queue> #include<cstdio> #include<cstring> #include<algorithm> typedef long lon…
ZOJ 3541 题目大意:有n个按钮,第i个按钮在按下ti 时间后回自动弹起,每个开关的位置是di,问什么策略按开关可以使所有的开关同时处于按下状态 Description There is one last gate between the hero and the dragon. But opening the gate isn't an easy task. There were n buttons list in a straight line in front of the gate…
Number Puzzle Time Limit: 2 Seconds      Memory Limit: 65536 KB Given a list of integers (A1, A2, ..., An), and a positive integer M, please find the number of positive integers that are not greater than M and dividable by any integer from the given…
把L,H,W分别减一就变成上面一个题目了. 不多说,也不召唤代码君了.…
1.题目描写叙述:点击打开链接 2.解题思路:本题是一道隐式图的搜索题目.一般来说,这类题目首先要定义状态,接下来是弄清楚状态怎样转移,以及状态怎样判重,怎样推断当前状态是否和目标状态同样.至于求解最短路就是经常使用的BFS就可以. 接下来我们逐一展开讨论. 1.状态的定义:看到这道题,猛一下会想着把每一个字符分别用01表示,然后看成二进制码进行状态压缩,这个状态定义尽管能够,可是显然,状态过于精确和复杂,假设把一行给压缩成一个整数,那么一个完整的图案要用8*9.即72个数才干描写叙述.显然过于…
求(1,1,1)至(x,y,z)的互质个数. 即求(0,0,0)到(x-1,y-1,z-1)互质个数. 依然如上题那样做.但很慢...好像还有一个分块的思想,得学学. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define N 1000005 using namespace std; typedef long long LL; int mobi…
题面 lcm(x,y)=xy/gcd(x,y) lcm(x1,x2,···,xn)=lcm(lcm(x1,x2,···,xn-1),xn) #include <bits/stdc++.h> using namespace std; long long n,m; ]; long long gcd(long long a,long long b) { if(!b){ return a; } return gcd(b,a%b); } long long lcm(long long a,long lo…