codeforces——模拟
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——模拟的更多相关文章
- Codeforces Round 254 (Div. 2)
layout: post title: Codeforces Round 254 (Div. 2) author: "luowentaoaa" catalog: true tags ...
- Codeforces Round 253 (Div. 2)
layout: post title: Codeforces Round 253 (Div. 2) author: "luowentaoaa" catalog: true tags ...
- Codeforces Round 251 (Div. 2)
layout: post title: Codeforces Round 251 (Div. 2) author: "luowentaoaa" catalog: true tags ...
- 2017, X Samara Regional Intercollegiate Programming Contest 题解
[题目链接] A - Streets of Working Lanterns - 2 首先将每一个括号匹配串进行一次缩减,即串内能匹配掉的就匹配掉,每个串会变成连续的$y$个右括号+连续$z$个左括号 ...
- Codeforces 747C:Servers(模拟)
http://codeforces.com/problemset/problem/747/C 题意:有n台机器,q个操作.每次操作从ti时间开始,需要ki台机器,花费di的时间.每次选择机器从小到大开 ...
- 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 ...
- Codeforces 740A. Alyona and copybooks 模拟
A. Alyona and copybooks time limit per test: 1 second memory limit per test: 256 megabytes input: st ...
- Codeforces 738D. Sea Battle 模拟
D. Sea Battle time limit per test: 1 second memory limit per test :256 megabytes input: standard inp ...
- codeforces 723B Text Document Analysis(字符串模拟,)
题目链接:http://codeforces.com/problemset/problem/723/B 题目大意: 输入n,给出n个字符的字符串,字符串由 英文字母(大小写都包括). 下划线'_' . ...
随机推荐
- IntelliJ IDEA 环境设置——侧栏显示类中所有方法
myeclipse默认会在右侧栏显示类的所有方法框,但是IDEA里并没有这样的初始化设置 那么怎样显示这个功能? 1.点击工具栏View-->Tool Windows-->Structur ...
- linux(Ubuntu16)下切换python2和python3(转)
采用update-alternatives 切换版本 1.打开终端:Ctrl+Alt+T 2.查看update-alternatives的帮助信息:update-alternatives --help ...
- Swing之登录界面
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Login extends JFrame ...
- Shock wave
** shock wave thickness of shock wave is order of 1e-7 m why governed by Euler Equation? P334 shock ...
- react入门----事件监听
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- graph.h
#ifndef _GRAPH_#define _GRAPH_#include<stdio.h>#include<stdlib.h>#include<string.h> ...
- 3.6.5 空串与Null串
空串""是长度为0的字符串.可以调用以下代码检查一个字符串是否为空: String s = "greeting"; ...
- JavaScript 面向对象的编程(三) 类的继承
定义父类和子类的继承关系 //声明父类 function SuperClass(){ this.superValue = true; } //为父类添加共有方法 SuperClass.prototyp ...
- 不动点(Fixed Point)
本系列文章由 @yhl_leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/51735818 在数学中,函数的不动点( ...
- python整数转ASCII码
# *-* coding:utf-8 *-* import binascii data = [1441465642, 251096121, -870437532, -944322827, 647240 ...