Halloween Costumes 玄学题】的更多相关文章

传送门 太难了,完全不懂 设\(dp[i][j]\)为第i天到第j天的最少代价 \(dp[i][j]=dp[i][j-1]+1\)(第j天多穿一件衣服) \(dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j-1])\);(往前找一天k与j衣服相同,把中间的衣服都脱掉) #include <bits/stdc++.h> using namespace std; int n,m,dp[209][209],a[209]; int main() { int t,o=1;…
1422 - Halloween Costumes   PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's…
B - Halloween Costumes Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1422 Description Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as…
题目链接:https://vjudge.net/problem/LightOJ-1422 1422 - Halloween Costumes    PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to…
工业题 题解 抱歉,题解没时间写了 代码 #include<bits/stdc++.h> using namespace std; #define ll long long #define A 6666666 #define mod 998244353 ll jie[A],ni[A],acnt[A],bcnt[A]; ll fheng[A],fshu[A]; ll n,m,a,b; ll meng(ll x,ll k){ ll ans=1; for(;k;k>>=1,x=x*x%m…
T1:工业题 基本思路   这题有一个重要的小转化: 我们将原来的函数看作一个矩阵,\(f(i,j-1)*a\)相当于从\(j-1\)向右走一步并贡献a,\(f(i-1,j)*b\)相当于从\(i-1\)向下走一步并贡献b   那么问题就转化成了求从第\(0\)行与第\(0\)列的所有点走到点\((m,n)\)的所有方案数的总贡献   在一个点,对于他之前的点的所有走法,他都有可能向下或右走并带来贡献,所以是统计所有方案数.   易知从点\((i,j)\)到点\((m,n)\)的走的步数是\(m…
Description Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's Halloween, these parties are all costume parties, Gappu always selects his costumes in such…
Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's Halloween, these parties are all costume parties, Gappu always selects his costumes in such a way that…
题解 题如其名,是挺玄学的. 我们发现每个值是 \(-1\) 还是 \(1\) 只与它的次数是奇是偶有关,而 \(\sum_j^{j\le m}d(i×j)\) 又只与其中有多少个奇数有关 对于 \(x\) 其 \(d(x)\) 只有在 \(x\) 是完全平方数时才是奇数(易证),那么我们将每个 \(i\) 表示为 \(p×q^2\) 其中 \(p\) 的因子次数全为 \(1\) 那么能对其造成贡献的 \(j\) 只有当 \(p_j=p_i\),而这种数的个数为 \(\sqrt{\frac{m}…
题目链接:http://vjudge.net/contest/141291#problem/D 题意:有n个地方,每个地方要穿一种衣服,衣服可以嵌套穿,一旦脱下的衣服不能再穿,除非穿同样的一件新的,问在满足题目要求的穿衣顺序下最少需要准备几件衣服. 思路:区间dp //这个是看的别人的代码理解的,但是按照自己理解的写的代码样例正确,但是结果怎么都是WA的,不知道为什么,等我问问学长搞懂了再补题.//隔天改对了. 代码1: #include<iostream> #include<cstdi…