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. IntelliJ IDEA 环境设置——侧栏显示类中所有方法

    myeclipse默认会在右侧栏显示类的所有方法框,但是IDEA里并没有这样的初始化设置 那么怎样显示这个功能? 1.点击工具栏View-->Tool Windows-->Structur ...

  2. linux(Ubuntu16)下切换python2和python3(转)

    采用update-alternatives 切换版本 1.打开终端:Ctrl+Alt+T 2.查看update-alternatives的帮助信息:update-alternatives --help ...

  3. Swing之登录界面

    import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Login extends JFrame ...

  4. Shock wave

    ** shock wave thickness of shock wave is order of 1e-7 m why governed by Euler Equation? P334 shock ...

  5. react入门----事件监听

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. graph.h

    #ifndef _GRAPH_#define _GRAPH_#include<stdio.h>#include<stdlib.h>#include<string.h> ...

  7. 3.6.5 空串与Null串

        空串""是长度为0的字符串.可以调用以下代码检查一个字符串是否为空:                 String s = "greeting";    ...

  8. JavaScript 面向对象的编程(三) 类的继承

    定义父类和子类的继承关系 //声明父类 function SuperClass(){ this.superValue = true; } //为父类添加共有方法 SuperClass.prototyp ...

  9. 不动点(Fixed Point)

    本系列文章由 @yhl_leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/51735818 在数学中,函数的不动点( ...

  10. python整数转ASCII码

    # *-* coding:utf-8 *-* import binascii data = [1441465642, 251096121, -870437532, -944322827, 647240 ...