你猜我猜不猜你猜不猜

Time Limit: 2000ms   Memory limit: 65536K  有疑问?点这里^_^

题目描述

In the past 39th annual ACM international collegiate programming contest in Beijing station in Asia that Triple_S sent by our school team won the SDUT in Reginal bronze 11. At the same time,the team’s name is cray which is to let the host after reading the wrong three times, still missed a word to read. But  zhuhu gave a high evaluation to the team.
 
As the creator of this team, I want to say is,  in fact I was reminded of a game which is named ”ni cai wo cai bu cai ni cai bu cai wo cai bu cai”, may be the teacher didn\'t remember it. The name is just due to a conversation with a girl, so the origin is simple.
 
A:Why are you so diao?
 
B:Ni cai.
 
A:Ni cai wo cai bu cai.
 
B:Ni cai wo cai bu cai ni cai bu cai.
 
A:Ni cai wo cai bu cai ni cai bu cai wo cai bu cai.
 
Then do you know the content of their first conversation X?OK,in order to avoid the mle , RE professionals will popularize related knowledge for you . Please seize this chance!
 
The operation is very simple, only need to output the first letter of each word .For example , You can substitute N for Ni . Next, I\'ll demonstrate specific operation steps

输入

 For everytestcase, each line of input a Character , said A or B.

Then enter an Integer X (0<=X<=10^5), said the figure’s the first  X words.

输出

 Output the words.

示例输入

A 2
A 3
B 3

示例输出

Ncwcbc
Ncwcbcncbcwcbc
Ncwcbcncbcwcbcncbc 代码:1Y
#include <iostream>
#include <string>
#include <algorithm> using namespace std; int main()
{
char ch;
int n;
int i, j; while(cin>>ch>>n)
{
if(ch=='A')
{
if(n==1)
{
cout<<"Waysd\n";
continue;
}
else if(n==2)
{
cout<<"Ncwcbc\n";
continue;
}
else
{
cout<<"Ncwcbc";
for(i=0; i<n-2; i++)
{
cout<<"ncbcwcbc";
}
cout<<endl;
continue;
}
}
else if(ch=='B')
{
if(n==1)
{
cout<<"Nc\n";
continue;
}
else if(n==2)
{
cout<<"Ncwcbcncbc\n";
continue;
}
else
{
cout<<"Ncwcbcncbc";
for(j=0; j<n-2; j++)
{
cout<<"wcbcncbc";
}
cout<<endl;
continue;
}
}
}
return 0;
}

SDUT 3035 你猜我猜不猜你猜不猜(字符串 规律性)的更多相关文章

  1. {python}完成完整的温度转换程序 猜数字游戏(猜价格,猜年龄等) 解析身份证号、学号不同片段的含义

    完成完整的温度转换程序 while True: a = int(input("如果是华氏转摄氏,请按1\n,如果是摄氏转华氏,请按2\n")) if a==1: h = float ...

  2. 猜随机数(控制台输入,字符串转int)

    package com.hanqi.suijishu; import java .util.Random; // main方法类 专门用来运行方法 public class Main { public ...

  3. C语言猜数字游戏

    猜数字游戏,各式各样的实现方式,我这边提供一个实现方式,希望可以帮到新手. 老程序猿就不要看了,黑呵呵 源代码1 include stdio.h include stdlib.h include ti ...

  4. 不一样的猜数字游戏 — leetcode 375. Guess Number Higher or Lower II

    好久没切 leetcode 的题了,静下心来切了道,这道题比较有意思,和大家分享下. 我把它叫做 "不一样的猜数字游戏",我们先来看看传统的猜数字游戏,Guess Number H ...

  5. pyqt5猜数游戏

    电脑随机生成4个互不相等的数,你猜. 1:你猜的数和正确答案相比,位置正确的个数 2:你猜的数虽然在正确答案中,但位置不对,它的个数. 代码如下: #!/usr/bin/env python # -* ...

  6. while循环小练习-猜答案

    条件 1.每个用户只能猜10次产品的价格2.每次猜玩价格,提示用户价格是多了还是少了或者对了3.如果用户才对则终止程序执行 break! i = 0 #设置一个次数变量 price = 38 #设置一 ...

  7. 详解 leetcode 猜数字大小 II

    375. 猜数字大小 II 原题链接375. 猜数字大小 II 题目下方给出了几个提示: 游戏的最佳策略是减少最大损失,这引出了 Minimax 算法,见这里,和这里 使用较小的数开始(例如3),看看 ...

  8. python猜数字(多种实现方法)

    设定一个理想数字比如:66,让用户输入数字,如果比66⼤,则显示猜测的结果⼤了:如果比66⼩,则显示猜测的结果小了;只有等于66,显示猜测结果 第一种方式(最简单的方式实现) n = 66 # 理想数 ...

  9. java实现登录的验证码和猜数字游戏_图形化界面

    实验任务四 1,出现设计思想 (1)先定义文本框.密码框和验证码框的组件 (2)定义面板和按钮的个数 (3)定义公有的虚构方法,通过对象实例化来调用 (4)利用Random类来实现生成0-9的随机数 ...

