没事扯淡再写篇题解吧!反正只会大众题目。
A:
题意:给出n个队列以及每个人付费所需要的时间求出用时最短的一条队列。
sl: 比较逗比(叙述这么长)的水体,5分钟1Y 。
1 #include<cstdio>
B:
题意:给出一个字符串代表相应颜色的彩纸(S=1)。 然后又给出自己需要的彩纸,求得到的最大的彩纸的面积。
sl: 无以言状的水题(没办法只会这种),直接模拟就好了。
34 }
C:
题意:给出一个直角三角形的两条直角边的长度问是不是存在一组整点,使得直角三角形的任意一条边都不平行于坐标系。
sl:其实是道很水的题目。就是疯狂wa。主要是少考虑一种情况,就是当斜边平行于y轴的时候。
考虑到这种情况就简单了。直接枚举边a,那么边b可以通过方程组
x*i+y*i=0;
x^2+y^2=b^2;
得到。
53 }
One day, little Vasya found himself in a maze consisting of (n?+?1) rooms, numbered from 1 to (n?+?1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the (n?+?1)-th one.
The maze is organized as follows. Each room of the maze has two one-way portals. Let‘s consider room number i (1?≤?i?≤?n), someone can use the first portal to move from it to room number (i?+?1), also someone can use the second portal to move from it to room number pi, where 1?≤?pi?≤?i.
In order not to get lost, Vasya decided to act as follows.
Help Vasya determine the number of times he needs to use portals to get to room (n?+?1) in the end.
The first line contains integer n (1?≤?n?≤?103) — the number of rooms. The second line contains n integers pi (1?≤?pi?≤?i). Each pi denotes the number of the room, that someone can reach, if he will use the second portal in the i-th room.
Print a single number — the number of portal moves the boy needs to go out of the maze. As the number can be rather large, print it modulo1000000007 (109?+?7).
2
1 2
4
4
1 1 2 3
20
5
1 1 1 1 1
62
题意:给出n+1个房间,p【i】数组就是每一次从i房跳到p[i]房。每次经过i点都要先在 i 房间画上一个十字。
满足当i房的十字为奇数时要跳到p[i]房间。偶数跳到i+1号房间。问走到n+1号房间需要多少步。
sl: 还是比较水,tourise 9min 1Y卧槽。杂家要想一个小时。
可以知道如果一个人走到 i房间那么i之前的房间肯定有偶数个十字。这样设走到i房间 花偶数个十字的步数为
dp[i]。那么下一次跳到p[i] ,之后p[i]十字变为奇数,走的步数为dp[p[i]]。这样一直从p[i]加到i就是走到i应该走的步数。
所以只要从头到尾扫一遍就好了。
1 #include<cstdio>
You‘ve
got an array consisting of n integers: a[1],?a[2],?...,?a[n].
Moreover, there are m queries,
each query can be described by three integersli,?ri,?ki.
Query li,?ri,?ki means
that we should add to
each element a[j],
where li?≤?j?≤?ri.
Record means
the binomial coefficient, or the number of combinations from y elements
into groups of x elements.
You need to fulfil consecutively all queries and then print the final array.
The first line contains integers n, m (1?≤?n,?m?≤?105).
The second line contains n integers a[1],?a[2],?...,?a[n] (0?≤?ai?≤?109) — the initial array.
Next m lines
contain queries in the format li,?ri,?ki —
to all elements of the segment li... ri add
number (1?≤?li?≤?ri?≤?n; 0?≤?k?≤?100).
Print n integers: the i-th number is the value of element a[i] after all the queries. As the values can be rather large, print them modulo1000000007 (109?+?7).
5 1
0 0 0 0 0
1 5 0
1 1 1 1 1
10 2
1 2 3 4 5 0 0 0 0 0
1 6 1
6 10 2
2 4 6 8 10 7 3 6 10 15
题意:给出一组数列。然后给出一组查询,每次都在相应区间加上相应的值,求最终的序列。
sl: 就是被这道题打入了畜道。sol以后再补。。。
Codeforces Round #239 (Div. 2),布布扣,bubuko.com
Codeforces Round #239 (Div. 2)
原文:http://www.cnblogs.com/acvc/p/3636793.html