你猜我猜不猜你猜不猜

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. 洛谷 [P3834] 可持久化线段树(主席树)

    主席树可以存储线段树的历史状态,空间消耗很大,一般开45n即可 #include <iostream> #include <cstdio> #include <cstri ...

  2. 对象数据源objectdatasource的使用,类的编写实现查询增删改的方法

    原文发布时间为:2008-08-01 -- 来源于本人的百度文章 [由搬家工具导入] using System;using System.Data;using System.Configuration ...

  3. ReSharper7.1.25.234 注册机

    经常用vs做开发的人都知道,ReSharper是vistual studio必备插件之一.他的智能提示,智能感知,.net底层方法查看,测试等都非常方便,给程序员带来了巨大的效率. 但众所周知ReSh ...

  4. 关于gcc内置函数和c隐式函数声明的认识以及一些推测

    最近在看APUE,不愧是经典,看一点就收获一点.但是感觉有些东西还是没说清楚,需要自己动手验证一下,结果发现需要用gcc,就了解一下. 有时候,你在代码里面引用了一个函数但是没有包含相关的头文件,这个 ...

  5. spring-boot-nginx代理-docker-compose部署

    在本地测试,使用docker部署不用在意环境 java测试项目: web框架:spring boot 框架 项目管理:maven 数据库:redis + postgres + mongo 部署相关:n ...

  6. java集合系列之LinkedList源码分析

    java集合系列之LinkedList源码分析 LinkedList数据结构简介 LinkedList底层是通过双端双向链表实现的,其基本数据结构如下,每一个节点类为Node对象,每个Node节点包含 ...

  7. 纯Java实现定时任务(转)

    第一种: import java.util.Timer; import java.util.TimerTask; /** * * 于第一种方式相比,优势 1>当启动和去取消任务时可以控制 2&g ...

  8. Linux配置防火墙添加端口(Ubuntu/Debian无法使用此方法)

    注意:Ubuntu/Debian无法使用此方法 1.打开iptables vi /etc/sysconfig/iptables 2.添加防火墙规则 规则参考:http://www.cnblogs.co ...

  9. 【Linux】在虚拟机上安装ubuntu

    虚拟机安装步骤  参考:http://www.cnblogs.com/sxdcgaq8080/p/7466529.html 在安装ubuntu系统之前,当然是下载一个ubuntu的iso镜像在本地啦. ...

  10. flask如何使模板返回大文件,又不消耗大量内存

    当我们要往客户端发送大量的数据,比如一个大文件时,将它保存在内存中再一次性发到客户端开销很大.比较好的方式是使用流,本篇就要介绍怎么在Flask中通过流的方式来将响应内容发送给客户端.此外,我们还会演 ...