版权声明:原创,未经作者允许禁止转载 https://blog.csdn.net/Mr_wuyongcong/article/details/86624454
前言
划水
成绩
是有算别人的
正题
T1之前做过就直接放连接了
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/82501562
艰难的选择【差分,统计】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86624013
人品问题【树形 】
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/86624067
T1暴力
#include<cstdio>
#define ll long long
using namespace std;
ll x,y,ans;
int main()
{
freopen("data.in","r",stdin);
freopen("data.ans","w",stdout);
scanf("%lld%lld",&x,&y);
for(ll i=1;i<=y;i++)
ans+=x%i;
printf("%lld",ans);
}
T1随机数据
#include<cstdio>
#include<cstdlib>
#include<ctime>
#define random(x) rand()*rand()%x+1
using namespace std;
int main()
{
freopen("data.in","w",stdout);
srand(time(0));
printf("%d %d",random(1000000),random(1000000));
}
T2暴力
#include<cstdio>
#include<algorithm>
using namespace std;
int n,x[1010],sum[1010],ans;
int main()
{
freopen("data.in","r",stdin);
freopen("data.ans","w",stdout);
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&x[i]);
sum[i]=sum[i-1]+x[i]*2-1;
}
for(int i=1;i<=n;i++){
for(int j=i;j<=n;j++){
if(!(sum[j]-sum[i-1]))
ans=max(ans,j-i+1);
}
}
printf("%d",ans);
}
T2随机数据
#include<cstdio>
#include<cstdlib>
#include<ctime>
#define random(x) rand()*rand()%x+1
using namespace std;
int main()
{
freopen("data.in","w",stdout);
srand(time(0));
printf("100000\n");
for(int i=1;i<=100000;i++)
printf("%d ",rand()%2);
}
尾声
竟然用 切掉了 。