随机推荐

  1. 路飞学城详细步骤 part1

    详细步骤 1 添加登录页面 步骤: Header.vue 写一个登录按钮,<router-link to = ' /xx'> 在路由的 index.js中添加这个 新的路由,{'path' ...

  2. 解决 IDEA 中src下xml等资源文件无法读取的问题

    该问题的实质是,idea对classpath的规定. 在eclipse中,把资源文件放在src文件夹下,是可以找到的: 但是在idea中,直接把资源文件放在src文件夹下,如果不进行设置,是不能被找到 ...

  3. 【BZOJ3224】普通平衡树(splay)

    题意: 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作:1. 插入x数2. 删除x数(若有多个相同的数,因只删除一个)3. 查询x数的排名(若有多个相同的数,因输出最小的排 ...

  4. 标准C程序设计七---20

    Linux应用             编程深入            语言编程 标准C程序设计七---经典C11程序设计    以下内容为阅读:    <标准C程序设计>(第7版) 作者 ...

  5. slf4j 搭配 log4j2 处理日志

    目录 关于 log4j 关于 slf4j 案例使用 关于 log4j Log4j + Slf4j 的使用组合最为常见,但是我们知道 Log4j 目前已经停止更新了.Apache推出了新的 Log4j2 ...

  6. iOS开发 当前时间 时间戳 转换

    1.今天在做一个webservice的接口的时候,被要求传一个时间戳过去,然后就是开始在Google上找 2.遇到两个问题,一,当前时间转化为时间戳,二,获取的当前时间和系统的时间相差8个小时 一,转 ...

  7. 文件重定向,getline()获取一样,屏幕输出流,格式控制符dec,oct,hex,精度控制setprecision(int num),设置填充,cout.width和file(字符),进制输入

     1.在window下的命令重定向输出到文件里 2.将内容输入到某个文件里的方式:命令<1.txt (使用1.txt中的命令) 3.读取文件里的名,然后将命令读取最后输出到文件里.命令< ...

  8. Dynamics CRM 2015/2016 Web API:新的数据查询方式

    今天我们来看看Web API的数据查询功能,尽管之前介绍CRUD的文章里面提到过怎么去Read数据,可是并没有详细的去深究那些细节,今天我们就来详细看看吧.事实上呢,Web API的数据查询接口也是基 ...

  9. 2.6.2 用NPOI操作EXCEL--设置密码才可以修改单元格内容

    2.6.2 用NPOI操作EXCEL--设置密码       有时,我们可能需要某些单元格只读,如在做模板时,模板中的数据是不能随意让别人改的.在Excel中,可以通过“审阅->保护工作表”来完 ...

  10. VirtualBox中使用双网卡实现CentOS既能上网(校园网)也能使用SSHclient

    近期在虚拟机中使用linux操作系统,之前使用NAT方式上网,能够畅通无阻.可是使用SSHclient连接linux虚拟机就必须为其指定固定的IP地址.依照网上的配置方法使用桥接方式,这种方式是能够的 ...