import java.util.Scanner;
public class qinhuangSun {
public static void main(String[] args) {
int i, j, xx = 0;
int x[]=new int[3];
int hr[]=new int[3];
int mr[]=new int[3];
int hf[]=new int[3];
int mf[]=new int[3];
float time[]=new float[3];
System.out.println("请输入日期");
Scanner scanx=new Scanner(System.in);
for(int i1=0;i1<3;i1++) {
x[i1]=scanx.nextInt();
}
scanx.close();
System.out.println("请输入太阳升起的时间(小时)");
Scanner scanhr=new Scanner(System.in);
for(int i1=0;i1<3;i1++) {
hr[i1]=scanhr.nextInt();
}
scanhr.close();
System.out.println("请输入太阳升起的时间(分钟)");
Scanner scanmr=new Scanner(System.in);
for(int i1=0;i1<3;i1++) {
mr[i1]=scanhr.nextInt();
}
scanmr.close();
System.out.println("请输入太阳落下的时间(小时)");
Scanner scanhf=new Scanner(System.in);
for(int i1=0;i1<3;i1++) {
hf[i1]=scanhr.nextInt();
}
scanhf.close();
System.out.println("请输入太阳落下的时间(分钟)");
Scanner scanmf=new Scanner(System.in);
for(int i1=0;i1<3;i1++) {
mf[i1]=scanhr.nextInt();
}
scanmf.close();
for(int j1=0;j1<3;j1++) {
time[j1]=hf[j1]-hr[j1]+(mf[j1]-mr[j1])/60;
}
float N[][]=new float[3][3], yy, temp;
for (i = 0; i < 3; i++) {
N[i][0] = time[i];
}
for (j = 1; j < 3; j++) {
for (i = j; i < 3; i++) {
N[i][j] = (N[i][j - 1] - N[i - 1][j - 1]) / (x[i] -x[i - j]);
xx = 10;
}
}
yy = 0.0f; temp = 1;
for (i = 0; i < 3; i++) {
yy = yy +N[i][i] * temp;
temp = temp * (xx - x[i]);
}
System.out.println("\n2022年4月"+xx+"日河北秦皇岛日照时长为"+yy+"小时.");
System.out.println("即"+(int)yy+"小时"+(int)((yy%1)*60)+"分");
}
}
12-02
06-26
673
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)