就我不坑2 nyoj(简单模拟)

就我不坑2

时间限制:1000 ms  |  内存限制:65535 KB

难度:0

描述
要说学长谁善良,ACM找LY。 没错,以上面那句话我已经不能再同意了。 问题来了:画 8 。

输入
输入的第一行为一个整数N,表示后面有N组数据.

每组数据中有一个字符和一个整数,字符表示画笔,整数(>=5)表示高度.

输出
画横线总是一个字符粗,竖线随着总高度每增长6而增加1个字符宽.当总高度从5增加到6时,其竖线宽度从1增长到2.下圈高度不小于上圈高度,但应尽量接近上圈高度,且下圈的内径呈正方形.

每画一个"8"应空一行,即两组之间有一条华丽的分割线

样例输入
2
A 7
B 8
样例输出
  AA
AA  AA
AA  AA
  AA
AA  AA
AA  AA
  AA
<---华丽的分割线--->
  BBB
BB   BB
BB   BB
  BBB
BB   BB
BB   BB
BB   BB
  BBB
来源

上传者

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
char c;
int n;
int main()
{
    int t;
    cin>>t;
    for(int i=0;i<t;i++)
    {
        cin>>c>>n;
        //cout<<c<<endl;
        int a=n/6+1;
        int b=(n-3)/2;
        if((n-3)%2!=0)
            b++;
        //cout<<a<<" "<<b<<endl;
        int j,k;
        for(j=1;j<=n;j++)
        {
            if(j==1||j==n||j==n-b-1)
            {
                for(k=1;k<=a+b;k++)
                {
                    if(k<=a)
                        cout<<" ";
                    else
                        cout<<c;
                }
            }
            else
            {
                for(k=1;k<=2*a+b;k++)
                {
                    if(k>a&&k<=a+b)
                        cout<<" ";
                    else
                        cout<<c;
                }
            }
            cout<<endl;
        }
        if(i!=t-1)
            cout<<"<---华丽的分割线--->"<<endl;
    }
}
时间: 2024-08-01 22:40:36

就我不坑2 nyoj(简单模拟)的相关文章

HDU-1034-Candy Sharing Game(C++ &amp;&amp; 简单模拟)

Candy Sharing Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3703    Accepted Submission(s): 2311 Problem Description A number of students sit in a circle facing their teacher in the cent

Jquery源码分析与简单模拟实现

前言 最近学习了一下jQuery源码,顺便总结一下,版本:v2.0.3 主要是通过简单模拟实现jQuery的封装/调用.选择器.类级别扩展等.加深对js/Jquery的理解. 正文 先来说问题: 1.jQuery为什么能使用$的方式调用,$是什么.$()又是什么.链式调用如何实现的 2.jQuery的类级别的扩展内部是怎样实现的,方法级别的扩展有是怎样实现的,$.fn又是什么 3.jQuery选择器是如何执行的,又是如何将结果包装并返回的 带着这些问题,我们进行jquery的模拟实现,文章下方有

Linux 内核 链表 的简单模拟(2)

接上一篇Linux 内核 链表 的简单模拟(1) 第五章:Linux内核链表的遍历 /** * list_for_each - iterate over a list * @pos: the &struct list_head to use as a loop cursor. * @head: the head for your list. */ #define list_for_each(pos, head) for (pos = (head)->next; pos != (head);

HDU 1048 What Is Your Grade? (简单模拟)

 What Is Your Grade? Problem Description "Point, point, life of student!" This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used in

JavaWeb学习总结(四十九)——简单模拟Sping MVC

在Spring MVC中,将一个普通的java类标注上Controller注解之后,再将类中的方法使用RequestMapping注解标注,那么这个普通的java类就够处理Web请求,示例代码如下: 1 /** 2 * 使用Controller注解标注LoginUI类 3 */ 4 @Controller 5 public class LoginUI { 6 7 //使用RequestMapping注解指明forward1方法的访问路径 8 @RequestMapping("LoginUI/Lo

简单模拟Hibernate的主要功能实现

在学习期间接触到Hibernate框架,这是一款非常优秀的O/R映射框架,大大简化了在开发web项目过程中对数据库的操作.这里就简单模拟其底层的实现. /*******代码部分,及其主要注解**********************/1.实体类User:public class User {    private int id;    private String username;    private String password; public int getId() {       

ZOJ 3804 YY&#39;s Minions (简单模拟)

1 /* 2 题意:一个矩阵中有 n*m个宠物,每一个宠物都有一个状态, 1醒着的,0睡着的 3 X离开的!如果这个宠物(醒着的)的周围醒着的个数>3 || <2它就会睡着, 4 如果这个宠物(睡着的)的周围醒着的个数==3就会醒来! 5 每一分钟都会有变换一个状态! 6 其中会有些宠物会在给定的时间内离开! 7 */ 8 #include<iostream> 9 #include<cstring> 10 #include<cstdio> 11 #inclu

Codeforces Round #259 (Div. 2) (简单模拟实现题)

题目链接:http://codeforces.com/problemset/problem/454/A A. Little Pony and Crystal Mine time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Twilight Sparkle once got a crystal from the Crystal Mine

HDU 4891 简单模拟

The Great Pan Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1035    Accepted Submission(s): 355 Problem Description As a programming contest addict, Waybl is always happy to take part in vario

一个简单的Webservice的demo,简单模拟服务

前段时间一直在学习WCF,匆匆忙忙的把<WCF全面解析>和<WCF服务编程>看了一遍,好多东西都不是很懂,又听了一下WCF分布式开发的网络教程,算是马马虎虎的明白点了.回顾了一下Webservice,将二者进行比较学习.考虑到以后的发展,当时决定学习WCF,希望自己在不久的将来能将WCF学的稍微精通点吧.这几天又将Webservice看了一遍,回想当时学习Webservice处处碰到坑,由于没人指点,连最基本地点发布都折腾好长时间,只能一点一点的填坑跳坑.这几天闲了,想写一个简单的