随笔分类 - 数学
摘要:C. Triangletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a right triangle with legs of lengthaandb. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to
阅读全文
摘要:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2831题意:已知A,B,C,D,E,F的坐标,求G,H的坐标,并且已知三角形DEF的面积等于平行四边形的面积,点H在AC上。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 struct Point 8 { 9 double x,y;10 Point(double x=0,double y=0):x(x),y(y) ...
阅读全文
摘要:http://poj.org/problem?id=2661题意:Amtel在1960年发行了4位计算机,并实行每十年位数翻一番的策略,将最大整数n作为改变的等级,其中n!表示计算机的无符号整数(n!头文件中log(n)表示以e为底的n的对数)。通过累加 log(i)(i >= 1),直到和超过 k*log(2) break;则i-1即为等级。 1 #include 2 #include 3 #include 4 int main() 5 { 6 int year; 7 while(~scanf("%d",&year)&&year) 8 { 9
阅读全文
摘要:http://poj.org/problem?id=1850题意:求所给字符串按照题目的编码规则,它的编码应是多少? 1 #include 2 #include 3 #define LL long long 4 5 double C(int a,int b)//计算组合数C(a,b) 6 { 7 if(a 0)11 {12 res*=(double)a--/(double)b--;13 }14 return res;15 }16 int main()17 {18 char s[120];19 while(~scanf("...
阅读全文
摘要:http://poj.org/problem?id=1286题意:求用3种颜色给n个珠子涂色的方案数。polya定理模板题。 1 #include 2 #include 3 4 long long gcd(long long a,long long b) 5 { 6 return b?gcd(b,a%b):a; 7 } 8 int main() 9 {10 long long n;11 while(~scanf("%lld",&n))12 {13 if (n==-1)14 break;15 if (n...
阅读全文
摘要:http://poj.org/problem?id=3191题意:将一个整型的十进制整数转化为-2进制整数。 1 #include 2 #include 3 #include 4 #include 5 #define LL long long 6 using namespace std; 7 int main() 8 { 9 LL n,s[1010];10 while(~scanf("%lld",&n))11 {12 memset(s,0,sizeof(s));13 if (n==0)14 {15 ...
阅读全文
摘要:http://poj.org/problem?id=1584题意:判断所给的点能不能形成凸包,并判断所给的圆是否在凸包内。改了好几天的一个题,今天才发现是输入顺序弄错了,办过的最脑残的事情。。sad 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 const int N=1002; 8 const double eps=1e-8; 9 double pi=acos(-1.0); 10 int n; 11 struct point 12 { 13 d...
阅读全文
摘要:http://poj.org/problem?id=1113题意:给出一些点的坐标,和一个半径r,求出这些点围成的凸包的周长再加上一个半径为r的圆的周长。 1 #include 2 #include 3 #include 4 const double PI=acos(-1.0); 5 const int N=1002; 6 using namespace std; 7 8 struct Point 9 {10 double x;11 double y;12 Point (double x = 0,double y = 0):x(x),y(y) {}13 ...
阅读全文
摘要:http://poj.org/problem?id=1408题意:给出a1 a2 ... an b1 b2 ... bn c1 c2 ... cnd1 d2 ... dn 这些点,求这些对应点连线形成的小四边形的最大面积。思路:将所有的交点求出,同已知点一起存入二维矩阵中,枚举每个小四边形,求出其面积,找出最大的即可。 1 #include 2 #include 3 #include 4 const double eps=1e-8;//设置精度 5 #define max1(a1,b1) (double)a1-(double)b1>eps?(double)a1:(double...
阅读全文
摘要:http://poj.org/problem?id=2115题意:给出A,B,C和k(k表示变量是在k位机下的无符号整数),判断循环次数,不能终止输出"FOREVER".即转化成 c*x = b-a mod (2^k), 解这个模线性方程的最小正整数解。模板题,代码很短,但是很难理解的样子。。。转载了一些有关的资料。。。 1 #include 2 #define LL long long 3 4 LL Extend_Euclid(LL a,LL b,LL & x,LL & y)//扩展欧几里得 5 { 6 if (!b) 7 { 8 x = 1; 9 ...
阅读全文

浙公网安备 33010602011771号