有哪位大佬有ac的代码吗?80分,不知道哪里挂了
查看原帖
有哪位大佬有ac的代码吗?80分,不知道哪里挂了
441248
19moyudaren楼主2022/3/22 19:36
public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		long n=in.nextLong();
		long res=0;
		long a=in.nextLong(),b=in.nextLong(),c=in.nextLong();
		c=Math.min(c, n);
		if(a>1) {
			if(c<n) {
				res=n+n-1;
			}else {
				res=2*n+b-a;
			}
		}else{
			if(c<n) {
				res=n+c+n-1;
			}else {
				res=3*n+b-2;
			}
		}
		System.out.println(res);
		in.close();
	}
2022/3/22 19:36
加载中...