首页 > 代码库 > 2014 ACM/ICPC Asia Regional Anshan Online
2014 ACM/ICPC Asia Regional Anshan Online
已经确定了的。。。
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.14159265418 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_JUDGE25 freopen("in.txt", "r", stdin);26 #endif27 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].x42 #define x1 p0[1].x43 #define xx0 p1[0].x44 #define xx1 p1[1].x45 #define y0 p0[0].y46 #define y1 p0[1].y47 #define yy0 p1[0].y48 #define yy1 p1[1].y49 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 200713 #define MM 4002*400214 15 #define MOD ((int)(1e9 + 7))16 17 int a[NN], dp[MM];18 19 int main(void)20 {21 #ifndef ONLINE_JUDGE22 freopen("in.txt", "r", stdin);23 #endif24 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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。