Skip to content

Commit

Permalink
solution
Browse files Browse the repository at this point in the history
  • Loading branch information
sabira-khan committed Apr 24, 2022
1 parent ddd2b3e commit 4d8db64
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions JavaSolutions/src/com/gitproject/Beecrowd1256_uri.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.gitproject;

import java.util.Hashtable;
import java.util.Scanner;

public class Beecrowd1256_uri {
public static void main(String[] args) {

Scanner s = new Scanner(System.in);
int t = s.nextInt();

while (t-- > 0) {
Hashtable<Integer, int[]> ht = new Hashtable<>();
int m = s.nextInt();
int n = s.nextInt();

int[][] a=new int[m][n];
for(int i=0;i<n;i++) {
int b= s.nextInt();
a[b%m][i]=b;
}
for(int i=0;i<m;i++)
{
ht.put(i,a[i]);
}
for(int i=0;i<m;i++)
{
System.out.print(i+" -> ");
for(int j=0;j<n;j++)
if(a[i][j]!=0)
System.out.print((ht.get(i))[j]+" -> ");
System.out.println("\\"); //escape
}

if (t > 0) {
System.out.println();
}
}
}
}

0 comments on commit 4d8db64

Please sign in to comment.