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 ...
随机推荐
- CentOS 7 (Linux) 下载百度网盘大文件
这个方法不仅适合下载 "百度网盘" 中的文件,还可以下载磁链之类的,总之,就是能够加快下载速度的方法. (参考了网上的多篇文章,自行实践,成功下载度盘大文件,并且提升了下载速度) ...
- exgcd证明和最基础应用
如何求解这个方程:\(ax + by = gcd (a, b)\)? \(∵gcd(a, b) = gcd (b, a \% b)\) \(∴\)易证 $ gcd(a, b)$ 总是可以化为 \(gc ...
- vbox的桥接网络
直接连接到了外网上,宿主机可以访问虚拟机,但是虚拟机不可以访问宿主机.缺点:宿主机没有网络时,将不能ping通. 宿主机:win10 网络:无线 虚拟机系统:centos6.5 vbox版本:6.0. ...
- 你一直在找的 Mac 系统优化工具,可能就是这一款!
文章来源:知乎 文章收录于:风云社区 www.scoee.com,提供上千款各类mac软件下载 尽管 Mac 上的维护工具总会被人诟病(通常是那些极客),但对于普通用户来说,像 CleanMyMac. ...
- Rancher之HA部署
sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors&q ...
- Redis Bgrewriteaof 命令
一.背景 1. AOF: Redis的AOF机制有点类似于Mysql binlog,是Redis的提供的一种持久化方式(另一种是RDB),它会将所有的写命令按照一定频率(no, always, eve ...
- 5、JPA-映射-单向多对一
多个订单对应一个用户 实体类 Customer package com.jpa.yingshe; import javax.persistence.*; @Table(name = "JPA ...
- C#设计模式(8)——外观模式
1.外观模式介绍 外观模式也被叫做门面模式,这种模式的作用是:隐藏系统的复杂性,并向客户端提供了一个可以访问系统的统一接口,这个统一的接口组合了子系统的多个接口.使用统一的接口使得子系统更容易被访问或 ...
- CodeFirst+MySql开发
CodeFirst+MySql开发简单入门 记录一下使用Mysql进行EF Codefirst方式开发的简单过程. 0.准备工作 安装MySql,mysql-connector-net,mysql-f ...
- linux 精简开机自启动
centos7 精简开机自启动 ntsysv rsyslog crond sshd network