HDU 4569 Special equations (数学题)】的更多相关文章

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4569 题意:给你一个最高幂为4的一元多项式,让你求出一个x使其结果模p*p为0. 题解:f(x)%(p*p)=0那么一定有f(x)%p=0,f(x)%p=0那么一定有f(x+p)%p=0. 所以我们可以开始从0到p枚举x,当f(x)%p=0,然后再从x到p*p枚举,不过每次都是+p,找到了输出即可,没有的话No solution! AC代码: #include <iostream> #includ…
Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4569 Description Let f(x) = a nx n +...+ a 1x +a 0, in which a i (0 <= i <= n) are all known integers. We call f(x) 0 (mod…
Problem Description Let f(x) = anxn +...+ a1x +a0, in which ai (0 <= i <= n) are all known integers. We call f(x) 0 (mod m) congruence equation. If m is a composite, we can factor m into powers of primes and solve every such single equation after wh…
题目 //想不出来,看了解题报告 /* 题意:给你一个最高幂为4的一元多项式,让你求出一个x使其结果模p*p为0. 题解:f(x)%(p*p)=0那么一定有f(x)%p=0,f(x)%p=0那么一定有f(x+p)%p=0. 所以我们可以开始从0到p枚举x,当f(x)%p=0,然后再从x到p*p枚举,不过每次都是+p,找到了输出即可,没有的话No solution! */ #include<stdio.h> int main() { int t,n; __int64 a[],p; scanf(&…
/* HDU4569 Special equations http://acm.hdu.edu.cn/showproblem.php?pid=4569 数论 题意:f(x)为一n次方程求是否存在x, s.t. f(x)=0 (mod p^2) 其中p为质数 首先,我们只需考虑0-p中的x即可,因为其他的x总可以先取模 到这个区间,因此可以在1e4内找到f(x)=0(mod p)的x 考虑到 x=0(mod p^2) => x=0(mod p) 因此只需在这些x中找是否满足x=0(mod p^2)…
HDU 5839 Special Tetrahedron 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5839 Description Given n points which are in three-dimensional space(without repetition). Please find out how many distinct Special Tetrahedron among them. A tetrahedron is ca…
Special Tetrahedron 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5839 Description Given n points which are in three-dimensional space(without repetition). Please find out how many distinct Special Tetrahedron among them. A tetrahedron is called Sp…
Special Tetrahedron 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5839 Description Given n points which are in three-dimensional space(without repetition). Please find out how many distinct Special Tetrahedron among them. A tetrahedron is called Sp…
Special Fish Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2367    Accepted Submission(s): 878 Problem Description There is a kind of special fish in the East Lake where is closed to campus o…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5839 在一个三维坐标,给你n个点,问你有多少个四面体(4个点,6条边) 且满足至少四边相等 其余两边不相邻. 暴力4重循环,但是在第3重循环的时候需要判断是否是等腰三角形,这便是一个剪枝.在第4重循环的时候判断4点是否共面 (叉乘), 5或者6边相等就+1,4边相等就判断另外两边是否相交就行了. 赛后过的,觉得自己还是太菜了. //#pragma comment(linker, "/STACK:10…
Equations Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3978    Accepted Submission(s): 1602 Problem Description Consider equations having the following form: a*x1^2+b*x2^2+c*x3^2+d*x4^2=0a, b…
Special Fish Problem Description There is a kind of special fish in the East Lake where is closed to campus of Wuhan University. It's hard to say which gender of those fish are, because every fish believes itself as a male, and it may attack one of s…
题目描述:有一个公式,Ai = (Ai-1 + Ai+1)/2 - Ci (i = 1, 2, 3, .... n).,如果给出A0, An+1, 和 C1, C2, .....Cn要你计算出A1是多少. 解题报告:一个简单的数学题,我的做法先将公式变形得到:A[n] = 2*A[n-1]+2*C[n-1]-A[n-2],是分别定义两个数组,设A1 = x,然后两个数组里面一个存放第n项的系数,另一个存放第n项的常数,这样一直递推到第n+1项,然后直接解一元一次方程就可以了.代码附上: #inc…
转载链接 因为:Ai=(Ai-1+Ai+1)/2 - Ci,        A1=(A0  +A2  )/2 - C1;       A2=(A1  +  A3)/2 - C2 , ... =>    A1+A2 = (A0+A2+A1+A3)/2 - (C1+C2) =>    A1+A2 =  A0+A3 - 2(C1+C2)  同理可得:       A1+A1 =  A0+A2 - 2(C1)        A1+A2 =  A0+A3 - 2(C1+C2)       A1+A3 =…
Poor Hanamichi Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 743    Accepted Submission(s): 275 Problem Description Hanamichi is taking part in a programming contest, and he is assigned to so…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1030 Delta-wave Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7163    Accepted Submission(s): 2772 Problem Description A triangle field is numbe…
题目链接:pid=4950http://acm.hdu.edu.cn/showproblem.php?pid=4950">http://acm.hdu.edu.cn/showproblem.php?pid=4950 Monster Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 220    Accepted Submission…
http://acm.hdu.edu.cn/showproblem.php?pid=1215 题目大意: 找对象的题...汗..将你的编号(唯一)的所有因子加起来,所得到的的另一个编号的主人就是你的另一半.给出你的编号,要求找到你的对象的编号. 一开始直接模拟TLE. 然后后来看到别人是这么做的: #include<cstdio> #include<string> int main() { int T; scanf("%d",&T); while(T--…
……但是没仔细看,直接跳过了 这题直接枚举就可以过了 ;}…
Problem Description Inmany applications very large integers numbers are required. Some of theseapplications are using keys for secure transmission of data, encryption, etc.In this problem you are given a number, you have to determine the number ofdig…
解题报告:算利息的,不过一开始格式控制符里面少写了一个%lf,一直没看到,愣是没找到错误,唉! #include<cstdio> int main() { int T; scanf("%d",&T); while(T--) { double Y,Q,e,f,g,ans1,ans2; scanf("%lf%lf%lf%lf%lf",&Y,&Q,&e,&f,&g); e/=100.0,f/=100.0,g/=1…
求最大费用能够将边权取负以转化成求最小费用. 然而此时依旧不正确.由于会优先寻找最大流.可是答案并不一定出如今满流的时候.所以要加一些边(下图中的红边)使其在答案出现时满流. 设全部边的流量为1,花费例如以下图所看到的. 显然最大花费是1001.而没有红边的情况下会得到3. #include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <c…
Special equations Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 178    Accepted Submission(s): 87 Special Judge Problem Description Let f(x) = a nx n +...+ a 1x +a 0, in which a i (0 <= i <=…
爆头 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1447    Accepted Submission(s): 601 Problem Description gameboy是一个CS高手,他最喜欢的就是扮演警察,手持M4爆土匪的头.也许这里有人没玩过CS,有必要介绍一下“爆头”这个术语:所谓爆头,就是子弹直接命中对方的头部,以秒杀…
题目传送门 题目描述 夏川的生日就要到了.作为夏川形式上的男朋友,季堂打算给夏川买一些生日礼物.商店里一共有种礼物.夏川每得到一种礼物,就会获得相应喜悦值$W_i$(每种礼物的喜悦值不能重复获得).每次,店员会按照一定的概率$P_i$(或者不拿出礼物),将第i种礼物拿出来.季堂每次都会将店员拿出来的礼物买下来.没有拿出来视为什么都没有买到,也算一次购买.众所周知,白毛切开都是黑的.所以季堂希望最后夏川的喜悦值尽可能地高.求夏川最后最大的喜悦值是多少,并求出使夏川得到这个喜悦值,季堂的期望购买次数…
HDU 5832 - A water problem 题意:有两颗星球,一年的长度分别为37天和173天.问第n天时它们是否为新年的第一天. 思路:显然  n 同时被37和173整除时,两种历法都在新年第一天,即 n 是 37*173=10001的倍数. 坑点:n的长度会达到1e7,我以为要用读入挂之类的,手写用getchar()读入却TLE,直接scanf("%s", n)就没事. #include<iostream> #include<cstdio> usi…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1496 Equations Description Consider equations having the following form: a*x1^2+b*x2^2+c*x3^2+d*x4^2=0a, b, c, d are integers from the interval [-50,50] and any of them cannot be 0. It is consider a solu…
Array Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5587 Description Vicky is a magician who loves math. She has great power in copying and creating.One day she gets an array {1}. After that, every day she cop…
题目链接:hdu 1299 Diophantus of Alexandria 题意: 给你一个n,让你找1/x+1/y=1/n的方案数. 题解: 对于这种数学题,一般都变变形,找找规律,通过打表我们可以发现这个答案只与这个数的因子有关. n=a1^p1*a2^p2*...*an^pn ans=((1+2*p1)*(1+2*p2)*...*(1+2*pn)+1)/2 #include<bits/stdc++.h> #define F(i,a,b) for(int i=a;i<=b;++i)…
hdu 1496 Equations hash表 题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1496 思路: hash表,将原来\(n^{4}\)降为\(n^{2}\) 关系式:\(a*{x{}_1}^{2}+b*{x{}_2}^{2}=-c*{x{}_3}^{2}-d*{x{}_4}^{2}\) 详见hdu课件:https://wenku.baidu.com/view/af87677fa76e58fafab003e5.html 代码: #in…