HDU 5833 Zhu and 772002 ——线性基】的更多相关文章

[题目分析] 这题貌似在UVA上做过,高精度高斯消元. 练习赛T2,然后突然脑洞出来一个用Bitset的方法. 发现代码只需要30多行就A掉了 Bitset大法好 [代码] #include <cstdio> #include <bitset> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define F(i,j,k) for…
传送门:hdu 5833 Zhu and 772002 题意:给n个数,每个数的素数因子不大于2000,让你从其中选则大于等于1个数相乘之后的结果为完全平方数 思路: 小于等于2000的素数一共也只有305个 一个数,如果他某个素数因子的幂为偶,那这个素数的可以不用考虑:如果幂为奇数,那这个素数就应当被考虑如何与其他数凑成幂为偶数.例如12,可以表示为2^2*3,2的幂次为2,3的幂次为1,所以,如果要和其他数相乘为完全平方数,那么一定要与素数因子3为奇次的合并 那么根据上面两条,我们可以列出方…
HDU 5833 Zhu and 772002 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Description 题目描述 Zhu and 772002 are both good at math. One day, Zhu wants to test the ability of 772002, so he asks 772002 to solve a math pro…
Zhu and 772002 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5833 Description Zhu and 772002 are both good at math. One day, Zhu wants to test the ability of 772002, so he asks 772002 to solve a math problem. But 772002 has a appointment with his g…
Zhu and 772002 Problem Description Zhu and 772002 are both good at math. One day, Zhu wants to test the ability of 772002, so he asks 772002 to solve a math problem. But 772002 has a appointment with his girl friend. So 772002 gives this problem to y…
题意:给n个数,从n个数中抽取x(x>=1)个数,这x个数相乘为完全平方数,求一共有多少种取法,结果模1000000007. 思路:每个数可以拆成素数相乘的形式,例如: x1 2=2^1 * 3^0 * 5^0; x2 3=2^0 * 3^1 * 5^0; x3 4=2^2 * 3^0 * 5^0; x4 5=2^0 * 3^0 * 5^1; x5 6=2^1 * 3^1 * 5^0; x6 15=2^0 * 3^1 * 5^1; 用xi表示第i个数选或不选,xi的取值为0或1:因为相乘结果为完…
题目链接 题意:给定n个数,这n个数的素因子值不超过2000,从中取任意个数使其乘积为完全平方数,问有多少种取法. 题解:开始用素筛枚举写了半天TLE了,后来队友说高斯消元才想起来,果断用模板.赛后又得知这是个原题sgu200,真坑啊.把每个数进行素因子分解,素因子a的幂为奇数则视为1,偶数则视为0,转化为从n个数中取数异或和为0有多少种取法的问题. AC代码: #include <cstdio> #include <cstring> #include <cmath>…
ccpc网赛卡住的一道题 蓝书上的原题 但是当时没看过蓝书 今天又找出来看看 其实也不是特别懂 但比以前是了解了一点了 主要还是要想到构造异或方程组 异或方程组的消元只需要xor就好搞了 数学真的是硬伤啊…… (链接:蓝书161页详细讲解 我也在看…… #include<cstdio> #include<iostream> #include<algorithm> #include<cmath> #include<cstring> #include…
pro:给定N个数Xi(Xi<1e18),保证每个数的素因子小于2e3:问有多少种方案,选处一些数,使得数的乘积是完全平方数.求答案%1e9+7: N<300; sol:小于2e3的素数只有304个.选或者不选看成1和0,那么问题其实就是问%2意义下的自由元. 答案是2^自由元 #include<bits/stdc++.h> #define ll long long #define rep(i,a,b) for(int i=a;i<=b;i++) using namespac…
XOR Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2302    Accepted Submission(s): 783 Problem Description XOR is a kind of bit operator, we define that as follow: for two binary base number A…