摘要: 计算几何的题目,很简单;自己随手敲了个,纪念下! 1 #include 2 #include 3 using namespace std; 4 5 struct point 6 { 7 double x,y; 8 point(double x=0,double y=0):x(x),y(y) { } 9 } a,b,c,d;10 11 point midd(point a,point b)12 {13 return point((a.x+b.x)/2.0,(a.y+b.y)/2.0);14 }15 point operator + (point a,point b)16... 阅读全文
posted @ 2013-10-01 17:52 Yours1103 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 也是一个数学题;主要用到的是排列组合的知识,推推公式就行了,挺简单的;唯一要注意的是A(0,0)=1;在这个上面WA了几次,= =代码: 1 #include 2 #define ULL unsigned long long 3 #define maxn 21 4 using namespace std; 5 6 ULL C[maxn+5][maxn+5];//范围可向上变更 7 ULL A[maxn]; 8 void builtC(){ 9 memset(C,0,sizeof(C));10 C[0][0]=1;11 for(int i=1;i<=maxn;i++)... 阅读全文
posted @ 2013-10-01 16:29 Yours1103 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 一个简单的规律题,每一列都是一个等差数列;代码: 1 #include 2 #define ll long long 3 using namespace std; 4 5 int main() 6 { 7 int p; 8 int ca=1; 9 scanf("%d",&p);10 while(p--)11 {12 int a,b;13 scanf("%d",&ca);14 scanf("%d%d",&a,&b);15 ll ans=(a-b)*b+1;16 printf... 阅读全文
posted @ 2013-10-01 16:24 Yours1103 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 一个组合游戏题。解答: 从后面往前面推,首先n-1是必胜位,然后前面的k位是必败位,如此循环下去。所以题目就容易了!代码: 1 #include 2 using namespace std; 3 int main() 4 { 5 int n,k; 6 while(scanf("%d%d",&n,&k)&&(n+k)) 7 { 8 int x=(n)%(k+1); 9 if(x&1)puts("Tang");10 else puts("Jiang");11 }12 return 0;13 }Vie 阅读全文
posted @ 2013-10-01 16:17 Yours1103 阅读(106) 评论(0) 推荐(0) 编辑