805 B. 3-palindrome    http://codeforces.com/problemset/problem/805/B

/*
题意字符串中不能有长度为三的回文串,且c数量最少
*/
#include<iostream>
#include<cstdio>
#include<cstring> using namespace std;
char s[]={'a','a','b','b'};
int n; int main()
{
scanf("%d",&n);
for(int i=;i<n;i++)
printf("%c",s[i%]);
printf("\n");
return ;
}

807 A Is it rated?       http://codeforces.com/problemset/problem/807/A

#include<iostream>
#include<cstdio>
#include<cstring> #define maxn 1001 using namespace std; int n,m,cnt;
int a[maxn],b[maxn]; inline int init()
{
int x=,f=;char c=getchar();
while(c>''||c<''){if(c=='-')f=-;c=getchar();}
while(c>=''&&c<=''){x=x*+c-'';c=getchar();}
return x*f;
} int main()
{
n=init();
for(int i=;i<=n;i++)
{
a[i]=init();b[i]=init();
}
for(int i=;i<=n;i++)
{
if(a[i]!=b[i])
{
printf("rated\n");
return ;
}
if(a[i]>a[i-])
{
printf("unrated\n");
return ;
}
}
printf("maybe\n");
return ;
}

错误代码

#include<iostream>
#include<cstdio>
#include<cstring> #define maxn 1001 using namespace std; int n,m,cnt;
int a[maxn],b[maxn]; inline int init()
{
int x=,f=;char c=getchar();
while(c>''||c<''){if(c=='-')f=-;c=getchar();}
while(c>=''&&c<=''){x=x*+c-'';c=getchar();}
return x*f;
} int main()
{
n=init();
for(int i=;i<=n;i++)
{
a[i]=init();b[i]=init();
}
for(int i=;i<=n;i++)
{
if(a[i]!=b[i])//这里!!可能第一个就不相同
{
printf("rated\n");
return ;
}
if(a[i]>a[i-])
{
printf("unrated\n");
return ;
}
}
printf("maybe\n");
return ;
}

codeforces——模拟的更多相关文章

  1. Codeforces Round 254 (Div. 2)

    layout: post title: Codeforces Round 254 (Div. 2) author: "luowentaoaa" catalog: true tags ...

  2. Codeforces Round 253 (Div. 2)

    layout: post title: Codeforces Round 253 (Div. 2) author: "luowentaoaa" catalog: true tags ...

  3. Codeforces Round 251 (Div. 2)

    layout: post title: Codeforces Round 251 (Div. 2) author: "luowentaoaa" catalog: true tags ...

  4. 2017, X Samara Regional Intercollegiate Programming Contest 题解

    [题目链接] A - Streets of Working Lanterns - 2 首先将每一个括号匹配串进行一次缩减,即串内能匹配掉的就匹配掉,每个串会变成连续的$y$个右括号+连续$z$个左括号 ...

  5. Codeforces 747C:Servers(模拟)

    http://codeforces.com/problemset/problem/747/C 题意:有n台机器,q个操作.每次操作从ti时间开始,需要ki台机器,花费di的时间.每次选择机器从小到大开 ...

  6. Codeforces Round #284 (Div. 2)A B C 模拟 数学

    A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard ...

  7. Codeforces 740A. Alyona and copybooks 模拟

    A. Alyona and copybooks time limit per test: 1 second memory limit per test: 256 megabytes input: st ...

  8. Codeforces 738D. Sea Battle 模拟

    D. Sea Battle time limit per test: 1 second memory limit per test :256 megabytes input: standard inp ...

  9. codeforces 723B Text Document Analysis(字符串模拟,)

    题目链接:http://codeforces.com/problemset/problem/723/B 题目大意: 输入n,给出n个字符的字符串,字符串由 英文字母(大小写都包括). 下划线'_' . ...

随机推荐

  1. 洛谷——P2734 游戏 A Game

    P2734 游戏 A Game 题目背景 有如下一个双人游戏:N(2 <= N <= 100)个正整数的序列放在一个游戏平台上,游戏由玩家1开始,两人轮流从序列的任意一端取一个数,取数后该 ...

  2. Linux学习笔记记录(五)

  3. STM32单片机串口一键下载电路与操作方法详解

    STM32三种启动模式对应的存储介质均是芯片内置的,它们是:1)用户闪存 = 芯片内置的Flash.2)SRAM = 芯片内置的RAM区,就是内存啦.3)系统存储器 = 芯片内部一块特定的区域,芯片出 ...

  4. UVA - 10870 UVA - 10870

    Problem ARecurrencesInput: standard inputOutput: standard output Consider recurrent functions of the ...

  5. 分块试水--CODEVS5037 线段树练习4加强版

    感觉这才算入门题吧..前面那些线段树练习,改几个字符就过了一定要搞成几道题.. n<=2e5的数列,给常数K<=2e5,m<=2e5个操作,区间加,问一个区间里K的倍数. 这题空间? ...

  6. 洛谷—— P2149 [SDOI2009]Elaxia的路线

    https://www.luogu.org/problem/show?pid=2149 题目描述 最近,Elaxia和w的关系特别好,他们很想整天在一起,但是大学的学习太紧张了,他们 必须合理地安排两 ...

  7. Spring/Maven/MyBatis配置文件结合properties文件使用

    使用properties文件也叫注入,比如把一些常用的配置项写入到这个文件,然后在Spring的XML配置文件中使用EL表达式去获取. 这种方式不只Spring可以使用,同样MyBatis也可以使用, ...

  8. keil编译后生成的M51文件解析

    通过*.m51文件我们能够清楚的看到单片机存储器的使用情况,以及能够看到每一个变量包含局部变量的位置. 之前碰到一个问题,相同的程序,在small模式下编译后执行没问题,但在large模式下能够编译. ...

  9. XCode 7 高速切换代码窗体和文档窗体

    XCode 7 高速切换代码窗体和文档窗体 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 ...

  10. javascript 将中文符号转换成英文符号

      javascript 将中文符号转换成英文符号 CreateTime--2018年3月30日09:01:29 Author:Marydon /** * 将中文符号转换成英文符号 */ functi ...