CodeForces 1143A The Doors
签到题
#include <iostream>
using namespace std;
int a[200005];
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
int x=a[n-1];
int pos=n-2;
for(int i=n-2;i>=0;i--)
{
if(x!=a[i])
{
pos =i;
break;
}
}
printf("%d\n",pos+1);
return 0;
}
CodeForces 1143A The Doors的更多相关文章
- Doors Breaking and Repairing CodeForces - 1102C (思维)
You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consi ...
- Codeforces Round #549 (Div. 2)A. The Doors
A. The Doors time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- Codeforces Round #531 (Div. 3) C. Doors Breaking and Repairing (博弈)
题意:有\(n\)扇门,你每次可以攻击某个门,使其hp减少\(x\)(\(\le 0\)后就不可修复了),之后警察会修复某个门,使其hp增加\(y\),问你最多可以破坏多少扇门? 题解:首先如果\(x ...
- CodeForces 676D代码 哪里有问题呢?
题目: http://codeforces.com/problemset/problem/676/D code: #include <stdio.h> #define MAXN 1001 ...
- Codeforces Round #354 (Div. 2)-D
D. Theseus and labyrinth 题目链接:http://codeforces.com/contest/676/problem/D Theseus has just arrived t ...
- Codeforces Gym 100803C Shopping 贪心
Shopping 题目连接: http://codeforces.com/gym/100803/attachments Description Your friend will enjoy shopp ...
- Codeforces Round #426 (Div. 2)【A.枚举,B.思维,C,二分+数学】
A. The Useless Toy time limit per test:1 second memory limit per test:256 megabytes input:standard i ...
- Codeforces Round #549 (Div. 2) 训练实录 (5/6)
The Doors +0 找出输入的01数列里,0或者1先出完的的下标. Nirvana +3 输入n,求1到n的数字,哪个数逐位相乘的积最大,输出最大积. 思路是按位比较,从低到高,依次把小位换成全 ...
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined) D. The Door Problem 2-SAT
题目链接:http://codeforces.com/contest/776/problem/D D. The Door Problem time limit per test 2 seconds m ...
随机推荐
- Linux之搭建远程数据库[Ubuntu:全过程]
1.mariadb在Linux中首次进入mysql (因为此时还没有创建任何用户,mysql的root并不等效于linux中的root用户) sudo apt-get install mysql-se ...
- 异常捕获try----catch
如果try语句里有return,返回的是try语句块中变量值. 详细执行过程如下: 如果有返回值,就把返回值保存到局部变量中: 执行jsr指令跳到finally语句里执行: 执行完finally语句后 ...
- error: no matching function for call to 'std::exception:exception(const char[16])'
环境:codeblocks 语言:C++ 在执行:throw new exception("queue is empty.");时 遇到问题:error: no matching ...
- Python-Django-BBS
一个项目从无到有 1 需求分析 -登录ajax,图形验证码 -注册forms和ajax,上传头像,头像预览 -博客首页 -个人站点 -点赞,点踩 -评论 -根评论 -子评论 -后台展示 -添加文章 - ...
- vue的配置环境篇
1.电脑已经安装的nodejs和webpack. 2.1)打开cmd.win+r.可以直接输入node -v查看版本.安装淘宝镜像 npm install -g cnpm --registry=ht ...
- git用代码库文件完全覆盖本地/git不能提交jar的设置
用代码库中的文件完全覆盖本地工作版本. 方法如下: git reset --hard git pull 操作后 本地该目录下所有修改都会被删除!!! 谨慎操作! 项目目录下 文件:.gitignore ...
- bzoj 2028(会场预约)
题目描述 PP大厦有一间空的礼堂,可以为企业或者单位提供会议场地. 这些会议中的大多数都需要连续几天的时间(个别的可能只需要一天),不过场地只有一个,所以不同的会议的时间申请不能够冲突.也就是说,前一 ...
- leetcode目录
Leetcode 1. 数组 2. 动态规划 3. 字符串 4. 链表.双指针.排序 5. 树 6. 回溯算法.贪心算法.分治算法.
- mysql运行报The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone的解决方法
话不多说,从错误即可知道是时区的错误,因此只要将时区设置为你当前系统时区即可, 因此使用root用户登录mysql,按照如下图所示操作即可. 我电脑的系统为北京时区,因此在系统中设置后,再连接数据库运 ...
- SA:利用SA算法解决TSP(数据是14个虚拟城市的横纵坐标)问题——Jason niu
%SA:利用SA算法解决TSP(数据是14个虚拟城市的横纵坐标)问题——Jason niu X = [16.4700 96.1000 16.4700 94.4400 20.0900 92.5400 2 ...