栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

浙江省赛2022

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

浙江省赛2022

G - Easy Glide

import java.io.*;
import java.util.*;
public class Main
{
	static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
	static PrintWriter out = new PrintWriter(System.out);
	static int inn() throws IOException
	{
		st.nextToken();
		return (int) st.nval;
	}
	static double idd() throws IOException
	{
		st.nextToken();
		return st.nval;
	}
	static int n=0;
    static int m=0;
    static int N=15000000;
    static int h[]=new int[N];
    static int ne[]=new int[N];
    static int e[]=new int[N];
    static double w[]=new double[N];
    static boolean vis[]=new boolean[N];
    static double d[]=new double[N];
    static int idx=0;
    static double inf=Long.MAX_VALUE;
    static int bx;
    static int fx;
	public static void main(String[] args) throws IOException
	{
		Scanner s = new Scanner(System.in);
		int n=s.nextInt();
		num num[]=new num[n+3];
		for(int i=2;i<=n+1;i++)
			num[i]=new num(s.nextDouble(),s.nextDouble());
		num[1]=new num(s.nextDouble(),s.nextDouble());
		num[n+2]=new num(s.nextDouble(),s.nextDouble());
		bx=s.nextInt();
		fx=s.nextInt();
		Arrays.fill(h,-1);
		for(int i=2;i<=n+1;i++)
			for(int j=1;j<=n+2;j++)
				if(i!=j)
					add(i,j,js(num[i],num[j]));
		for(int i=2;i<=n+2;i++)
			add(1,i,js2(num[1],num[i]));
		dijkstra();
		System.out.printf("%.8f",d[n+2]);
		System.out.println();
	}
	static double js(num a,num b)
	{
		double jl=Math.sqrt(Math.pow(a.x-b.x, 2)+Math.pow(a.y-b.y, 2));
		if(jl<=fx*3)
			return jl/fx;
		else 
			return 3+(jl-fx*3)/bx;
	}
	static double js2(num a,num b)//起点的花费的时间
	{
		double jl=Math.sqrt(Math.pow(a.x-b.x, 2)+Math.pow(a.y-b.y, 2));
		return jl/bx;

	}
	static void dijkstra()
    {
        PriorityQueueheap=new PriorityQueue();
        Arrays.fill(d,inf);
        d[1]=0;
        heap.add(new PII(1,0));
        while(!heap.isEmpty())
        {
            PII t=heap.poll();
            if(vis[t.id]==true)continue;
            vis[t.id]=true;
            for(int i=h[t.id];i!=-1;i=ne[i])
            {
                int j=e[i];
                if(d[j]>t.cd+w[i])
                {
                    d[j]=t.cd+w[i];
                    heap.add(new PII(j,d[j]));
                }
            }
        }
    }
	static void add(int a,int b,double z)
    {
        e[idx]=b;
        w[idx]=z;
        ne[idx]=h[a];
        h[a]=idx++;
    }
}
class PII implements Comparable
{
    int id;
    double cd;
    public PII(int id,double cd)
    {
        this.id=id;
        this.cd=cd;
    }

    public int compareTo(PII other)//按照从小到大排序
    {
        if(this.cd>other.cd)
        {
        	return 1;
        }if(this.cd 

L - Candy Machine

import java.io.*;
import java.util.*;
public class Main
{
	static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
	static PrintWriter out = new PrintWriter(System.out);
	static int inn() throws IOException
	{
		st.nextToken();
		return (int) st.nval;
	}
	static double idd() throws IOException
	{
		st.nextToken();
		return st.nval;
	}
	public static void main(String[] args) throws IOException
	{
		Scanner s = new Scanner(System.in);
		int n=inn();
		double a[]=new double[n];
		double sum=0;
		double avg=0;
		for(int i=0;i>1;
		while(l>1;
			if(a[mid]>key)r=mid;
			else
				l=mid+1;
		}
		return r;
	}
}


M - BpbBppbpBB

import java.io.*;
import java.util.*;
public class Main
{
	static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
	static PrintWriter out = new PrintWriter(System.out);
	static int inn() throws IOException
	{
		st.nextToken();
		return (int) st.nval;
	}
	static double idd() throws IOException
	{
		st.nextToken();
		return st.nval;
	}
	public static void main(String[] args) throws IOException
	{
		Scanner s = new Scanner(System.in);
		int n=s.nextInt();
		int m=s.nextInt();
		char a[][]=new char[n+10][];
		for(int i=0;i 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/893718.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号