UVa1605,Building for UN

我比较好奇的是uva后台是怎么测这题的

没什么可说的,那些不想敲但还是想直接交这题的直接copy过去吧

#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <algorithm>
#define maxn 100000
using namespace std;
int main()
{
    int n;
    while (cin>>n){
        cout<<"2";
        cout<<" "<<n<<" "<<n<<endl;
        for (int i=0;i<n;i++){
            for (int j=0;j<n;j++)
                if (i<26) cout<<(char)(i+‘a‘);
                    else cout<<(char)(i+‘A‘-26);
            cout<<endl;
        }
        cout<<endl;
        for (int i=0;i<n;i++){
            for (int j=0;j<n;j++)
                if (j<26) cout<<(char)(j+‘a‘);
                    else cout<<(char)(j+‘A‘-26);
            cout<<endl;
        }
        cout<<endl;
    }
}

UVa1605,Building for UN

时间: 2024-10-12 05:01:32

UVa1605,Building for UN的相关文章

uva1605 - Building for UN(构造法)

这道题构造出的结果很妙,考察思维能力.就两层,每层都n*n个格子,第一层第i行都放国家i,第二层第j列都放国家j. 需要注意的是ASCII中A至Z在a至z的前面(数字小),而且它们两组不挨着.所以需要char c(int i)这个函数. #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<map>

UVa1605 - Building for UN(构造)

题目大意:有n个国家,要求你设计一栋楼并为这n个国家划分房间,要求国家的房间必须连通,且每两个国家之间必须有一间房间是相邻的 解题思路:刚开始以为很复杂,被样例给误导了,加上题意没审清,以为房间相邻必须在同一层...就这样被坑了好久 只需要设计两层就可以了,每个国家占第一层的每一行,占第二层的每一列,这样的话就既满足联通又相邻了 #include<cstdio> #include<cstring> #define maxn 60 char ans[maxn]="ABCDE

UVa1605 Building for UN (构造法)

链接:http://vjudge.net/problem/51167 分析: 2 2 2 AB CC zz zz 2 8 8aaaaaaaabbbbbbbbccccccccddddddddeeeeeeeeffffffffgggggggghhhhhhhh abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh 1 #include <cstdio> 2 3 int n; 4 5 int main() { 6 while (

UVA-1605 Building for UN (构造)

题目大意:n个国家的人要在一栋大厦里办公,要求任意两个国家的办公室要相邻(同层同边或邻层同面),设计一个满足要求的方案. 题目分析:题目限制较少,任意构造出一个解即可. 代码如下: # include<iostream> # include<cstdio> # include<cstring> # include<algorithm> using namespace std; int main() { int n,flag=0; while(~scanf(&

(转载)解决AndroidStudio导入项目在 Building gradle project info 一直卡住

源地址http://blog.csdn.net/yyh352091626/article/details/51490976 Android Studio导入项目的时候,一直卡在Building gradle project info这一步,主要原因还是因为被墙的结果.gradle官网虽然可以访问,但是速度连蜗牛都赶不上... 解决办法主要有两种,一是直接下载gradle离线包,二是修改项目的gradle-wrapper.properties里的gradle版本为自己电脑已有的版本. 离线包下载导

ZOJ 3820 Building Fire Stations

Building Fire Stations Time Limit: 5000ms Memory Limit: 131072KB This problem will be judged on ZJU. Original ID: 382064-bit integer IO format: %lld      Java class name: Main Special Judge Marjar University is a beautiful and peaceful place. There a

hdu 5033 Building(斜率优化)

Building Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1237    Accepted Submission(s): 350 Special Judge Problem Description Once upon a time Matt went to a small town. The town was so sma

ZOJ 1718 POJ 2031 Building a Space Station 修建空间站 最小生成树 Kruskal算法

题目链接:ZOJ 1718 POJ 2031 Building a Space Station 修建空间站 Building a Space Station Time Limit: 2 Seconds      Memory Limit: 65536 KB You are a member of the space station engineering team, and are assigned a task in the construction process of the statio

Building Block HDU - 2818 (并查集)

Building Block HDU - 2818 题意:搬砖...每一次可以把a所在的那一堆放到b所在的那一堆上面,问第x号砖下面有几块砖. 记录一下到根节点的距离(dw),以及根节点上方有几块砖(up). 1 #include <bits/stdc++.h> 2 using namespace std; 3 4 const int maxn=30010; 5 int f[maxn],up[maxn],dw[maxn]; 6 7 int gf(int x){ 8 if(x==f[x]){ 9