上一页 1 ··· 86 87 88 89 90 91 92 93 94 ··· 182 下一页
摘要: 同1850View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;char st[15];int com(int n, int r){ if (n - r < r) r = n - r; int i, j, s = 1; for (i = 0, j = 1; i < r; ++i) { s *= (n - i); for (; j <= r && s % j == 0 阅读全文
posted @ 2011-08-13 23:19 undefined2024 阅读(150) 评论(0) 推荐(0)
摘要: 组合数学View Code import java.io.*;import java.util.*;import java.math.*;public class Main { static void work(BigInteger n) { BigInteger x = new BigInteger("2"); int i = 0; while (x.subtract(BigInteger.valueOf(1)).compareTo(n)< 0) { x = x.multiply(BigInteger.valueOf(2)); i++; } x = x.divide 阅读全文
posted @ 2011-08-13 23:13 undefined2024 阅读(171) 评论(0) 推荐(0)
摘要: 题意:已知arctan(1/a)=arctan(1/b)+arctan(1/c)给出公式arctan(p)+arctan(q)=arctan[(p+q)/(1-pq)]给出a,求b+c。都是正整数。(保证有解,多解则输出最小解)分析:1/a=(1-(1/b)*(1/c))/((1/b)+(1/c))=(b*c-1)/(b+c).令b+c=y,则有c=y-b,代入上式得到:y=(b*b+1)/(b-a).再令b-a=t,则b=t+a,代入上式有:y=((t+a)*(t+a)+1)/t=t+(a*a+1)/t+2*a.由数学知识可知,在不要求t为整数时,当t=sqrt(a*a+1)时,y有最小值, 阅读全文
posted @ 2011-08-13 21:58 undefined2024 阅读(486) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;#define maxn 15struct Point{ int x, y; Point() {} Point(int xx, int yy): x(xx), y(yy) {}};int n, tot;char map[maxn][maxn];char ans[maxn * maxn];v 阅读全文
posted @ 2011-08-13 19:15 undefined2024 阅读(193) 评论(0) 推荐(0)
摘要: 向量运算简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;struct Point{ int x, y, z;} pos, head, dir;int n;void up(){ dir.x = -dir.x; dir.y = -dir.y; dir.z = -dir.z; swap(dir, head);}void down(){ head.x = -head.x; head.y = -h 阅读全文
posted @ 2011-08-13 18:51 undefined2024 阅读(312) 评论(0) 推荐(0)
上一页 1 ··· 86 87 88 89 90 91 92 93 94 ··· 182 下一页