Java jobs cannot be run

Source: Internet
Author: User

Import Java.util.Scanner;


public class ZHSH_NHH extends thread{

 /**
  * @param args
  */
 private int n,start,end;
 public int q;
 public int[][] zhshq=new int[10000][22];
 int[] B=new int[22];
 public zhsh_nhh (int x,int start,int end)
 {
  this.q=0;
  this.start=start;
  this.end=end;
  this.n=x;
 }
 public void out (int ans)
 {
  for (int i=1;i<=n;i++)
  {
    for (int j=1;j<=n;j++)
    if (zhshq[ans-1][i]==j)
      system.out.print (' Q ');
    else System.out.print (' * ');
   system.out.print (' \ n ');
   
  }
  
 }

public void Dfs (int k,int b[])
{

if (k>n)
{

q++;
System.out.println (q+ "ddddddddddddd");
for (int l=1;l<=n;l++)
ZHSHQ[Q][L]=B[L];
return;
}
int i,j;
for (i=1;i<=n;i++)
{

for (j=1;j<k;j++)
{
if (I==b[j])
Break
if (Math.Abs (k-j) ==math.abs (I-b[j]))
Break
}
if (j<k)
Continue
System.out.print ("Grass mud Horse" +i);
B[k]=i;
DFS (K+1,B);

}
}
public void Run ()
{
System.out.print ("Start running Me");
for (int i=start;i<=end;i++)
{
B[1]=i;
DFS (2,B);

}

}
public static void Main (string[] args) throws Interruptedexception {
TODO auto-generated Method Stub
Scanner zhshinput=new Scanner (system.in);
int Zhshn=zhshinput.nextint ();
Parallel solution
Long k=0;
Long Begin,end,endend;

Parallel solution
ZHSH_NHH t1=new zhsh_nhh (ZHSHN,1,ZHSHN/2);
ZHSH_NHH t2=new zhsh_nhh (ZHSHN,ZHSHN/2+1,ZHSHN);
Begin=system.currenttimemillis ();
T1.start ();
T2.start ();
T1.join ();
T2.join ();
End=system.currenttimemillis ();


Serial Solution
ZHSH_NHH t=new zhsh_nhh (ZHSHN,1,ZHSHN);
Long B=system.currenttimemillis ();
T.start ();
T.join ();
Endend=system.currenttimemillis ();

SYSTEM.OUT.PRINTLN ("Parallel Time is");
System.out.println (End-begin);
System.out.println ("Serial Time Is");
System.out.println (Endend-b);
System.out.println ("acceleration ratio:" + (Endend-b) *1.0/(end-begin) *1.0);
System.out.println ("A total of" +t.q+ "solution");

int x;
int ans;
System.out.println ("Please enter solution method of the required solution: \ n 1 Serial solution \ n 2: Parallel solution \ n 0: Exit");
X=zhshinput.nextint ();

while (x>0)
{

System.out.println ("Please enter the method of Solution:");
Ans=zhshinput.nextint ();
if (ANS&GT;T.Q)
SYSTEM.OUT.PRINTLN ("Input error data");
if (x==2)
{
if (ANS&LT;=T1.Q)
T1.out (ANS);
Else
T2.out (ANS-T1.Q);
}
else if (x==1)
{
T.out (ANS);
}
else System.out.println ("incorrect data entered \ n");
System.out.println ("Please enter solution method of the required solution: \ n 1 Serial solution \ n 2: Parallel solution \ n 0: Exit");
}
}

}

Java jobs cannot be run

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.