CodeForces 1143A The Doors】的更多相关文章

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])…
You are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of two phases. During the first phase you make your move and during the second phase Slavik makes his move. There are nn doors, the ii-th door ini…
A. The Doors time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home…
题意:有\(n\)扇门,你每次可以攻击某个门,使其hp减少\(x\)(\(\le 0\)后就不可修复了),之后警察会修复某个门,使其hp增加\(y\),问你最多可以破坏多少扇门? 题解:首先如果\(x>y\),那么我肯定全部都能破坏,否则,统计\(hp\le x\)的门的个数,谁先碰门谁先赢,而我是先手,所以能破坏的门的个数就是\(\lceil \frac{cnt}{2} \rceil\). 代码: int n,x,y; int a[N]; int main() { //ios::sync_wi…
题目: http://codeforces.com/problemset/problem/676/D code: #include <stdio.h> #define MAXN 1001 #define LEFT 0 #define TOP 1 #define RIGHT 2 #define BOTTOM 3 struct block{ //left,top,right,bottom ]; int doors_num; int rotats; int minutes; }; struct bl…
D. Theseus and labyrinth 题目链接:http://codeforces.com/contest/676/problem/D Theseus has just arrived to Crete to fight Minotaur. He found a labyrinth that has a form of a rectangular field of sizen × m and consists of blocks of size 1 × 1. Each block o…
Shopping 题目连接: http://codeforces.com/gym/100803/attachments Description Your friend will enjoy shopping. She will walk through a mall along a straight street, where N individual shops (numbered from 1 to N) are aligned at regular intervals. Each shop…
A. The Useless Toy time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which…
The Doors +0 找出输入的01数列里,0或者1先出完的的下标. Nirvana +3 输入n,求1到n的数字,哪个数逐位相乘的积最大,输出最大积. 思路是按位比较,从低到高,依次把小位换成全9,判断一下.细节上容易出错,比如边界和减一的情况.要多加小心. Queen +0 给一棵树,删除树中一些点,这些点的\(C_i\)权值是1,且直接的孩子也也是1.从小到大依次输出删除的编号. 中间我以为是所有子孙的权值都要是1,幸好发现了. The Beatles /+0 给一个\(n \cdot…
题目链接:http://codeforces.com/contest/776/problem/D D. The Door Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Moriarty has trapped n people in n distinct rooms in a hotel. Some room…