李博的博客
0%

Area

For a given polygon g, computes the area of the polygon.

g is represented by a sequence of points $p_1$, $p_2$,…, $p_n$ where line segments connecting pi and pi+1 (1 ≤ in−1) are sides of g. The line segment connecting pn and p1 is also a side of the polygon.

阅读全文 »

Distance

For given two segments s1 and s2, print the distance between them.

s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.

阅读全文 »

Cross Point

For given two segments s1 and s2, print the coordinate of the cross point of them.

s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.

阅读全文 »

Intersection

For given two segments s1 and s2, print “1” if they are intersect, “0” otherwise.

s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.

阅读全文 »

Parallel/Orthogonal

For given two lines s1 and s2, print “2” if they are parallel, “1” if they are orthogonal, or “0” otherwise.

s1 crosses points p0 and p1, and s2 crosses points p2 and p3.

阅读全文 »

Reflection

For given three points p1,p2,p, find the reflection point x of p onto p1p2.

Input

1
2
3
4
5
6
xp1 yp1 xp2 yp2
q
xp0 yp0
xp1 yp1
...
xpq−1 ypq−1

In the first line, integer coordinates of p1 and p2 are given. Then, q queries are given for integer coordinates of p.

阅读全文 »

Projection

For given three points p1,p2,p, find the projection point x of p onto p1p2.

Input

1
2
3
4
5
6
xp1 yp1 xp2 yp2
q
xp0 yp0
xp1 yp1
...
xpq−1 ypq−1

In the first line, integer coordinates of p1 and p2 are given. Then, q queries are given for integer coordinates of p.

阅读全文 »

不解释,不难。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<cstring>
using namespace std;
const int maxn=1e3;
struct people{
int B,J;
people(){}
people(int B,int J):B(B),J(J){}
bool operator < (const people& x)const{
return J>x.J;
}
}p[maxn];
int main(){
int n,b,j,cnt=0;
while(scanf("%d",&n),n){
for(int i=0;i<n;i++){
scanf("%d%d",&b,&j);
p[i]=people(b,j);
}
sort(p,p+n);
long long ans=0,cur=0;
for(int i=0;i<n;i++){
cur+=p[i].B;
ans=max(ans,p[i].J+cur);
}
printf("Case %d: %lld\n",++cnt,ans);
}

return 0;
}