本文主要是介绍Codeforces Div. 2 #259-A. Little Pony and Crystal Mine,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
//AC代码
#include<iostream>
#include<queue>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iomanip>
#include<map>
#include<cstdlib>
#include<cmath>
#include<vector>
#define LL long long
#define IT __int64
#define zero(x) fabs(x)<eps
#define mm(a,b) memset(a,b,sizeof(a))
const int INF=0x7fffffff;
const double inf=1e8;
const double eps=1e-10;
const double PI=acos(-1.0);
const int Max=20001;
using namespace std;
int sign(double x)
{
return (x>eps)-(x<-eps);
}
int main()
{
int n,m,i,j;
while(cin>>n)
{
for(i=1,m=1;i<=n/2;i++,m+=2)
{
for(int k=1;k<=(n-m)/2;k++)
cout<<"*";
for(j=1;j<=m;j++)
{
cout<<"D";
}
for(int t=(n-m)/2;t>=1;t--)
cout<<"*";
cout<<endl;
}
for(i=1;i<=n;i++)
cout<<"D";
cout<<endl;
for(i=1,m=n-2;i<=n/2;i++,m-=2)
{
for(int k=(n-m)/2;k>=1;k--)
cout<<"*";
for(j=1;j<=m;j++)
{
cout<<"D";
}
for(int t=(n-m)/2;t>=1;t--)
cout<<"*";
cout<<endl;
}
}
return 0;
}
这篇关于Codeforces Div. 2 #259-A. Little Pony and Crystal Mine的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!