Skip to content

Instantly share code, notes, and snippets.

@shahbazahmed1269
Created May 28, 2016 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shahbazahmed1269/1570317a8121a8769dd95ad6ab8c79d5 to your computer and use it in GitHub Desktop.
Save shahbazahmed1269/1570317a8121a8769dd95ad6ab8c79d5 to your computer and use it in GitHub Desktop.
problem CPTTRN4, based on SPOJ submission 17005746 (JAVA)
import java.util.*;
import java.lang.*;
import java.io.*;
class CPTTRN4
{
public static void main (String[] args) throws java.lang.Exception
{
int t,l,c,h,w;
String input;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
t=Integer.parseInt(br.readLine());
StringTokenizer st;
while(t-->0){
input=br.readLine();
st=new StringTokenizer(input);
l=Integer.parseInt(st.nextToken());
c=Integer.parseInt(st.nextToken());
h=Integer.parseInt(st.nextToken());
w=Integer.parseInt(st.nextToken());
int temp=(c*w)+c+1;
for(int i=0;i<temp;i++)
System.out.print("*");
System.out.println();
for(int i=0;i<l;i++){
for(int j=0;j<h;j++){
for(int m=0;m<c;m++){
System.out.print("*");
for(int n=0;n<w;n++){
System.out.print(".");
}
}
System.out.print("*");
System.out.println();
}
for(int p=0;p<temp;p++)
System.out.print("*");
System.out.println();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment