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个字符的字符串,字符串由 英文字母(大小写都包括). 下划线'_' . ...
随机推荐
- 部署web服务器的配置——补充mysql和tomcat
今天想到了关于mysql的一些配置,以后关于配置mysql和tomcat相关的内容也会补充在这里. tomcat: 1. 更改内存(要设置tomcat内存,解决内存溢出的问题):安装版tomcat,打 ...
- 深度完整的了解MySQL锁
今天就讲讲MySQL的锁 主讲:Mysql的悲观锁 和 乐观锁官方:If you query data and then insert or update related data within th ...
- docke容器使用
Docker 容器使用 Docker 客户端 docker 客户端非常简单 ,我们可以直接输入 docker 命令来查看到 Docker 客户端的所有命令选项. runoob@runoob:~# do ...
- open random
open文件操作 f = open('文件路径',mode='rwab+',encoding='utf-8') # content = f.read(3) # 读出来的都是字符 # f.seek(3) ...
- [bzoj1044][HAOI2008][木棍分割] (二分+贪心+dp+队列优化)
Description 有n根木棍, 第i根木棍的长度为Li,n根木棍依次连结了一起, 总共有n-1个连接处. 现在允许你最多砍断m个连接处, 砍完后n根木棍被分成了很多段,要求满足总长度最大的一段长 ...
- java之比较两个日期大小----https://blog.csdn.net/dongfangbaiyun/article/details/51225469
https://blog.csdn.net/dongfangbaiyun/article/details/51225469 java之比较两个日期大小 最近又用到两个日期大小的比较,因此记录在此,方便 ...
- @Value取值为NULL的解决方案------https://blog.csdn.net/zzmlake/article/details/54946346
@Value取值为NULL的解决方案 https://blog.csdn.net/zzmlake/article/details/54946346
- [K/3Cloud]如何解决kdpkg无法部署到业务站点的问题
自从下载了sp1后,就迫不急待的试用下,看看反馈的几个关键bug是否修复,可惜sp1安装后发现业务站点下的组件一个都没有被更新,这指定是有问题了,这真是让哥百思不得其解,真后悔在研发时没仔细研究下部署 ...
- Asp.Net页面生命周期[转]
一.什么是Asp.Net页面生命周期 当我们在浏览器地址栏中输入网址,回车查看页面时,这时会向服务器端(IIS)发送一个request请求,服务器就会判断发送过来的请求页面, 完全识别 HTTP 页 ...
- Ubuntu 16.04安装BleachBit清理系统垃圾文件
在LInux下不同于Windows会产生系统垃圾,但是Linux会产生安装软件时的依赖包,比如卸载一个软件,其依赖包是不会删除的.但是可以通过以下命令解决: #清理旧版本的软件缓存 sudo apt- ...