code forces 805B (水)
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#define LL long long
using namespace std;
//就是给你一个字符串长度,然后要求不能出现长度为3的回文子串。使用c尽可能少。
char str[200005];
int main()
{
int n,op1=0,op2=0;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
if(i==0)
{
str[i]='a';
op1++;
}
else if(op1==1)
{
str[i]='a';
op1++;
}
else if(op2==1)
{
str[i]='b';
op2++;
}
else if(op1==2)
{
str[i]='b';
op2++;
op1=0;
}
else if(op2==2)
{
str[i]='a';
op1++;
op2=0;
}
}
str[n]='\n';
printf("%s",str);
return 0;
}
code forces 805B (水)的更多相关文章
- 思维题--code forces round# 551 div.2
思维题--code forces round# 551 div.2 题目 D. Serval and Rooted Tree time limit per test 2 seconds memory ...
- Code Forces 796C Bank Hacking(贪心)
Code Forces 796C Bank Hacking 题目大意 给一棵树,有\(n\)个点,\(n-1\)条边,现在让你决策出一个点作为起点,去掉这个点,然后这个点连接的所有点权值+=1,然后再 ...
- Code Forces 833 A The Meaningless Game(思维,数学)
Code Forces 833 A The Meaningless Game 题目大意 有两个人玩游戏,每轮给出一个自然数k,赢得人乘k^2,输得人乘k,给出最后两个人的分数,问两个人能否达到这个分数 ...
- Code Forces 543A Writing Code
题目描述 Programmers working on a large project have just received a task to write exactly mm lines of c ...
- Code Forces 652A Gabriel and Caterpillar
A. Gabriel and Caterpillar time limit per test 1 second memory limit per test 256 megabytes input st ...
- code forces 383 Arpa's loud Owf and Mehrdad's evil plan(有向图最小环)
Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megab ...
- code forces 382 D Taxes(数论--哥德巴赫猜想)
Taxes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output ...
- code forces Watermelon
/* * Watermelon.cpp * * Created on: 2013-10-8 * Author: wangzhu */ /** * 若n是偶数,且大于2,则输出YES, * 否则输出NO ...
- code forces Jeff and Periods
/* * c.cpp * * Created on: 2013-10-7 * Author: wangzhu */ #include<cstdio> #include<iostrea ...
随机推荐
- 根文件系统之init
title: 根文件系统之init tag: arm date: 2018-11-12 18:53:23 --- 引入 在Kernel源码分析中,了解到init_post是在挂载根文件系统之后执行应用 ...
- hadoop 2.5 安装部署
hadoop 下载地址:http://mirrors.cnnic.cn/apache/hadoop/common/ 单机伪分布 配置文件: /hadoop-2.5.1/etc/hadoop/ hado ...
- 【.NET】VS 本地调试 无法加载Json文件
1.如果要是发布到iis,还加载不出来,那就要配置一下MIME类型: 2.本地调试时,无法加载json文件: 解决方案: 在web.config中添加如下配置:mimeMap <system.w ...
- No Spring WebApplicationInitializer types detected on classpath
情况: 1.使用 Tomcat 8 Maven 插件 2.使用 ServletContainerInitializer 模式配置 Spring 配置好后发现只会加载 spring-web 配置的 We ...
- MyBatis-DynamicSQL 动态SQL
MyBatis 的动态 SQL 使用 OGNL 表达式 http://commons.apache.org/proper/commons-ognl/language-guide.html 在 XML ...
- 16.观察者模式(Observer Pattern)
动机(Motivate): 在软件构建 过程中,我们需要为某些对象建立一种“通知依赖关系” --------一个对象(目标对象)的状态发生改变,所有的依赖对象(观察者对象)都将得到通知.如果这 ...
- Linux记录-定时crontab
/etc/crontab文件和crontab -e命令区别 1.格式不同 分 时 日 月 星期 要运行的命令 第1列分钟1-59 第2列小时1-23(0表示子夜) 第3列日1-31 第4列月1-12 ...
- Web API中给领域模型添加媒体类型支持
一.媒体类型 媒体类型(也称为MIME类型)标识一段数据的格式.在HTTP中,媒体类型描述了消息体的格式.媒体类型由两个字符串组成,一个类型和一个子类型.例如:text / html: image/ ...
- ruby读取exce文件,使用roo---Gem
module SEquipsHelper #设备台账,从excel文件读取信息 require 'roo' #require 'roo-xls' #读取excel文件 # SEquipsHelper. ...
- js中得计算问题算式结果拼接成字符串怎么解决
如题:经常遇到类似问题 一种:自定义的弱类型 var savNum=0; var num=$("#numU").val();//jsp页面获得得值 savNum=parseInt( ...