标签:style blog color io os for 2014 div sp
已经确定了的。。。
B Rotate
1 /* 2 ID:esxgx1 3 LANG:C++ 4 PROG:B 5 */ 6 #include <cmath> 7 #include <cstdio> 8 #include <cstring> 9 #include <iostream> 10 #include <algorithm> 11 using namespace std; 12 13 struct p { 14 double x,y; 15 }; 16 17 #define PI 3.141592654 18 19 #define _x(a) (_x = (a.x - x) * cos(r) - (a.y - y) * sin(r) + x) 20 #define _y(a) (_y = (a.x - x) * sin(r) + (a.y - y) * cos(r) + y) 21 22 int main(void) 23 { 24 #ifndef ONLINE_JUDGE 25 freopen("in.txt", "r", stdin); 26 #endif 27 28 int T; 29 scanf("%d", &T); 30 31 32 while(T) { 33 p p0[2] = {{0.0, 100000}, {100000, 0.0}}; 34 p p1[2] = {{0.0, 100000}, {100000, 0.0}}; 35 36 int N; 37 double x,y,r; 38 double rr = 0.0; 39 scanf("%d", &N); 40 41 #define x0 p0[0].x 42 #define x1 p0[1].x 43 #define xx0 p1[0].x 44 #define xx1 p1[1].x 45 #define y0 p0[0].y 46 #define y1 p0[1].y 47 #define yy0 p1[0].y 48 #define yy1 p1[1].y 49 50 for(int i=0; i<N; ++i) { 51 double _x, _y; 52 scanf("%lf%lf%lf", &x, &y, &r); 53 _x(p1[0]); _y(p1[0]); xx0 = _x, yy0 = _y; 54 _x(p1[1]); _y(p1[1]); xx1 = _x, yy1 = _y; 55 rr += r; 56 } 57 while(rr >= 2*PI) rr -= 2*PI; 58 59 double ansx = ((y0+yy0) / 2 - (xx0*xx0-x0*x0)/(2*(y0-yy0)) - (y1 + yy1) / 2 + (xx1*xx1 - x1*x1) / (2*(y1-yy1)))/((xx1-x1)/(y1-yy1) - (xx0 - x0) / (y0-yy0)); 60 double ansy = ((xx0-x0) / (y0 - yy0)) * ansx + (y0 + yy0)/2 - (xx0*xx0 - x0*x0)/((y0-yy0)*2); 61 printf("%f %f %f\n", ansx, ansy, rr); 62 --T; 63 } 64 return 0; 65 }
D Clone
1 /* 2 ID:esxgx1 3 LANG:C++ 4 PROG:D 5 */ 6 #include <cstdio> 7 #include <cstring> 8 #include <iostream> 9 #include <algorithm> 10 using namespace std; 11 12 #define NN 2007 13 #define MM 4002*4002 14 15 #define MOD ((int)(1e9 + 7)) 16 17 int a[NN], dp[MM]; 18 19 int main(void) 20 { 21 #ifndef ONLINE_JUDGE 22 freopen("in.txt", "r", stdin); 23 #endif 24 25 int T; 26 27 scanf("%d", &T); 28 while(T) { 29 int N; 30 scanf("%d", &N); 31 for(int i=0; i<N; ++i) 32 scanf("%d", &a[i]); 33 memset(dp, 0, sizeof(dp)); 34 int summ = 0; 35 for(int i=0; i<N; ++i) { 36 summ += a[i]; 37 dp[0] = 1; 38 for(int j=summ; j>=0; --j) 39 for(int k=1; k<=min(j, a[i]); ++k) 40 dp[j] = (dp[j] + dp[j-k]) % MOD; 41 } 42 printf("%d\n", dp[summ>>1]); 43 --T; 44 } 45 return 0; 46 }
G Osu!
#include<cstdio> #include<cmath> #include<iostream> #include<algorithm> using namespace std; double a[507]; int main(void) { int T; for(scanf("%d", &T); T; --T) { int N; scanf("%d", &N); for(int i=1; i<=N; i++) scanf("%lf", &a[i]); sort(a+1,a+1+N, greater<int>()); double ans = 0; for(int i=1;i<=N;i++) ans += pow(0.95, i-1) * a[i]; printf("%.9f\n", ans); } return 0; }
2014 ACM/ICPC Asia Regional Anshan Online
标签:style blog color io os for 2014 div sp
原文地址:http://www.cnblogs.com/e0e1e/p/icpc2014_anshan.html