📄 dongtaiguihua.java
字号:
import javax.swing.JOptionPane;
public class dongtaiguihua{
public static void main(String[] args)
{
String LengthString=JOptionPane.showInputDialog(null,"pleae inout the zuduan's length","The experice",JOptionPane.QUESTION_MESSAGE);
int Length=Integer.parseInt(LengthString);
float[] ziduan=new float[Length];
for(int m=0;m<Length;m++)
{
String WorthString=JOptionPane.showInputDialog(null,"pleae inout the zuduan's worth","The experice",JOptionPane.QUESTION_MESSAGE);
float Worth=Float.parseFloat(WorthString);
ziduan[m]=Worth;
}
String s1=" ";
for(int k=0;k<Length;k++)
{
s1=s1+" "+ziduan[k];
}
JOptionPane.showMessageDialog(null,s1,"输入的字段:",JOptionPane.INFORMATION_MESSAGE);
int max3=max_sub3(ziduan,Length);
JOptionPane.showMessageDialog(null,max3,":",JOptionPane.INFORMATION_MESSAGE);
// max_sub3(ziduan,Length);
}
public static int max_sub3(float a[], int size)
{
int i,max=0,temp_sum=0;
for(i=0;i<size;i++)
{
temp_sum+=a[i];
if(temp_sum>max)
max=temp_sum;
else if(temp_sum<0)
temp_sum=0;
}
return max;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -