Java逗号拼接字符串-csdn
Java逗号拼接字符串-脚本之家
java的list转String,用逗号分割——Java原生String.join
解二元一次方程(最简单方法,未求最小公倍数通分):
C语言
#include<stdio.h>
int main()
{
double a,b,c,d,e,f;
scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f);
double y = (f*a - d*c)/(a*e-d*b);
double x = (c-b*y)/a;
printf("\n原方程为:\n");
printf("%.0fx+ %.0fy= %.0f\n",a,b,c);
printf("%.0fx+ %.0fy= %.0f",d,e,f);
printf("\n解得y=%.2f\n x=%.2f",y,x);
return 0;
}
Java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double a = sc.nextInt();
double b = sc.nextInt();
double c = sc.nextInt();
double d = sc.nextInt();
double e = sc.nextInt();
double f = sc.nextInt();
double area = sc.nextInt();
double day = sc.nextInt();
double y = (f*a - d*c)/(a*e-d*b);
double x = (c-b*y)/a;
double n = (area*x + area*y*day)/day;
System.out.println("y="+y+"\tx="+x);
System.out.println(area+"公亩可供"+n+"头牛吃"+day+"天");
sc.close();
}
}