QFNU-ACM 2020.4.11 组队赛|QFNU-ACM 2020.04.12个人赛
作者:互联网
组队:
H:
#include<iostream> #include<cstdio> #include<set> #include<queue> #include<stack> #include<vector> #include<bitset> #include<cstring> #include<string> #include<algorithm> #include<cmath> using namespace std; typedef long long ll; const int MAXN=1e5+10; int a,b,l,r,mid,flag=0; int main(){ while(scanf("%d",&a)!=EOF){ if(a%2) printf("0\n"); else printf("1\n"); } return 0; }
I
#include<iostream> #include<cstdio> #include<set> #include<queue> #include<stack> #include<vector> #include<bitset> #include<cstring> #include<string> #include<algorithm> #include<cmath> #define PI 3.1415927 using namespace std; typedef long long ll; const int MAXN=1e5+10; int a,r,mid,flag=0; double area,l,b; int main(){ while(scanf("%d %lf",&a,&b)!=EOF){ area=0; for(int i = 1;i <= a;i++){ scanf("%lf",&l); area += sin(l*PI/180)*b*b/2; } printf("%.3f\n",area); } return 0; }
J:
#include<iostream> #include<cstdio> #include<set> #include<queue> #include<stack> #include<vector> #include<bitset> #include<cstring> #include<string> #include<algorithm> #include<cmath> #define PI 3.1415927 using namespace std; typedef long long ll; const int MAXN=1e5+10; int a,r,mid,flag=0,l; ll ss; int main(){ while(scanf("%d ",&a)!=EOF){ r=0; for(int i = 1;i <= a;i++){ cin>>ss; for(int j=0;j<4;j++){ if(ss%256==97) r++; ss>>=8; } } printf("%d\n",r); } return 0; }
个人赛
A
#include<iostream> #include<cstdio> #include<set> #include<queue> #include<stack> #include<vector> #include<bitset> #include<cstring> #include<string> #include<algorithm> using namespace std; typedef long long ll; const int MAXN=1e5+10; inline int read(){ int x=0,y=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-'){ y=-1; } ch=getchar(); } while(ch>='0'&&ch<='9'){ x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); } return x*y; } struct book{ int index,x; }g[MAXN]; bool cmp(struct book z, struct book y){ return z.x < y.x; } int main(){ int n,a[MAXN],flag=0; n=read(); if(n==1){ printf("-1\n"); return 0; } if(n==2) flag=1; for(int i = 1;i<=n;i++){ g[i].x=read(); g[i].index=i; } sort(g+1,g+1+n,cmp); if(flag){ if(g[1].x==g[2].x){ printf("-1\n"); return 0; } } printf("%d\n",n-1); for(int i = 2;i<=n;i++){ if(i!=2) printf(" "); printf("%d",g[i].index); } return 0; }
B:
#include<iostream> #include<cstdio> #include<set> #include<queue> #include<stack> #include<vector> #include<bitset> #include<cstring> #include<string> #include<algorithm> using namespace std; typedef long long ll; const int MAXN=1e5+10; inline int read(){ int x=0,y=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-'){ y=-1; } ch=getchar(); } while(ch>='0'&&ch<='9'){ x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); } return x*y; } struct book{ int index,x; }g[MAXN]; bool cmp(struct book z, struct book y){ return z.x < y.x; } int main(){ int n,m,a[MAXN],p=0,res=0,in=0,count[MAXN]; n=read();m=read(); for(int i = 1; i <= n;i++){ a[i]=read(); } for(int i = 1;i <= n;i++){ if(a[i]%2){ p++; } else{ p--; } if(p==0&&i!=n){ count[in++] += abs(a[i+1]-a[i]); } } int i=0; sort(count,count+in); while(i<in){ m -= abs(count[i]); if(m<0){ break; } i++; res++; } cout<<res<<endl; return 0; }
D
#include<iostream> #include<cstdio> #include<set> #include<queue> #include<stack> #include<vector> #include<bitset> #include<cstring> #include<string> #include<algorithm> using namespace std; typedef long long ll; const int MAXN=1e5+10; inline int read(){ int x=0,y=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-'){ y=-1; } ch=getchar(); } while(ch>='0'&&ch<='9'){ x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); } return x*y; } struct book{ int index,x; }g[MAXN]; bool cmp(struct book z, struct book y){ return z.x < y.x; } int main(){ int n,a[MAXN],count=2,m; n=read();m=read(); for(int i = 1;i<=n;i++){ a[i]=read(); if(i!=1){ if((a[i]-a[i-1])/m==2&&(a[i]-a[i-1])%m==0){ count+=1; } else if((a[i]-a[i-1]-1)/m>1){ count+=2; } } } cout<<count<<endl; return 0; }
E
#include<iostream> #include<cstdio> #include<set> #include<queue> #include<stack> #include<vector> #include<bitset> #include<cstring> #include<string> #include<algorithm> using namespace std; typedef long long ll; const int MAXN=1e5+10; inline int read(){ int x=0,y=1; char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-'){ y=-1; } ch=getchar(); } while(ch>='0'&&ch<='9'){ x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); } return x*y; } struct book{ int l,r; }g[MAXN]; bool cmp(struct book z, struct book y){ if(z.l==y.l) return z.r < y.r; return z.l < y.l; } int main(){ int n, m,p=0,a[MAXN]; n=read();m=read(); memset(a,-1,sizeof(a)); for(int i=0;i<m;i++){ g[i].l=read();g[i].r=read(); } for(int i=0;i<n;i++){ printf("%d",p); if(p==0) p=1; else p=0; } return 0; }
标签:11,QFNU,ch,int,ll,ACM,while,long,include 来源: https://www.cnblogs.com/aixiaodezsh/p/12725879.html