https://vjudge.net/problem/UVA-12063 题意: 统计n为二进制数中,0和1相等且值为m的倍数的数有多少个 dp[i][j][k] 前i位二进制 有j个1 值模m等于k 的数的个数 最高位强制填1,所以实际只需要dp n-1位 #include<cstdio> #include<cstring> using namespace std; ][][]; int main() { int T,n,m; long long ans; scanf(&quo…
题意:给你n.k,问你有多少个n为二进制的数(无前导零)的0与1一样多,且是k的倍数 题解:对于每个k都计算一次dp,dp[i][j][kk][l]表示i位有j个1模k等于kk且第一位为l(0/1) 再次预处理mod[i][j]表示1的i次方模j等于几,具体看代码注释 import java.util.Scanner; public class Main{ static int Maxn=65; static int Maxk=101; //前i个数有j个1模给定的值余k且第一位为1或者0的总个…
Description Given a string of 0's and 1's up to 1000000 characters long and indices i and j, you are to answer a question whether all characters between position min(i,j) and position max(i,j) (inclusive) are the same. Input There are multiple cases…
大佬真的强!!https://blog.csdn.net/u014800748/article/details/45225881 #include<cstdio> #include<cstring> #define REP(i, a, b) for(int i = (a); i < (b); i++) using namespace std; typedef long long ll; const int MAXN = 70; int mod[MAXN], n, k; ll…