Posts

Showing posts from March, 2021

Strange Table CodeForces

 import java.util.Scanner; class CodeForces7{ public static void main(String arg[]){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t -->0){ long n=sc.nextLong(); long m=sc.nextLong(); long x=sc.nextLong(); //long arr[][]=new long[n][m]; //By rows /* for(int i=1;i<n*m+1;i++){ if(i%m==0){ System.out.print(i); System.out.println(); } else  System.out.print(i+" "); }*//* int count=0; for(int i=1;i<n+1;i++){ for(int j=i;j<=(m*n);j+=n){ count++; if(count%m==0){ System.out.println(); } else System.out.print(j+" "); } } for(int i=1;i<2;i++){ System.out.print(i+" "); for(int j=i+1;j<=(m*n);j++){ //count++; if(j%m==0){ System.out.print(j); System.out.println(); } else System.out.print(j+" "); } }