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

📄 1.txt

📁 针对java语言的最简词法分析器 输入原文件输出目标文件。txt
💻 TXT
字号:
package w;

public class Hello {

	public static void main(String[] args) {	
		int N;	
		N=5;

		for(int t=0;t<N;t++){
		int i,j,k,n;
		float []wc=new float[1500];
		float []sc=new float[1500];
		float []time=new float[1500];
		float lb,wb;
		float weight,time1,speed,t1,t2=0;
		wb=1;
		lb=3;
		n=4;
		for(i=1;i<=n;i++){				
			wc[i]=i;
			sc[i]=100-i;
		}
		time[0]=0;
		time[1]=lb/sc[1];

		for(i=2;i<=n;i++){
			weight=0;
			time1=1000000;
			speed=1000000;
			k=1;
			j=i+1;
			
			while(k!=0){
				j--;
				if((weight+wc[j])<=wb){
					weight+=wc[j];
					if(sc[j]<speed){
						speed=sc[j];
					}
				}
				else{
					k=0;
				}
				if(k!=0){
					t2=(lb/speed);
					t1=t2+time[j-1];
					if(t1<time1){
						time1=t1;
					}
					if(j==1){
						k=0;
					}
				}
			}
			time[i]=time1;
		}
		System.out.print(time[n]*60f);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -