修改成Java后的代碼:
創(chuàng)新互聯(lián)公司主要從事成都網(wǎng)站制作、成都網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)調(diào)兵山,十余年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來(lái)電咨詢建站服務(wù):028-86922220
public?class?Demo?{
public?static?int?gcd(int?a,?int?b,?int?c)?{
int?min,?i;
if(a??b)?{
if(b??c)?{
min?=?c;
}?else?{
min?=?b;
}
}?else?{
if(a??c)?{
min?=?c;
}?else?{
min?=?a;
}
}
if(b??c)?{
if(c??a)?{
min?=?a;
}?else?{
min?=?c;
}
}?else?{
if(b??a)?{
min?=?a;
}?else?{
min?=?b;
}
}
if(a??c)?{
if(c??b)?{
min?=?b;
}?else?{
min?=?c;
}
}?else?{
if(a??b)?{
min?=?b;
}?else?{
min?=?a;
}
}
for(i=min;?i=1;?i--)?{
if(a%i==0??b%i==0??c%i==0)?{
break;
}
}
return?i;
}
public?static?void?main(String[]?args)?{
int?a?=?1,?b?=?0,?c?=?0,?i,?k?=?0,?j?=?0,?m?=?0,?n?=?0,?z,?y;
while(a??9)?{
b?=?1;
while(b??9)?{
c?=?1;
while(c??9)?{
if(gcd(a,b,c)?==?1)?{
System.out.println(a?+?";"?+?b?+?";"?+?c);
k++;
z?=?b*b?-?4*a*c;
if(z?==?0)?{
j++;
}?else?if(z??0)?{
m++;
for?(y=1;?yz/2;?y++)?{
if?(y*y==z)?{
System.out.println("解答是有理數(shù)。");
}
}
}?else?{
n++;
}
}
c++;
}
b++;
}
a++;
}
System.out.println("N?=?"?+?k);
System.out.println("N2?=?"?+?j);
System.out.println("N3?=?"?+?m);
System.out.println("N4?=?"?+?n);
i?=?gcd(a,?b,?c);
}
}
import java.util.Arrays;
import java.util.Scanner;
public class A {
static final int maxn=100000+5;
static long[] a=new long[maxn],t=new long[maxn];
static long ans=0;
static void mymerge(int x,int m,int y) {
int tx=x,tm=m+1;
int k=0;
while(tx=m tm=y) {
if(a[tx]=a[tm])
t[k++]=a[tx++];
else {
ans+=m-tx+1;
a[k++]=a[tm++];
}
}
while(tx=m) t[k++]=a[tx++];
while(tm=y) t[k++]=a[tm++];
for(int i=0;ik;i++)
a[x++]=t[i];
}
static void mergesort(int x,int y) {
if(x==y)return ;
int mid=(x+y)/2;
int xx=x,yy=y;
mergesort(xx,mid);
mergesort(mid+1,yy);
mymerge(xx,mid,yy);
//System.out.println(xx+" "+mid+" "+yy);
}
public static void main(String[] arg) {
int n,k;
Scanner input=new Scanner(System.in);
while(input.hasNext()) {
n=input.nextInt();
k=input.nextInt();
Arrays.fill(a, 0);
Arrays.fill(t, 0);
for(int i=0;in;i++) {
a[i]=input.nextLong();
}
ans=0;
mergesort(0, n-1);
if(kans)
System.out.println("0");
else
System.out.println((ans-k)+"");
}
}
}
unsigned short crc(unsigned char [] crc_pointer,unsigned short data_length)
{
unsigned short k,k0,bit_flag;
unsigned short int_crc=0xffff;
for (k=0;kdata_length;k++)
{
int_crc^=(crc_pointer)[k];
for(k0=0;k08;k0++)
{
bit_flag=int_crc0x0001;
int_crc=1;
if (bit_flag==1)
int_crc^=0xa001;
}
}
return(int_crc);
}
package dis;
import java.io.*;
import java.math.*;
public class dis
{
public static void main(String [] s) throws Exception
{
Float a,b,c;
double x2;
double x1;
System.out.println("請(qǐng)輸入a, b, c的值");
BufferedReader bReader=new BufferedReader(new InputStreamReader(System.in));
a=Float.parseFloat(bReader.readLine());
b=Float.parseFloat(bReader.readLine());
c=Float.parseFloat(bReader.readLine());
if (b*b - 4*a*c = 0)
System.out.println("輸入的系數(shù)不對(duì),b2-4ac不大于0!程序退出!");
else
{
x1 = (-b + Math.sqrt(b*b - 4*a*c))/2*a;
x2 = (-b - Math.sqrt(b*b - 4*a*c))/2*a;
System.out.println("x1 = "+ x1);
System.out.println("x2 = "+x2);
}
return;
}
}