A.digits 2 传送门 题意:给你一个n,要求输出一个每一位数字之和能整除n且其本身也能整除n的数.n不超过100,要求的数不超过10000位数. 题解:直接将n输出n次. 代码: #include <bits/stdc++.h> #define ll long long using namespace std; int main() { int T,n; for (scanf("%d",&T);T--;) { scanf("%d",&am…
链接:https://ac.nowcoder.com/acm/contest/881/A来源:牛客网 题目描述 Two arrays u and v each with m distinct elements are called equivalent if and only if RMQ(u,l,r)=RMQ(v,l,r)RMQ(u,l,r)=RMQ(v,l,r) for all 1≤l≤r≤m1≤l≤r≤mwhere RMQ(w,l,r)RMQ(w,l,r) denotes the inde…
链接:https://ac.nowcoder.com/acm/contest/881/A 来源:牛客网 Equivalent Prefixes 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Format: %lld 题目描述 Two arrays u and v each with m distinct elements are called equivalent if and only if R M Q ( u ,…
链接:https://ac.nowcoder.com/acm/contest/882/F来源:牛客网 Given 2N people, you need to assign each of them into either red team or white team such that each team consists of exactly N people and the total competitive value is maximized. Total competitive va…
链接:https://ac.nowcoder.com/acm/contest/888/E来源:牛客网 Gromah and LZR have entered the fifth level. Unlike the first four levels, they should do some moves in this level. There are nn_{}n vertices and mm_{}m bidirectional roads in this level, each road…
链接:https://ac.nowcoder.com/acm/contest/881/A来源:牛客网 Two arrays u and v each with m distinct elements are called equivalent if and only if RMQ(u,l,r)=RMQ(v,l,r)RMQ(u,l,r)=RMQ(v,l,r) for all 1≤l≤r≤m1≤l≤r≤m where RMQ(w,l,r)RMQ(w,l,r) denotes the index of…
链接:https://ac.nowcoder.com/acm/contest/889/D来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 Amy asks Mr. B problem D. Please help Mr. B to solve the following problem. Amy wants to crack Merkle–Hellman knapsack…
链接:https://ac.nowcoder.com/acm/contest/886/J来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 Rowlet is playing a very popular game in the pokemon world. Recently, he has encountered a problem and wants to ask for…
https://ac.nowcoder.com/acm/contest/885/F #include <bits/stdc++.h> //CLOCKS_PER_SEC #define se second #define fi first #define ll long long #define Pii pair<int,int> #define Pli pair<ll,int> #define ull unsigned long long #define pb push…
https://ac.nowcoder.com/acm/contest/885/C 这个跟平时那种求离散对数的bsgs不一样,虽然可以转化成离散对数来做不过会T掉.展开递推式然后合并具有a的项,发现其实是离散对数. #include<cstdio> #include<algorithm> const int AA = 1000000; std::pair<int, int> d[AA]; int mypow(long long x, int y, int p) { lo…
传送门:https://ac.nowcoder.com/acm/contest/885/B 题意:给出,由公式 求出 思路:没学过矩阵快速幂.题解说是矩阵快速幂,之后就学了一遍.(可以先去学一下矩阵快速幂) 构造.然后就可以套板子写了,不过要注意把二进制改成十进制(这里也让我对对快速幂取模有了更好的理解) 注释见代码了 #include<bits/stdc++.h> using namespace std; struct node { long long c[2][2]; }; long lo…
>传送门< 题意:给你两个数字字符串s,t,求字符串s的子序列比字符串t大的个数 思路:他的题解上写的就是dp的基础练习题,好像的确是这么回事,既然是dp,那么对于定义的状态不同得到的转移方程就不同,写法自然就不一样.这里给出其中一种dp的解法 首先从 s 串中选的数字长度大于 t 串长度,肯定ok,那么我们枚举第一个数字的位置并且用组合数搞一搞就可以了,接下来我们用dp搞定长度与 t 串相等且大于 t 的数字数量即可 设dp[i][j]表示 s的前i个,匹配 t 的前 j 个的种类数 if(…