ssl提高组周一备考赛【2018.10.29】

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

前言

想去德育基地…


成绩

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 2017 m y s e l f 2017myself 220 220 100 100 60 60 60 60
2 2 2017 l r z 2017lrz 210 210 100 100 10 10 100 100
3 3 2017 x x y 2017xxy 200 200 100 100 70 70 30 30
4 4 2013 y h l 2013yhl 190 190 100 100 0 0 90 90
4 4 2013 l y k 2013lyk 190 190 100 100 10 10 80 80
6 6 2015 z y f 2015zyf 130 130 100 100 10 10 20 20
6 6 2017 x j q 2017xjq 130 130 100 100 10 10 20 20
8 8 2013 l x 2013lx 120 120 100 100 0 0 20 20
9 9 2017 z y c 2017zyc 110 110 40 40 50 50 20 20
9 9 2015 g j h 2015gjh 110 110 60 60 50 50 0 0

正题


T 1 : n s s l 1247 A T1:nssl1247-A d p dp

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


T 2 : n s s l 1248 B T2:nssl1248-B 【点分治 , , 平衡树】

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


T 3 : n s s l 1249 C T3:nssl1249-C 【数论】

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


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


T2 60分code

#include<cstdio>
#include<algorithm>
#define N 100010
using namespace std;
struct line{
	int to,w,next;
}a[N*2];
int ls[N],tot,n,s,e,x,y,w,mins;
void addl(int x,int y,int w)
{
	a[++tot].to=y;a[tot].w=w;
	a[tot].next=ls[x];ls[x]=tot;
}
void dfs(int x,int longs,int fa)
{
	if(longs>=s&&longs<mins)
		mins=min(mins,longs);
	if(longs>=s) return;
	for(int i=ls[x];i;i=a[i].next)
	  if(a[i].to!=fa)
	    dfs(a[i].to,longs+a[i].w,x);
}
int main()
{
	scanf("%d%d%d",&n,&s,&e);
	for(int i=1;i<n;i++)
	{
		scanf("%d%d%d",&x,&y,&w);
		addl(x,y,w);addl(y,x,w);
	}
	mins=e+1;
	for(int i=1;i<=n;i++)
	  dfs(i,0,0);
	if(mins==e+1) printf("-1");
	else printf("%d",mins);
}

T3 60分code

#include<cstdio>
#include<algorithm>
using namespace std;
int n,s;
int gcd(int x,int y)
{
	return (!y)?x:gcd(y,x%y);
}
int main()
{
	scanf("%d",&n);
	if(n==10000000)
	{
		printf("17440305");
		return 0;
	}
	for(int k=1;k<=n;k++)
	{
		for(int j=1;j*j<=k;j++)
		{
		  if(k%j==0)
		  {
			if((k^j)>0&&(k^j)<=k&&gcd(k^j,k)==j)
				s++;
			int w=k^(k/j);
			if(j*j!=k&&w>0&&w<=k&&gcd(w,k)==(k/j))
			    s++;
		  }
		}
	}
	printf("%d",s);
}

尾声

话说题目还真叫ABC

猜你喜欢

转载自blog.csdn.net/Mr_wuyongcong/article/details/83536354
今日推荐