Uva1605-building for UN (constructor)

Source: Internet
Author: User

The result of this question is very good, and the thinking ability is examined. On the second layer, each layer has n * n grids. the first layer of line I is placed in country I, and the second layer of column J is placed in country J.

Note that in ASCII, A to Z is in front of A to Z (the numbers are small), and they are not in the two groups. Therefore, the char C (int I) function is required.

#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<map>#include<set>#include<vector>#include<algorithm>#include<stack>#include<queue>#include<cctype>#include<sstream>using namespace std;#define INF 1000000000#define eps 1e-8#define pii pair<int,int>#define LL long long int#define maxn 100010int n;char c(int i){    if(i<26) return ‘A‘+i;    else return ‘a‘+i-26;}int main(){    //freopen("in8.txt","r",stdin);    //freopen("out.txt","w",stdout);    int t=0;    while(~scanf("%d",&n))    {        if(t)        {            printf("\n");        }        else t=1;        printf("2 %d %d\n",n,n);        for(int i=0;i<n;i++)        {            for(int j=0;j<n;j++)            {                printf("%c",c(i));            }            printf("\n");        }        printf("\n");        for(int i=0;i<n;i++)        {            for(int j=0;j<n;j++)            {                printf("%c",c(j));            }            printf("\n");        }    }    //fclose(stdin);    //fclose(stdout);    return 0;}

 

Uva1605-building for UN (constructor)

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.