C. Seat Arrangements time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, y…
传送门:http://codeforces.com/contest/919/problem/C 给出一张n×m的座位表(有已占座位和空座位),请选择同一行(或列)内连续的k个座位.求选择的方法数. Hack:首先,若k=1,则所有的空座位均可选,方法数即为空座位数. 对于某一行(或列)中连续的len个座位,选择的方法数为len-k+1. 于是,分别逐行.逐列地统计,求出答案.参考程序如下: #include <stdio.h> #define MAX_N 2000 char map[MAX_N…
C. Seat Arrangements time limit per test1 second memory limit per test256 megabytes Problem Description Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that…
C. Seat Arrangements   time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom,…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 用pre[i][j]表示第i行前j列的和. 然后枚举连续座位的最左上点. (有两种可能向右或向下k个. 则还需要处理出pre2[i][j]表示第j列前i行的和. (都可以O(N^2)求出 然后pre[i][j+k-1]-pre[i][j-1]就是第i行第j列往右k个格子的空(或被占据)的格子数目了. 看看是不是符合要求就好. 往下扩展同理. k==1的时候只要取向右一种就好.所以直接除个2 [代码] #include <bits…
题目链接 \(Description\) 飞机上有n个位置.有m个乘客入座,每个人会从前门(1)或后门(n)先走到其票上写的位置.若该位置没人,则在这坐下:若该位置有人,则按原方向向前走直到找到空座坐下. 如果有人最后仍无座,he will be angry.求有多少种安排票上位置的方案使得没有人会angry(不同票写的位置可相同,从前门/后门进是不同的). \(Solution\) 如果我们添加一个位置到0或n+1,那么不合法情况就是有人坐在了这个位置. 那么加入n+1后,可以把序列看成环,这…
A. Supermarket We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, when asked how much the items are, the clerk will say that a yuan for b kilos (You don't need to…
http://codeforces.com/contest/426/problem/B B. Sereja and Mirroring time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's assume that we are given a matrix b of size x × y, let's determine…
给出一个合法的括号串 有LRD三种操作 LR分别是左右移动当前位置 且合法 D为删除这个括号和里面的所有 当删除完成后 位置向右移动 如果不能移动 就向左 比赛都是很久远的事情了 写这道题也是一时兴起 先写了一发暴力 先拿a记录下来与这个括号相匹配的括号位置 拿vis记录括号是否被删除 每次碰到false的括号就整体跳过 然后一气跑到了test78才停下来 想了想暴力肯定不行 就加了l数组和r数组 来记录当前位置的左右仍存在的括号在哪 每次进行移动和删除的时候都利用这个进行移动 顺便更改 有一种…
C. Fly time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on n−2n−2 intermediate planet…
Spies Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100463/attachments Description In the aftermath of Canada’s annexation of Pittsburgh tensions have been pretty high between Canada and the US. You have personally been hired…
B. Food on the Plane time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output A new airplane SuperPuperJet has an infinite number of rows, numbered with positive integers starting with 1 from cockp…
B. Game of the Rows time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Daenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains ai soldiers. She wants to brin…
B. Teams Formation link http://codeforces.com/contest/878/problem/B describe This time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only…
Daenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains ai soldiers. She wants to bring her army to the other side of the sea to get the Iron Throne. She has recently bought an airplane to carry her army through the…
Pronlem A In a small restaurant there are a tables for one person and b tables for two persons. It it known that n groups of people come today, each consisting of one or two people. If a group consist of one person, it is seated at a vacant one-seate…
A. Bus to Udayland 题目连接: http://www.codeforces.com/contest/711/problem/A Description ZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has n rows of seats. There are 4 sea…
C. Zero-One 题目连接: http://codeforces.com/contest/135/problem/C Description Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to pla…
B. Cinema Cashier 题目连接: http://www.codeforces.com/contest/10/problem/B Description All cinema halls in Berland are rectangles with K rows of K seats each, and K is an odd number. Rows and seats are numbered from 1 to K. For safety reasons people, who…
B. Seating On Bus 题目连接: http://www.codeforces.com/contest/660/problem/B Description Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capac…
E. Roland and Rose Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/460/E Description Roland loves growing flowers. He has recently grown a beautiful rose at point (0, 0) of the Cartesian coordinate system. The ro…
题目链接:http://codeforces.com/contest/982 A. Row time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output You're given a row with nn chairs. We call a seating of people "maximal" if the two follow…
地址:http://codeforces.com/contest/660/problem/B 题目: B. Seating On Bus time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider 2n rows of the seats in a bus. n rows of the seats on the left…
题目链接:http://codeforces.com/contest/828 A. Restaurant Tables time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In a small restaurant there are a tables for one person and b tables for two pers…
原博主:https://blog.csdn.net/amovement/article/details/80358962 B. Bus of Characters time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In the Bus of Characters there are nn rows of seat, each h…
Bus to Udayland 题目链接: http://codeforces.com/contest/711/problem/A Description ZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has n rows of seats. There are 4 seats in e…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…