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. 【webpack插件使用】在开发中快速掌握并使用Webpack构建web应用程序

    1.webpack-dev-server插件的基本使用 入门程序 const path = require('path'); // 导出一个Webpack的配置对象(通过node中的模块操作,向外暴露 ...

  2. 洛谷——P3807 【模板】卢卡斯定理

    P3807 [模板]卢卡斯定理 洛谷智推模板题,qwq,还是太弱啦,组合数基础模板题还没做过... 给定n,m,p($1\le n,m,p\le 10^5$) 求 $C_{n+m}^{m}\ mod\ ...

  3. 运用循环求和( sum operation in python)

    1.for loop example 1: sum of 1+2+...+10 ********** >>> sum=0 >>> for x in [1,2,3,4 ...

  4. [UOJ48] 核聚变反应强度

    QUQ 思路 求出a1的所有约数,与a1.ai放入同一数组: 求出gcd(a1,ai): 枚举约数,得出ans; 代码实现 #include<cmath> #include<cstd ...

  5. 基于QQ服务器JavaMail邮箱SSL密码第三方发送邮件

    网上javaMail邮箱推送代码太多,大都是有缺陷的,今天做项目刚好要用到,于是发了大半天的时间解决的这个问题. jar包:javax.mail.jar 代码: import java.io.IOEx ...

  6. MySQL Workbench查看和修改表字段的Comment值

    查看: 选择单个表->[右键]->[Table Inspector] 再选择Columns选项卡即可,把表格拉倒最后一列. 编辑: 选择单个表->[右键]->[Alter Ta ...

  7. centos 7: 迁移MySQL目录

    Steps: 1. systemctl stop mariadb 2. mkdir data destination folder, ex: /home/mysql 3. cp -R /var/lib ...

  8. 我的CSDN博客停止更新通告

    我的CSDN博客停止更新通告 自从2001年在CSDN发表第一篇博客開始,至今天(2014年6月11日)为止,算起来我己经在CSDN博客上"呆"了13年.共发表251篇原创文章,有 ...

  9. 用BOOST_FOREACH简化遍历操作

    BOOST_FOREACH能够方便的遍历STL容器. 仅仅须要头文件: #include <boost/foreach.hpp> 然后遍历容器vector/list/set/deque/s ...

  10. Spring的AOP特性

    一.AOP简介 AOP是Aspect-Oriented Programming的缩写,即面向切面编程.利用oop思想,可以很好的处理业务流程,但是不能把系统中某些特定的重复性行为封装到模块中.例如,在 ...