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 ...
随机推荐
- 网页性能工具:webpage使用
老大要求优化首页的加载时间,让测试给个详细数据. 轻松用了webpage 参考介绍: http://www.cnblogs.com/strick/p/6681692.html 测试网址: http:/ ...
- (贪心部分背包问题)Saving HDU HDU2111
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- python学习笔记--文件重命名,删除及文件夹
文件重命名 import os os.rename('123.txt','456.txt') 删除文件 >>> import os >>> os.remove('4 ...
- 【优秀的设计绘图软件】Affinity Designer Beta for Mac 1.7
[简介] Affinity Designer 1.7 beta 中文版本,具有全新的UI界面和功能,支持最新的 macOS Mojave 10.14 系统,Affinity Designer是 ...
- ojdbc6下载地址
https://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html oracle驱动先去官网下 ...
- JavaSE_坚持读源码_HashMap对象_get_Java1.7
当你从HashMap里面get时,你其实在干什么? /** * Returns the value to which the specified key is mapped, * or {@code ...
- Python中表达式与语句
简述 Python中我暂时并未发现谁对着两个名词的明确定义:我对这两个名词的理解就是,表达式就是你想要执行的对象,语句就是你的具体执行操作. 这里应用慕课网老师的一段话,摘自网上"表达式(E ...
- 2.抽象工厂(Abstract Factory)
常规的对象创建方法: //创建一个Road对象 Road road =new Road(); new 的问题: 实现依赖,不能应对“具体实例化类型”的变化.解决思路: 封装变化点-----哪里变 ...
- IO流之FileUtils工具类的使用
IO流之FileUtils工具类的使用: 使用apache的commons-io包下的FileUtils,我筛选了一些常用方法:
- vue中nextTick
vue中nextTick可以拿到更新后的DOM元素 如果在mounted下不能准确拿到DOM元素,可以使用nextTick 在Vue生命周期的created()钩子函数进行的DOM操作一定要放在Vue ...