2012金华现场赛
2013-01-25 10:05
176 查看
据说赛区给教练送丝袜,亮瞎了有木有,哇咔咔。
mum有要求的边删掉,没要求的连上。按层次计数统计一下就搞定了。
排序的标准:
设已知(a.a, a.b),(b.a, b.b)两个Query相邻, 总的等待时间是可能是a.a+b.a+a.a*b.b+C, a.a+b.b+b.a*a.b+C,常数C不依赖两个Query的顺序。
所以按照a.a*b.b<b.a*a.b排序贪心既可。
Draw Something
这个是现场赛的题?⊙﹏⊙怎么感觉在试输入输出。。#include <stdio.h> int main() { int a,b,sum,i,j,n; while ( scanf("%d",&n),n ) { sum=0; for (i=0; i<n; i++) { scanf("%d",&a); sum+=a*a; } printf("%d\n",sum); } return 0; }
Dressing
这个图分三层,clothes,pants ans shoes。mum有要求的边删掉,没要求的连上。按层次计数统计一下就搞定了。
#include <stdio.h> #include <string.h> const int N=1010; char b1[20],b2[20]; int p12 ,p23 ; int main() { int n,m,k,i,j,p,a,b,sum; while (scanf("%d%d%d",&n,&m,&k), !(n==0&&m==0&&k==0) ) { //init sum=0; for (i=1; i<=n; i++) for (j=1; j<=m; j++) { p12[i][j]=1; } for (j=1; j<=m; j++) p23[j]=k; //input scanf("%d",&p); for (i=0; i<p; i++) { scanf("%s%d%s%d",b1,&a,b2,&b); if (b1[0]=='c'){ p12[a][b]=0; } else{ p23[a]--; } } //solve for (i=1; i<=n; i++) for (j=1; j<=m; j++) if (p12[i][j]) { sum+=p23[j]; } printf("%d\n",sum); } return 0; }
Physical Examination
排序题,题意清晰,要使得等待时间最少,贪心就可以了。排序的标准:
设已知(a.a, a.b),(b.a, b.b)两个Query相邻, 总的等待时间是可能是a.a+b.a+a.a*b.b+C, a.a+b.b+b.a*a.b+C,常数C不依赖两个Query的顺序。
所以按照a.a*b.b<b.a*a.b排序贪心既可。
#include <stdio.h> #include <algorithm> using namespace std; const long long N=100100; const long long mod=365*24*60*60; struct _node{ long long a,b; }a ; inline bool cmp(const _node &a, const _node &b) { // return (a.a<b.a); return (a.a*b.b < a.b*b.a ); } int main() { long long i,j,k,n,now; while (scanf("%I64d",&n),n) { for (i=0; i<n; i++) { scanf("%I64d%I64d",&a[i].a,&a[i].b); } sort(a,a+n,cmp); now=0; for (i=0; i<n; i++) { now=(a[i].a+a[i].b*now + now) % mod; // printf("a=%I64d b=%I64d time=%I64d\n",a[i].a,a[i].b,now); } printf("%I64d\n",now); } return 0; }
Crazy Tank
枚举角度计算答案,很容易AC。#include <cstdio> #include <cmath> const double esp=1e-6; const double PI=acos(-1.0); const double add=PI/1000; const double g=9.8; const int N=510; double h,l1,r1,l2,r2; double v ; int n; inline int solve(double theta){ int ret=0,i; double x; for (i=0; i<n; i++) { x=v[i]*cos(theta)* ( (v[i]*sin(theta)) + sqrt(v[i]*v[i]*sin(theta)*sin(theta)+2*g*h) )/g; if (l2<=x && r2>=x) return 0; if (l1<=x && r1>=x) ret++; //printf("%.6lf\n",x); } //printf("%d\n",ret); return ret; } int main(){ int i,max,tmp; double theta; while (scanf("%d",&n),n){ max=0; scanf("%lf%lf%lf%lf%lf",&h,&l1,&r1,&l2,&r2); for (i=0; i<n; i++) scanf("%lf",&v[i]); //solve(0);return(0); for (theta=-PI/2.0; theta<=PI/2.0; theta+=add){ tmp=solve(theta); if (tmp>max) max=tmp; } printf("%d\n",max); } return 0; }
相关文章推荐
- HDU 4451 Dressing 2012亚洲区域赛金华现场赛
- 2012 金华 现场赛
- HDU 4445Crazy Tank 2012金华现场赛D题(暴力枚举)
- 2012 金华现场赛 A题
- hdu4445 CRAZY TANK 2012金华赛区现场赛D题
- 2012 金华现场赛 I题
- 2012 金华现场赛 J题
- 2012 金华 现场赛
- 2012 金华赛区现场赛
- hdu4445 CRAZY TANK 2012金华赛区现场赛D题
- 2012 金华现场赛K题
- ACM/ICPC 2012金华regional现场赛C题 hdu4444 离散化、最短路
- HDU 4450 Draw Something 2012亚洲区域赛金华现场赛I题
- HDU 4442 Physical Examination 2012亚洲区域赛金华现场赛A题
- 2012金华现场赛四个水题题解(积分赛第四场)
- poj 4052 Hrinity 2012 金华邀请赛 AC自动机 DFA
- 2012长春现场赛b Bit Magic
- 2012 chengdu现场赛 Browsing History HDU4464(简单字符串)
- 第37届ACM/ICPC 金华赛区现场赛最水四道题 HDU 4442 Physical Examination HDU 4450 Draw Something HDU 4451 Dressing HDU 4452 Running Rabbits
- HDU 4445 Crazy Tank (2012年金华赛区现场赛D题)