zoom3-26-笔试
public class Zoom01 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNextLine()){
String[] s = sc.nextLine().split(",");
double[] nums = new double[s.length];
for(int i=0;i<s.length;i++){
nums[i] = Double.parseDouble(s[i]);
}
System.out.println(Arrays.toString(nums));
System.out.println(getMax(nums));
}
}
public static double getMax(double[] nums){
/**
* -3,1,0,6,0.9,8,-2
* 43.2
* 使用dp来记录第i位包括为底的乘积最大子数组
*/
if(nums.length==0) return 0;
if(nums.length==1) return nums[1];
int n = nums.length;
double[] dp = new double[n+1];
dp[0] = 1;
double max = 0;
for(int i=1;i<n+1;i++){
dp[i] = Math.max(dp[i-1]*nums[i-1],nums[i-1]);
max = Math.max(dp[i],max);
}
return max;
}
} import java.util.Scanner;
/**
* @description:
* @author: tkcz
* @time: 2022/3/26 20:47
*/
public class Zoom02 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int m = sc.nextInt();
int n = sc.nextInt();
int[][] graph = new int[m][n];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
graph[i][j] = sc.nextInt();
}
}
System.out.println(minTravesal(graph));
}
}
public static int getMin(int s,int x,int z,int y){
int a = Math.min(s,x);
int b = Math.min(z,y);
return Math.min(a,b);
}
public static int minTravesal(int[][] graph){
int m = graph.length;
int n = graph[0].length;
int[][] road = new int[m][n];
road[0][0] = graph[0][0];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
if(graph[i][j]==0){
road[i][j]=0;
1个小时,第二大题代码还没贴上去,服了,选择题就该放弃的
#Zoom##ZOOM##笔经#