Click here to Skip to main content
15,899,679 members

Comments by Member 11488706 (Top 5 by date)

Member 11488706 2-Mar-15 12:14pm View    
import java.util.Scanner;
import java.util.Arrays;

/**
*
* @author lenovo g460
*/
public class Hw3 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner sc=new Scanner(System Resources and Information. This website is for sale!);

System.out.print("Enter the number of towers");
int towers=sc.nextInt();
int a[] = new int[towers];
System.out.print("eneter the point where towers to be placed");
for(int i=0;i<a.length;i++)
{="" a[i]="sc.nextInt();
"
="" }
="" arrays.sort(a);
="" int="" last="a[towers-1];
" b[]="new" int[last+1];
="" for(int="" i="1;i<b.length;i++)
" for(="" j="0;j<a.length;j++)
" {int="" count="0;
" if(a[j]-i<="3" &&="" a[j]-i="">=-3)

count++;

}
b[i]=count;}
for(int i=0;i
Member 11488706 2-Mar-15 11:25am View    
import java.util.Scanner;
import java.util.Arrays;

/**
*
* @author lenovo g460
*/
public class Hw3 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner sc=new Scanner(System Resources and Information. This website is for sale!);

System.out.print("Enter the number of towers");
int towers=sc.nextInt();
int a[] = new int[towers];
System.out.print("eneter the point where towers to be placed");
for(int i=0;i<a.length;i++)
{="" a[i]="sc.nextInt();
"
="" }
="" arrays.sort(a);
="" int="" last="a[towers-1];
" b[]="new" int[last+1];
="" for(int="" i="1;i<b.length;i++)
" for(="" j="0;j<a.length;j++)
" {int="" count="0;
" if(a[j]-i<="3" &&="" a[j]-i="">=-3)

count++;

}
b[i]=count;}
for(int i=0;i
Member 11488706 2-Mar-15 11:24am View    
Deleted
import java.util.Scanner;
import java.util.Arrays;

/**
*
* @author lenovo g460
*/
public class Hw3 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner sc=new Scanner(System Resources and Information. This website is for sale!);

System.out.print("Enter the number of towers");
int towers=sc.nextInt();
int a[] = new int[towers];
System.out.print("eneter the point where towers to be placed");
for(int i=0;i<a.length;i++)
{="" a[i]="sc.nextInt();
"
="" }
="" arrays.sort(a);
="" int="" last="a[towers-1];
" b[]="new" int[last+1];
="" for(int="" i="1;i<b.length;i++)
" for(="" j="0;j<a.length;j++)
" {int="" count="0;
" if(a[j]-i<="3" &&="" a[j]-i="">=-3)

count++;

}
b[i]=count;}
for(int i=0;i
Member 11488706 1-Mar-15 10:29am View    
our tutor said dynamic programming
Member 11488706 1-Mar-15 5:57am View    
i just need to know which algorithm of dynamic program is involved.is it knapsack?