2018 Multi-University Training Contest 6
Posted aguin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2018 Multi-University Training Contest 6相关的知识,希望对你有一定的参考价值。
不知不觉拖欠了两周阿哈哈哈哈或
1001 oval-and-rectangle
谈学姐最喜欢积分了 不写SPJ最牛逼了
1 #include<bits/stdc++.h> 2 using namespace std; 3 long long T,a,b,i,j,k,s,t; 4 double ans,temp=asin(1.0); 5 int main() 6 { 7 scanf("%lld",&T); 8 while (T--) 9 { 10 scanf("%lld%lld",&a,&b); 11 ans=2*b+2*a*temp; 12 s=(long long) (ans*1000000); 13 ans=s*0.000001; 14 printf("%.6f ",ans); 15 } 16 }
1002 bookshelf
1003 Ringland
1004 Shoot Game
1005 black-and-white
1006 foam-transformation
1007 Variance-MST
1008 Rectangle Outline
1009 Werewolf
其实窝感觉这题还是有点意思的,就是$Clar$里一堆人不懂题意……
首先第一个数肯定是$0$,就当大家说的都是废话没事发生过
然后铁狼只有唯一的情况,就是某人$A$指认狼$B$,被指认人$B$却通过一串民直接或间接指认$A$为民,那么$B$和所有直接间接指认$B$为民的都是狼
只要对所有指民的边反向建图,以每个指狼的为起点反向随便遍历两边就好了
1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 1e5 + 10; 4 vector<int> G[maxn]; 5 int a[maxn]; 6 7 bool dfs(int x, int tar) { 8 if(x == tar) return true; 9 for(int i = 0; i < G[x].size(); ++i) { 10 int to = G[x][i]; 11 if(dfs(to, tar)) return true; 12 } 13 return false; 14 } 15 16 int rdfs(int x) { 17 int ret = 1; 18 for(int i = 0; i < G[x].size(); ++i) { 19 int to = G[x][i]; 20 ret += rdfs(to); 21 } 22 return ret; 23 } 24 25 int main() { 26 int T; 27 scanf("%d", &T); 28 while(T--) { 29 int N; 30 scanf("%d", &N); 31 for(int i = 1; i <= N; ++i) G[i].clear(); 32 for(int i = 1; i <= N; ++i) { 33 int x; 34 char s[11]; 35 scanf("%d %s", &x, s + 1); 36 if(s[1] == ‘w‘) a[i] = x; 37 else { 38 a[i] = 0; 39 G[x].push_back(i); 40 } 41 } 42 int ans = 0; 43 for(int i = 1; i <= N; ++i) { 44 if(a[i] == 0) continue; 45 if(dfs(i, a[i])) ans += rdfs(a[i]); 46 } 47 printf("0 %d ", ans); 48 } 49 return 0; 50 }
1010 Chopping hands
1011 sacul
1012 Pinball
梦回糕烤
1 #include<bits/stdc++.h> 2 using namespace std; 3 long long T,i,j,k,s; 4 double a,b,vx,vy,x,y,g=9.8,ans,temp,t,x2,y2,angle1,angle2,vv; 5 int main() 6 { 7 scanf("%lld",&T); 8 while (T--) 9 { 10 scanf("%lf%lf%lf%lf",&a,&b,&x,&y); 11 angle1=atan(b/a); 12 vx=vy=0; 13 s=0; 14 while (true) 15 { 16 t=a*vy+b*vx; 17 temp=t+sqrt(t*t+2*a*g*(a*y+b*x)); 18 temp=temp/(a*g); 19 x2=x+vx*temp;y2=y+vy*temp-0.5*g*temp*temp; 20 if (x2>=0) break; else s++; 21 vy=vy-temp*g; 22 angle2=atan(-vx/vy); 23 temp=acos(-1.0)*0.5-2*angle1-angle2; 24 vv=sqrt(vx*vx+vy*vy); 25 vx=vv*cos(temp); 26 vy=vv*sin(temp); 27 x=x2;y=y2; 28 } 29 printf("%lld ",s); 30 } 31 }
以上是关于2018 Multi-University Training Contest 6的主要内容,如果未能解决你的问题,请参考以下文章
2018 Multi-University Training Contest 2
2018 Multi-University Training Contest 9
2018 Multi-University Training Contest 4
2018 Multi-University Training Contest 4