牛客编程题(六)

//https://www.nowcoder.com/practice/48f89fcc444c4e00a2465b02dd8cc7e2?tpId=107&&tqId=33403&rp=1&ru=/ta/beginner-programmers&qru=/ta/beginner-programmers/question-ranking

import java.io.IOException;
import java.util.Scanner;

public class Main4 {
	public static void main(String[] args)throws IOException {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			double x1 = sc.nextDouble();
			double x2 = sc.nextDouble();
			double x3 = sc.nextDouble();
			double sum = x1+x2+x3;
			double average = sum/3;
			System.out.println(String.format("%.2f", sum)+" "+String.format("%.2f", average));
		}
	
		
	}
	

}

//https://www.nowcoder.com/practice/ae6a21920cac4f9184c8ecfcc87f89b9?tpId=107&tqId=33403&rp=1&ru=%2Fta%2Fbeginner-programmers&qru=%2Fta%2Fbeginner-programmers%2Fquestion-ranking

import java.util.Arrays;
import java.util.Scanner;

public class Main5 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int[] array = new  int[4];
			for(int i=0;i<4;i++) {
				array[i] = sc.nextInt();
			}
			Arrays.sort(array);
			System.out.println(array[array.length-1]);
		}
	}

}

//https://www.nowcoder.com/practice/cc896ffd90d34c7faa318b04e87adf11?tpId=107&tqId=33403&rp=1&ru=%2Fta%2Fbeginner-programmers&qru=%2Fta%2Fbeginner-programmers%2Fquestion-ranking

import java.util.Scanner;

public class Main6 {
	public static void main(String[] args) {
		Scanner sc = new  Scanner(System.in);
		while(sc.hasNext()) {
			int x1 = sc.nextInt();
			int x2  =sc.nextInt();
			int x3 = sc.nextInt();
			if(x1+x2+x3>=180) {
				System.out.println("NO");
			}
			else
				System.out.println("YES");
			
		}
	}

}

//https://www.nowcoder.com/practice/c98aeab2362c459dbc840d4c75f07729?tpId=107&&tqId=33409&rp=1&ru=/ta/beginner-programmers&qru=/ta/beginner-programmers/question-ranking

import java.util.Scanner;

public class Main7 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sum = 1;
		int res = 0;
		while(sc.hasNext()) {
			int xx = sc.nextInt();
			for(int i=1;i<=xx;i++) {
					sum*=i;
					res+=sum;
			}
		System.out.println(res);
		}
	}

}

//https://www.nowcoder.com/practice/89238e99c36e450786ccf3a9e7481b7b?tpId=107&tqId=33409&rp=1&ru=%2Fta%2Fbeginner-programmers&qru=%2Fta%2Fbeginner-programmers%2Fquestion-ranking

import java.util.Arrays;
import java.util.Scanner;

public class Main8 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int[] array1 = {a+b,b,c};
			int[] array2 = {a,b+c,c};
			int[] array3 = {a,b,b+c};
			Arrays.sort(array1);
			Arrays.sort(array2);
			Arrays.sort(array3);
			double m =(double) (array1[array1.length-1])/((array2[array2.length-1])+(array3[array3.length-1]));
			System.out.println(String.format("%.2f", m));
		}
	}

}

//https://www.nowcoder.com/practice/57c71982296b45b281838c2a40283c19?tpId=107&&tqId=33408&rp=1&ru=/ta/beginner-programmers&qru=/ta/beginner-programmers/question-ranking

import java.util.Arrays;
import java.util.Scanner;

public class Main9 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int x = sc.nextInt();
			int[] array = new int[x];
			for(int i=0;i<array.length;i++) {
				array[i] = sc.nextInt();
			}
			Arrays.sort(array);
			System.out.println(array[array.length-1]);
		}
		
	}
	

}

//https://www.nowcoder.com/practice/4ef07b4f80fc4027a4b90e2245f8f637?tpId=107&tags=&title=&diffculty=0&judgeStatus=0&rp=1

import java.util.Scanner;

public class Main0 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int x1 = sc.nextInt();
			int x2 = sc.nextInt();
			int x3 = sc.nextInt();
			int x4 = sc.nextInt();
			double res = (x1*0.2)+(x2*0.1)+(x3*0.2)+(x4*0.5);
			System.out.println(String.format("%.1f", res));
			
			
		}
	}

}

//https://www.nowcoder.com/practice/659248911f4f4a60bcc7e0892f91c268?tpId=107&tags=&title=&diffculty=0&judgeStatus=0&rp=1

import java.util.Scanner;

public class Main1 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
		int xx = sc.nextInt();
		for(int i=0;i<xx;i++) {
			System.out.println("Happy new year!Good luck!");
		}
		}
	}

}
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 游动-白 设计师:白松林 返回首页