Basic exercise letter Graphics of the Blue Bridge cup [classic character questions], Blue Bridge graphics

Source: Internet
Author: User

Basic exercise letter Graphics of the Blue Bridge cup [classic character questions], Blue Bridge graphics

 

 

Basic exercise letter graphics time limit: 1.0 s memory limit: 256.0 MB Problem description

Using letters to make up some beautiful images, the following is an example:

ABCDEFG

BABCDEF

CBABCDE

DCBABCD

EDCBABC

This is a graph with 5 rows and 7 columns. Please find out the pattern and output a graph with n rows and m columns.

Enter a row in the input format, which contains two integers n and m, indicating the number of rows in the graph you want to output. The output format outputs n rows, each of which is m characters for your graphics. Sample input 5 7 sample output ABCDEFG
BABCDEF
CBABCDE
DCBABCD
EDCBABC data scale and conventions 1 <= n, m <= 26.

 

 

 

#include<stdio.h>char str[30][30];int main(){int i,j,n,m;while(~scanf("%d%d",&n,&m)){int k,flag=0;for(i=0;i<n;i++){k=i,flag=0;for(j=0;j<m;j++){if(k==0)flag=1;str[i][j]='A'+k;flag?k++:k--;printf("%c",str[i][j]);}printf("\n");}}return 0;}


 

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.