| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:发一个ws代码In Reply To:发一个ws代码 Posted by:angela_channg at 2011-03-23 21:52:59 > #define P 3.1415926535898
> #define F(x) x*x
> main(){int i,j,n,m;double s,t;while (scanf("%d%d",&n,&m),n){if (n*m%2){puts("0");continue;}t=pow(2,n*m/2);s=1;n++;m++;for (i=1;i<n;i++)for (j=1;j<m;j++)s*=F(cos(i*P/n))+F(cos(j*P/m));s=pow(s,.25);printf("%.0lf\n",s*t);}}
ORZ,您 的 算法 貌似 是O(n*m)的 ,相当 NB,能解释一下 么 ?谢谢
好高端的 代码, 一定是用了什么 定理。。。。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator