php网站 上传,西部数码备案域名购买,wordpress 图书模板,做视频网站审核编辑有假么https://www.luogu.org/problemnew/show/P1498 题目描述 自从到了南蛮之地#xff0c;孔明不仅把孟获收拾的服服帖帖#xff0c;而且还发现了不少少数民族的智慧#xff0c;他发现少数民族的图腾往往有着一种分形的效果#xff0c;在得到了酋长的传授后#xff0c;孔明掌握…https://www.luogu.org/problemnew/show/P1498 题目描述 自从到了南蛮之地孔明不仅把孟获收拾的服服帖帖而且还发现了不少少数民族的智慧他发现少数民族的图腾往往有着一种分形的效果在得到了酋长的传授后孔明掌握了不少绘图技术但唯独不会画他们的图腾于是他找上了你的爷爷的爷爷的爷爷的爷爷……帮忙作为一个好孙子的孙子的孙子的孙子……你能做到吗 输入输出格式 输入格式 每个数据一个数字表示图腾的大小此大小非彼大小 n10 输出格式 这个大小的图腾 输入输出样例 输入样例#1 2 输出样例#1 /\/__\/\ /\
/__\/__\输入样例#2 3 输出样例#2 /\/__\/\ /\/__\/__\/\ /\/__\ /__\/\ /\ /\ /\
/__\/__\/__\/__\ 1 #includeiostream2 #includecstdio3 #includecstring4 #includealgorithm5 using namespace std;6 /*7 /\8 /__\9 /\ /\
10 /__\/__\
11 */
12 int n;
13 char ch[2501][2501];
14 int mypow(int x,int y)
15 {
16 int ans1;
17 while(y)
18 {
19 if(y1)ans*x;
20 x*x;
21 y/2;
22 }
23 return ans;
24 }
25 void dfs(int q,int w,int e,int t)//q控制图形递归的边界 w e 控制横纵坐标 t控制深度【用于控制w e的大小,递归分形的精髓,一定要由n分解成n-1,然后观察w e的大小变化】
26 {
27 // cout w e endl;
28 if(q1)
29 {
30 ch[w][e]/;
31 ch[w][e1]\\;
32 ch[w1][e-1]/;
33 ch[w1][e2]\\;
34 ch[w1][e]_;
35 ch[w1][e1]_;
36 return;
37 }
38 dfs(q/2,w,e,t*2);
39 dfs(q/2,wt,e-t,t*2);
40 dfs(q/2,wt,et,t*2);
41 }
42 int main()
43 {
44 scanf(%d,n);
45 for(int i 0 ; i 2501 ; i)
46 {
47 int j;
48 for( j 0 ; j 2501 ; j)
49 {
50 ch[i][j] ;
51 }
52 }
53 dfs(mypow(2,n-1),0,mypow(2,n)-1,2);
54 for(int i 0 ; i mypow(2,n) ; i)
55 {
56 for(int j 2500 ; j 0 ; j--)
57 {
58 if(ch[i][j]\\)
59 {
60 ch[i][j1]\0;
61 break;
62 }
63 }
64 }
65 for(int i 0 ; i mypow(2,n) ; i)
66 {
67 printf(%s\n,ch[i]);
68 }
69 return 0;
70 } 转载于:https://www.cnblogs.com/MekakuCityActor/p/8989025.html