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 ...
随机推荐
- 桌面面板和内部窗体JDeskPane、JInternalFrame
桌面面板和内部窗体JDeskPane.JInternalFrame,内部窗体必须在桌面面板里. import javax.swing.*; import java.awt.*; public clas ...
- bank_card.js
function init() { undefined = "undefined"; mkCClist(); } function ccchk(cdi) { output1 = & ...
- 根文件系统之init
title: 根文件系统之init tag: arm date: 2018-11-12 18:53:23 --- 引入 在Kernel源码分析中,了解到init_post是在挂载根文件系统之后执行应用 ...
- Event Recommendation Engine Challenge分步解析第三步
一.请知晓 本文是基于: Event Recommendation Engine Challenge分步解析第一步 Event Recommendation Engine Challenge分步解析第 ...
- Unity-使用面向对象的思想
在做游戏之初,老师曾经说过要用面向对象的思想去做.当时满口答应,应为学了一点C#的原因感觉面向对象很简单嘛,但是事实上在做游戏的过程中,为了赶进度我的代码写的很冗余,很乱.这就导致了我不得不重新修改. ...
- 5、MyBatis-parameterType 入参封装 Map 流程
以如下入参为例,MyBatis 版本为 3.5.0 public MyUser selectMyUserIdAndAge(Integer id, @Param("user") My ...
- Hadoop记录-hive操作示范
- ContentType组件
django提供的一个快速连表操作的组件 适用于:一个字段确定不了唯一: 如:pricepolicy表中,course_id和content_type中对应的课程类型id才能确定唯一: model.p ...
- Part-Six
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12.
- 【c++】编译器为我们实现了几个类成员函数?
#include <cassert> #include <complex> #include <iostream> class Empty{}; Empty e; ...