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 ...
随机推荐
- 转:upload.parseRequest为空
上传是items一直是空list.导致原因是struts2把原始的原来S2为简化上传功能,把所有的enctype="multipart/form-data"表单做了wrapper最 ...
- 论文总结(Frequent Itemsets Mining With Differential Privacy Over Large-Scale Data)
一.论文目标:将差分隐私和频繁项集挖掘结合,主要针对大规模数据. 二.论文的整体思路: 1)预处理阶段: 对于大的数据集,进行采样得到采样数据集并计算频繁项集,估计样本数据集最大长度限制,然后再缩小源 ...
- java List集合
List集合包括四种类,分别是ArrayList.LinkedList.Vector.Stack. ArrayList:元素的存储是顺序存储,可以根据数组的下标查询,查询速度快,但是在删除和插入元素时 ...
- python爬虫获取图片
import re import os import urllib #根据给定的网址来获取网页详细信息,得到的html就是网页的源代码 def getHtml(url): page = urllib. ...
- 42套JavaScript深度解析教学视频!合集
本文首发于:风云社区SCOEE(社区旨在普惠软件.图片.音乐.视频.素材.文档等互联网资源.为大众提供多样化的服务,以及主要涵盖学术科学.电脑技术.文化人文.体育健身等领域的知识和信息,获得用户的支持 ...
- Mac 上有哪些比较有意思的小软件?
文章素材来源:微博.新浪看点 收录于:风云社区(SCOEE)[提供mac软件下载] 更多专题,可关注小编[磨人的小妖精],查看我的文章,也可上[风云社区 SCOEE],查找和下载相关软件资源. (一) ...
- OpenRefine
无论是现今的大数据还是企业内部的小数据,都存在一些普遍的问题,如数据格式不对需要转换,一个单元格内包含多个含义的内容,包含重复项等等,虽然我们也可以使用excel解决,但是excel天生有诸多限制,比 ...
- kaggle竞赛入门整理
1.Bike Sharing Demand kaggle: https://www.kaggle.com/c/bike-sharing-demand 目的:根据日期.时间.天气.温度等特征,预测自行车 ...
- Hadoop问题:Input path does not exist: hdfs://Master:9000/user/hadoop/input
问题描述: org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist: hdfs:/ ...
- Scrapy Shell的使用
Scrapy终端是一个交互终端,我们可以在未启动spider的情况下尝试及调试代码,也可以用来测试XPath或CSS表达式,查看他们的工作方式,方便我们爬取的网页中提取的数据. 如果安装了 IPyth ...