上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 17 下一页

2011年5月6日

ACM.2234 Matches Game http://acm.pku.cn/JudgeOnline/problem?id=2234

摘要: #include <iostream>using namespace std;int main (){ int n=0; while (cin>>n) { int m=0,l=0; for (int i=0;i<n;i++) { cin >>l; m^=l; } cout <<(m?"Yes":"No")<<endl; } return 0;} 阅读全文

posted @ 2011-05-06 19:47 _Clarence 阅读(142) 评论(0) 推荐(0) 编辑

无穷下降法·数的按位异或与随机博弈(1)

摘要: 无穷下降法是著名的业余数学家费马提出的,也正是因为这个方法他才敢在书页边上声称自己已经找到了一个巧妙的方法证明费马猜想(x^n+y^n=z^n在n>2时没有正整数解,x^y表示x的y次方)。意外的是这个方法并没有想象中的那样神奇,它仅仅可以证明对于某些特殊的n才能成立(譬如说4),思路是:假设存在一组解(x0,y0,z0),那么由这一组解可以得到一组新的解(x1,y1,z1),并且满足z0>z1,这个过程可以重复进行,然而这是不可能的,这样必然使得zi“下降”到0,所以原方程没有正整数解。这个方法应该和数学归纳法齐名的,然而它太类似反证法了:上述证明可以写成假设一组解(x0,y0, 阅读全文

posted @ 2011-05-06 19:47 _Clarence 阅读(834) 评论(0) 推荐(0) 编辑

ACM 2348 Euclid's Game http://acm.pku.cn/JudgeOnline/problem?id=2348

摘要: 方法:若整除先者胜,若不然,GCD,看每次的商是否为1,若为1,i++,继续,判断他的奇偶性;证明,若整除,显然,不然,若遇到m/n>1时,其中1、2的时候包含所有胜负,则做该判断的时候的人必胜我最后更新的代码如下:#include <iostream>using namespace std;int main (){int n=0,m=0;while (cin>>m>>n){ if(m==0&&n==0) break; int i=0; int temp=0; if (m<n) { temp=m; m=n; n=temp; } i 阅读全文

posted @ 2011-05-06 19:46 _Clarence 阅读(147) 评论(0) 推荐(0) 编辑

ACM 2083 Game of Connections http://acm.pku.cn/JudgeOnline/problem?id=2084

摘要: 很郁闷的一道题,看通过率本以为很简单,其实就是个数学题,求Catalan数,关于Catalan数,现在做下说明:令h(1)=1,catalan数满足递归式:h(n)= h(1)*h(n-1) + h(2)*h(n-2) + ... + h(n-1)h(1) (其中n>=2)该递推关系的解为:h(n+1)=c(2n-2,n-1)/n (n=1,2,3,...)我并不关心其解是怎么求出来的,我只想知道怎么用catalan数分析问题。我总结了一下,最典型的三类应用:(实质上却都一样,无非是递归等式的应用,就看你能不能分解问题写出递归式了)1.括号化问题。矩阵链乘: P=a1×a2&# 阅读全文

posted @ 2011-05-06 19:44 _Clarence 阅读(270) 评论(0) 推荐(0) 编辑

Bode Plot pku ACM http://acm.pku.cn/JudgeOnline/problem?id=1045

摘要: 今天做了一件很缺德的事,用别人给出的公式做了这个1045,一道纯数学公式推导居然还看了DISCUSS,真的不能原谅自己:公式推导:V2=iR=CR d/dt(Vs*cos(wt)-Vr*cos(wt+b))=Vrcos(wt+b) CRw(sin(wt+b)-sin(wt))=Vr*cos(wt+b) 令t=0化简得: tan(b)=1/(CRw)-------------(1) 令wt+b=0化简得:Vr=CRwVs*sin(b)------------(2) 由(1),(2)得: Vr=CRwVs/sqrt(1+(CRw)^2))#include <iostream>#incl 阅读全文

posted @ 2011-05-06 19:43 _Clarence 阅读(204) 评论(0) 推荐(0) 编辑

Deck ACM pku http://acm.pku.cn/JudgeOnline/problem?id=1607

摘要: 哈哈,这道题我玩得最阴毒,你出题毒我会更毒,让你知道什么叫道高一尺,魔高一丈!不就是要我控制格式嘛,我连你的空格我都给复制下来,看你还敢不敢说我Presentation Error!其题目大意就是要我们计算超出边缘的总长度,没有难度,主要注意小数点位数和它要求的格式就欧了!#include <iostream>#include <iomanip>using namespace std;int main (){int n;cout<<"Cards Overhang"<<endl;while (scanf("%d&quo 阅读全文

posted @ 2011-05-06 19:42 _Clarence 阅读(178) 评论(0) 推荐(0) 编辑

Yeehaa! ACM pku http://acm.pku.cn/JudgeOnline/problem?id=1799

摘要: 面队1799这样的题只有一个字可以描述它:水!我的代码如下:#include <iostream>#include <cmath>using namespace std;const double p=3.1415926535897932384626;int main (){ int m;cin >>m;for (int i=1;i<=m;i++){ double R=0; int n=0; cout <<"Scenario #"<<i<<":"<<endl; cin 阅读全文

posted @ 2011-05-06 19:41 _Clarence 阅读(196) 评论(0) 推荐(0) 编辑

Hansel and Grethel ACM pku http://acm.pku.cn/JudgeOnline/problem?id=1254

摘要: 1254是一道非常简单的关于平面直线相交问题的计算,只要注意一点:斜率并不是所给出的指南针上的度数而应该是(90-degree);解决了此问题后所有的问题都迎刃而解了我的代码如下:#include <iostream>#include <cmath>using namespace std;const double PI=3.1415926535897932384626;int main (){int n;cin >>n;for (int i=1;i<=n;i++){ double x0,x1,y0,y1,degree0,degree1,X=0,Y=0; 阅读全文

posted @ 2011-05-06 19:40 _Clarence 阅读(137) 评论(0) 推荐(0) 编辑

Intersecting Lines ACM PKU http://acm.pku.cn/JudgeOnline/problem?id=1269

摘要: 自己的问题自己解决了,凡事还得靠自己啊!#include <iostream>using namespace std;int main (){int n;cin >>n;double x1,x2,x3,x4,y1,y2,y3,y4;double a[10][8];for (int i=0;i<n;i++) for (int k=0;k<8;k++){ cin>>a[i][k];}cout<<"INTERSECTING LINES OUTPUT"<<endl;for (int m=0;m<n;m++ 阅读全文

posted @ 2011-05-06 19:40 _Clarence 阅读(106) 评论(0) 推荐(0) 编辑

Rotten Ropes PKU ACM http://acm.pku.cn/JudgeOnline/problem?id=2291

摘要: 基础题,没有什么好说的;我的代码如下:#include <iostream>#include <algorithm>using namespace std;int main (){int t;int a[1000]={0};cin >>t;for (int i=0;i<t;i++){ int n,sum=0,sun=0; cin >>n; int j; for (j=0;j<n;j++) { cin >>a[j]; } sort (a,a+n); for (j;j>=0;j--) { sum=a[n-j]*j; if 阅读全文

posted @ 2011-05-06 19:39 _Clarence 阅读(109) 评论(0) 推荐(0) 编辑

上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 17 下一页

导航