网站建设重庆公司,win服务器对于wordpress的支持,wordpress 后台添加菜单,设计wordpress主题下载地址【题目描述】 【题目链接】 http://noi.openjudge.cn/ch0204/8463/ 【算法】 为求等级N下的点的坐标可由几何关系找到其与等级N-1下对应点的关系#xff0c;然后递归直至所有点的祖先#xff08;等级0#xff09;即可计算出坐标。 【代码】 1 #include bits/stdc.h2…【题目描述】 【题目链接】 http://noi.openjudge.cn/ch0204/8463/ 【算法】 为求等级N下的点的坐标可由几何关系找到其与等级N-1下对应点的关系然后递归直至所有点的祖先等级0即可计算出坐标。 【代码】 1 #include bits/stdc.h2 using namespace std;3 typedef long long ll;4 int t;5 ll n,s,d;6 pairll,ll calc(int state,ll num)7 {8 if(!state) return make_pair(1,1);9 ll side1(state-1),sumside*side;
10 ll recnum/sum,pre_numnum%sum;
11 pairll,ll prcalc(state-1,pre_num);
12 switch(rec) {
13 case 0: swap(pr.first,pr.second); break;
14 case 1: pr.firstside; break;
15 case 2: pr.firstside,pr.secondside; break;
16 case 3: swap(pr.first,pr.second),pr.firstside-pr.first1,pr.secondside*2-pr.second1;
17 }
18 return pr;
19 }
20 int main()
21 {
22 scanf(%d,t);
23 while(t--) {
24 scanf(%d%lld%lld,n,s,d);
25 pairll,ll p1calc(n,s-1);
26 pairll,ll p2calc(n,d-1);
27 ll dxp1.first-p2.first,dyp1.second-p2.second;
28 printf(%.0f\n,sqrt(dx*dx*1.0dy*dy*1.0)*10);
29 }
30 return 0;
31 } 【《算法竞赛进阶指南》大佬代码侵删】 1 /*2 Author: Yufei Du3 本程序仅供参考4 */5 #include cmath6 #include cstdio7 #include cstring8 #include cstdlib9 #include algorithm
10 using namespace std;
11
12 pair__int64, __int64 recur (int stage, __int64 id)
13 {
14 if (stage 0) return make_pair(0, 0);
15 __int64 max 1 (stage - 1), s max * max;
16 __int64 z id / s, idsp id % s;
17 pair__int64, __int64 psp recur(stage - 1, idsp);
18 if (z 0 || z 3) swap(psp.first, psp.second);
19 if (z 3)
20 {
21 psp.first max - psp.first - 1;
22 psp.second max - psp.second - 1;
23 }
24 if (z 1 || z 2) psp.first max;
25 if (z 3 || z 2) psp.second max;
26 return psp;
27 }
28 int main ()
29 {
30
31 int kase; for (scanf(%d, kase); kase; --kase)
32 {
33 int n; __int64 h, o;
34 scanf(%d %I64d %I64d, n, h, o);
35 pair__int64, __int64 hp recur(n, h - 1);
36 pair__int64, __int64 op recur(n, o - 1);
37 __int64 dx abs(hp.first - op.first), dy abs(hp.second - op.second);
38 printf(%.0f\n, (double)sqrt(dx * dx dy * dy) * 10);
39 }
40 return 0;
41 } 转载于:https://www.cnblogs.com/Willendless/p/9361879.html