import java.util.*;
public class Problem7 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Read the number of vertices and edges
System.out.print("Enter the number of vertices: ");
int numVertices = scanner.nextInt();
System.out.print("Enter the number of edges: ");
int numEdges = scanner.nextInt();
// Initialize the incidence matrix
int[][] incidenceMatrix = new int[numVertices + 1][numEdges + 1];
// Read edges, counts. Construct the incidence matrix
System.out.println("Enter the edges and their counts (format: vertex1 vertex2 count):");
for (int i = 1; i
Подробнее здесь: [url]https://stackoverflow.com/questions/78503092/im-having-trouble-showing-my-leading-zeroes-in-java[/url]
Я создаю программу, которая должна отображать матрицу инцидентности, но когда в первом столбце все нули, она не распечатывается. [code]import java.util.*;
public class Problem7 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in);
// Read the number of vertices and edges System.out.print("Enter the number of vertices: "); int numVertices = scanner.nextInt(); System.out.print("Enter the number of edges: "); int numEdges = scanner.nextInt();
// Initialize the incidence matrix int[][] incidenceMatrix = new int[numVertices + 1][numEdges + 1];
// Read edges, counts. Construct the incidence matrix System.out.println("Enter the edges and their counts (format: vertex1 vertex2 count):"); for (int i = 1; i