ssl提高组周六模拟赛【2018.9.22】

版权声明:原创,未经作者允许禁止转载 https://blog.csdn.net/Mr_wuyongcong/article/details/82813944

前言

这周居然考两道数学,反正是我的弱项。然后第一题考试的时候zz了竟然忘了怎么二分


成绩

只放 R a n k   1 10 Rank\ 1\sim10

R a n k Rank P e r s o n Person S c o r e Score A A B B C C
1 1 2015 h j w 2015hjw 210 210 100 100 70 70 40 40
2 2 2017 m y s e l f 2017myself 165 165 20 20 60 60 85 85
3 3 2017 x j q 2017xjq 160 160 0 0 60 60 100 100
4 4 2015 y j y 2015yjy 145 145 100 100 10 10 35 35
5 5 2015 l z x 2015lzx 100 100 100 100 0 0 0 0
6 6 2015 g j h 2015gjh 100 100 0 0 60 60 40 40
7 7 2017 l w 2017lw 55 55 10 10 30 30 15 15
8 8 2015 z z y 2015zzy 55 55 0 0 30 30 25 25
9 9 2015 t r x 2015trx 45 45 0 0 30 30 15 15
10 10 2017 l r z 2017lrz 45 45 0 0 10 10 35 35

正题


T 1 : n s s l 1155 T1:nssl1155- 遨游【二分答案 , S P F A ,SPFA

博客链接:https://blog.csdn.net/Mr_wuyongcong/article/details/82812117


T 2 : n s s l 1156 T2:nssl1156- 今天你 A K AK 了吗 ? ? 【康托展开 , , 高精度 , , 二分答案 , , 树状数组】

博客链接:https://blog.csdn.net/Mr_wuyongcong/article/details/82813059


T 3 : n s s l 1157 T3:nssl1157- 简单数学题【约数 , , 换元法】

博客链接:https://blog.csdn.net/Mr_wuyongcong/article/details/82813365


s o m e   o f   c o d e some\ of\ code


T1-70分代码

#include<cstdio>
#include<algorithm>
#include<queue>
#define M 100010
#define N 50010
using namespace std;
struct line{
	int from,to;
	double w;
	int next;
}a[M*2];
struct node{
	double l,r;
}f[N];
queue<int> q;
int n,m,x,y,w,tot,ans;
int ls[N],mark[N],h[N],s,t;
bool v[N];
void addl(int x,int y,double w)
{
	a[++tot]=(line){x,y,w,ls[x]};ls[x]=tot;
	a[++tot]=(line){y,x,w,ls[y]};ls[y]=tot;
}
void spfa()
{
	q.push(s);v[s]=true;
	for(int i=1;i<=ans;i++)
	  f[i]=(node){0,2147483647};
	f[s]=(node){2147483647,0};
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		for(int i=ls[x];i;i=a[i].next)
		{
			int y=a[i].to;
			if(min(f[x].l,a[i].w)>f[y].l||
			(min(f[x].l,a[i].w)==f[y].l&&
			max(f[x].r,a[i].w)<f[y].r))
			{
				f[y]=(node){min(f[x].l,a[i].w),max(f[x].r,a[i].w)};
				if(!v[y])
				{
					v[y]=true;
					q.push(y);
				}
			}
		}
		v[x]=false;
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d%d",&x,&y,&w);
		addl(x,y,w);
	}
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&t);
		ans+=t;
		for(int j=1;j<=t;j++)
		{
			scanf("%d",&x);
			mark[x]=i;
		}
	}
	for(int i=1;i<=n;i++)
		scanf("%d",&h[i]);
	for(int i=1;i<=tot;i++)
	{
		x=mark[a[i].from];y=mark[a[i].to];
		a[i].w*=(h[x]+h[y])/2.0/100.0;
	}
	scanf("%d%d",&s,&t);
	spfa();
	double R=f[t].r;
	if(R-(int)R>0) R++;
	printf("%d %d\n",(int)f[t].l,(int)R);
}

T2-60分代码

#include<cstdio>
using namespace std;
long long n,k,tot,nI,a[19];
int main()
{
	scanf("%lld%lld",&n,&k);nI=1;
	for(int i=1;i<n;i++)
		nI=nI*i;
	for(int i=1;i<=n;i++)
	  a[i]=i;
	tot=n;
	for(int i=1;i<=n;i++)
	{
		int wz=(k-1)/nI+1;
		printf("%lld ",a[wz]);
		if(i==n) break;
		for(int j=wz;j<tot;j++)
		  a[j]=a[j+1];
		k=(k-1)%nI+1;
		tot--;
		nI/=tot;
	}
}

尾声

明天见

猜你喜欢

转载自blog.csdn.net/Mr_wuyongcong/article/details/82813944