3337 Little Pony and Crystal Mine 题解

原创 2018年04月16日 12:34:39

由题意得:

1.输入数字n,即输出图案的层数

2.先输出“*”,再输出“D”

3.图案分为上下两段对称图形

4.上端“*”数量与递减,而“D”数量递增,每层符号数量与层数有关

5.代码如下:

#include<stdio.h>

int main()
{
    int n,m,i,j;
    scanf("%d",&n);
    m=n/2+1;
    for(i=1;i<=m;i++)
    {
        for(j=1;j<=m-i;j++)
            printf("*");
        for(j=1;j<=2*i-1;j++)
            printf("D");
        for(j=1;j<=m-i;j++)
            printf("*");
        printf("\n");
    }
    for(i=1;i<=n-m;i++)
    {
        for(j=1;j<=i;j++)
            printf("*");
        for(j=1;j<=n-2*i;j++)
            printf("D");
        for(j=1;j<=i;j++)
            printf("*");
        printf("\n");
    }
    return 0;
}

codeforces 454A Little Pony and Crystal Mine

点击打开链接 A. Little Pony and Crystal Mine time limit per test 1 second memory limit p...
  • zhang__liuchen
  • zhang__liuchen
  • 2017-09-17 16:00:10
  • 174

Codeforces 454A. Little Pony and Crystal Mine

time limit per test 1 second memory limit per test 256 megabytes input standard input output ...
  • u013810072
  • u013810072
  • 2014-08-02 12:14:17
  • 607

Codeforces Round #259 (Div. 2) problemsA Little Pony and Crystal Mine

#include #include #include #include #include #include #include #include #include #include ...
  • zyjhtutu
  • zyjhtutu
  • 2014-08-02 01:39:46
  • 335

Codeforces 454A Little Pony and Crystal Mine(水题)

题目链接:Codeforces 454A Little Pony and Crystal Mine 题目大意:给定n,要求输出指定图形。 解题思路:水题。 #include #incl...
  • u011328934
  • u011328934
  • 2014-08-02 22:25:02
  • 893

A. Little Pony and Crystal Mine

time limit per test 1 second memory limit per test 256 megabytes input standard input ...
  • jj12345jj198999
  • jj12345jj198999
  • 2014-08-04 07:06:57
  • 672

Codeforces 453B Little Pony and Harmony Chest(状压)

题目链接:Codeforces 453B Little Pony and Harmony Chest 题目大意:给定一个序列a, 求一序列b,要求∑|ai−bi|最小。并且b中任意两数的最大公约...
  • u011328934
  • u011328934
  • 2014-08-02 22:39:02
  • 1474

C. Little Pony and Expected Maximum

这道题目的大意是,一个骰子有6个面分别写着1,2,3,4,5,6出现的该哦率
  • hhq420684
  • hhq420684
  • 2014-08-17 23:46:09
  • 548

CF 453A(Little Pony and Expected Maximum-若干次掷骰,最大那次期望-推公式)

A. Little Pony and Expected Maximum time limit per test 1 second memory limit per test 256 megab...
  • nike0good
  • nike0good
  • 2014-08-02 16:35:14
  • 1331

Codeforces 453C Little Pony and Summer Sun Celebration(构造)

题目链接:Codeforces 453 Little Pony and Summer Sun Celebration 题目大意:n个节点,m条边,然后m行给定边,最后一行表示每个节点需要进过的次...
  • u011328934
  • u011328934
  • 2014-08-02 22:43:31
  • 1190

codeforce 453B - Little Pony and Harmony Chest

题目如下: B. Little Pony and Harmony Chest time limit per test 4 seconds memor...
  • wangyuquanliuli
  • wangyuquanliuli
  • 2014-08-11 15:32:23
  • 1122
收藏助手
不良信息举报
您举报文章:3337 Little Pony and Crystal Mine 题解
举报原因:
原因补充:

(最多只允许输入30个字)