⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dongtaiguihua.java

📁 算法分析实验 java实现: 有: 公约数 合并算法 字符排序 快速排序 马踏棋盘问题 马踏棋盘问题(文本做法) 折半查找 最大子段和
💻 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 + -