考虑: 因此偶数可以任选,但是奇数必须保证偶数个,因此先选出所有偶数接着对奇数排序,选尽量大的偶数个即可 因为有偶数个点,而且上下两个圆平面中心连线一定为某坐标轴,因此该中线将点的该轴坐标分为两部分,那么我们枚举三种坐标找到该轴 最后只需求出一个正多边形上某点到其他点最大距离为上下底面半径(下面好像有点问题,我也看不太懂了) 经典题,一般是用栈来做的,但是这个字符串必须保证顺序,那么我们用栈的思想,维护n个队列也行
A-Alice的难题
B-卡牌对战游戏
C-HW的糖果俱乐部(签到)
#include <set> #include <map> #include <stack> #include <queue> #include <math.h> #include <cstdio> #include <string> #include <bitset> #include <cstring> #include <sstream> #include <iostream> #include <algorithm> #include <unordered_map> using namespace std; #define fi first #define se second #define pb push_back #define ins insert #define lowbit(x) (x&(-x)) #define mkp(x,y) make_pair(x,y) #define mem(a,x) memset(a,x,sizeof a); typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int,int> P; const double eps=1e-8; const double pi=acos(-1.0); const int inf=0x3f3f3f3f; const ll INF=1e18; const int Mod=1e9+7; const int maxn=2e5+10; int main(){ //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); int n; cin>>n; ll sum=0; vector<int> res; for(int i=1,x;i<=n;i++){ cin>>x; if(x&1) res.push_back(x); else sum+=x; } sort(res.begin(),res.end()); int k=res.size(); if(k&1){ for(int i=1;i<k;i++) sum+=res[i]; }else{ for(int i=0;i<k;i++) sum+=res[i]; } cout<<sum<<endl; return 0; }
E-有趣的圆柱体(暴力)
#include <set> #include <map> #include <stack> #include <queue> #include <math.h> #include <cstdio> #include <string> #include <bitset> #include <cstring> #include <sstream> #include <iostream> #include <algorithm> #include <unordered_map> using namespace std; #define fi first #define se second #define pb push_back #define ins insert #define lowbit(x) (x&(-x)) #define mkp(x,y) make_pair(x,y) #define mem(a,x) memset(a,x,sizeof a); typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int,int> P; const double eps=1e-8; const double pi=acos(-1.0); const int inf=0x3f3f3f3f; const ll INF=1e18; const int Mod=1e9+7; const int maxn=2e5+10; int t,n; double h1,h2; double x[105],y[105],z[105]; inline int dcmp(double d){ if(fabs(d)<eps) return 0; return d>0?1:-1; } bool check(double *d){ for(int i=1;i<=2*n;i++){ int cnt=0; for(int j=1;j<=2*n;j++) if(dcmp(d[j]-d[i])==0) cnt++; if(cnt==n){ h1=d[i]; for(int j=1;j<=2*n;j++) if(d[j]!=d[i]){ h2=d[j]; break; } return 1; } } return 0; } double dis(double x1,double y1,double x2,double y2){ return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); } int main(){ //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); //ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); scanf("%d",&t); while(t--){ scanf("%d",&n); for(int i=1;i<=2*n;i++) scanf("%lf%lf%lf",&x[i],&y[i],&z[i]); if(check(x)){ double h=fabs(h1-h2); double r=0.0; for(int i=1;i<=2*n;i++) r=max(r,dis(y[1],z[1],y[i],z[i])); r/=2.0; double v=pi*r*r*h; printf("%.6fn",v); }else if(check(y)){ double h=fabs(h1-h2); double r=0.0; for(int i=1;i<=2*n;i++) r=max(r,dis(x[1],z[1],x[i],z[i])); r/=2.0; double v=pi*r*r*h; printf("%.6fn",v); }else if(check(z)){ double h=fabs(h1-h2); double r=0.0; for(int i=1;i<=2*n;i++) r=max(r,dis(x[1],y[1],x[i],y[i])); r/=2.0; double v=pi*r*r*h; printf("%.6fn",v); } } return 0; }
G-字符串解压(栈)
#include <set> #include <map> #include <stack> #include <queue> #include <math.h> #include <cstdio> #include <string> #include <bitset> #include <cstring> #include <sstream> #include <iostream> #include <algorithm> #include <unordered_map> using namespace std; #define fi first #define se second #define pb push_back #define ins insert #define lowbit(x) (x&(-x)) #define mkp(x,y) make_pair(x,y) #define mem(a,x) memset(a,x,sizeof a); typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int,int> P; const double eps=1e-8; const double pi=acos(-1.0); const int inf=0x3f3f3f3f; const ll INF=1e18; const int Mod=1e9+7; const int maxn=2e5+10; queue<string> s[205]; int a[maxn]; int main(){ //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); string str; while(cin>>str){ int x=0; for(int i=0;i<str.size();i++){ if(str[i]>='0' && str[i]<='9'){ a[++x]=str[i]-'0'; i++; }else if(isalpha(str[i])){ string res=""; res+=str[i]; s[x].push(res); }else if(str[i]==']'){ string res=""; while(s[x].size()){ res+=s[x].front(); s[x].pop(); } string ans=""; for(int j=1;j<=a[x];j++) ans+=res; x--; s[x].push(ans); } } string ans=""; while(s[0].size()){ ans+=s[0].front(); s[0].pop(); } cout<<ans<<endl; } return 0; }
H-和平精英
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算