前言
有回来做BBB组了,话说第3道题就是AAA组第一道。
成绩
RankRankRank是有算别人的
今天XJQXJQXJQ不在
RankRankRank | PersonPersonPerson | ScoreScoreScore | AAA | BBB | CCC |
---|---|---|---|---|---|
111 | 2017wyc2017wyc2017wyc | 270270270 | 100100100 | 100100100 | 707070 |
101010 | 2017hjq2017hjq2017hjq | 130130130 | 100100100 | 303030 | 000 |
101010 | 2017zyc2017zyc2017zyc | 130130130 | 100100100 | 303030 | 000 |
161616 | 2017xxy2017xxy2017xxy | 120120120 | 100100100 | 202020 | 000 |
393939 | 2017lw2017lw2017lw | 303030 | 000 | 303030 | 000 |
464646 | 2017hzb2017hzb2017hzb | 202020 | 000 | 202020 | 000 |
464646 | 2017lrz2017lrz2017lrz | 202020 | 000 | 202020 | 000 |
正题
T1:jzoj4229−T1:jzoj4229-T1:jzoj4229−学习神技【逆元,,,费马小定理】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86561722
T2:jzoj4230−T2:jzoj4230-T2:jzoj4230−淬炼神体【0/10/10/1分数规划】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86561780
T3:jzoj4231−T3:jzoj4231-T3:jzoj4231−寻找神格【线段树,,,数学】
神TM这道题有SPJ,让我输出3位小数,输出到10位就过了
誓死力争,还我AK!
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86561899
someofcodesome\ of\ codesome of code
T2暴力
#include<cstdio>
#include<algorithm>
using namespace std;
int n,k,a[16],b[16];
double ans;
int v[16];
double check()
{int sum_a=0,sum_b=0;for(int i=1;i<=n;i++)if(v[i]) sum_a+=a[i],sum_b+=b[i];return (double)sum_a/sum_b;
}
void dfs(int dep,int c){if(c==k){ans=max(check(),ans);if(ans>=2000)ans++,ans--;check();return;}if(dep>n) return;v[dep]=1;dfs(dep+1,c+1);v[dep]=0;dfs(dep+1,c);
}
int main()
{freopen("data.in","r",stdin);freopen("data.anss","w",stdout);scanf("%d%d",&n,&k);for(int i=1;i<=n;i++)scanf("%d",&a[i]);for(int i=1;i<=n;i++)scanf("%d",&b[i]);dfs(1,0);printf("%0.3lf",ans);
}
T2随机数据
#include<cstdlib>
#include<algorithm>
#include<cstdio>
#include<ctime>
#define random(x) rand()%x+1
using namespace std;
int main()
{freopen("data.in","w",stdout);srand(time(0));printf("15 %d\n",random(15));for(int i=1;i<=15;i++)printf("%d ",random(1000));printf("\n");for(int i=1;i<=15;i++)printf("%d ",random(1000));
}
T3暴力
#include<cstdio>
#define ll long long
using namespace std;
ll n,m,p[5010];
int main()
{//freopen("data.in","r",stdin);//freopen("data.ans","w",stdout);scanf("%lld%lld",&n,&m);for(ll i=1;i<=n;i++)scanf("%lld",&p[i]);for(ll i=1;i<=m;i++){ll t,a,b;scanf("%lld%lld%lld",&t,&a,&b);if(t==0) p[a]+=b;else if(t==1){ll z;scanf("%lld",&z);for(ll i=a;i<=b;i++)p[i]+=z;}else if(t==2){ll ans=0;for(ll i=a;i<=b;i++)ans+=p[i];printf("%lld\n",ans);}else{double n=(b-a+1),ans=0,sum=0;for(ll i=a;i<=b;i++)sum+=p[i];sum/=n;for(ll i=a;i<=b;i++)ans+=(double(p[i])-sum)*(double(p[i])-sum);ans/=n;printf("%0.3lf\n",ans);}}
}
T3随机数据
#include<cstdio>
#include<ctime>
#include<cstdlib>
#include<algorithm>
using namespace std;
int n,m,k;
int main()
{srand(time(0));//freopen("data.in","w",stdout);n=5;m=5;k=10;printf("%d %d\n",n,m);for(int i=1;i<=n;i++)printf("%d ",rand()%k*2-k);printf("\n");for(int i=1;i<=n;i++){int t=rand()%4,a=rand()%n+1,b=rand()%n+1;printf("%d ",t);if(a>b) swap(a,b);if(t==0)printf("%d %d\n",a,rand()%k*2-k);else if(t==1) printf("%d %d %d\n",a,b,rand()%k*2-k);else if(t==2)printf("%d %d\n",a,b);else printf("%d %d\n",a,b);}
}
尾声
誓死力争,还我AK!