1 solutions
-
0
C :
#include<stdio.h> int main() { int n,m,i,t; scanf("%d",&n); while(n--) { scanf("%d",&m); t=m; for(i=0;i<m*3;i++) { while(m--) printf("ACM"); printf("\n"); m=t; } } return 0; }
C++ :
#include<stdio.h> int main() { int n,m,i,t; scanf("%d",&n); while(n--) { scanf("%d",&m); t=m; for(i=0;i<m*3;i++) { while(m--) printf("ACM"); printf("\n"); m=t; } } return 0; }
Pascal :
var n,m,i,j,k:integer; begin readln(n); for i:=1 to n do begin readln(m); for j:=1 to 3*m do begin for k:=1 to m do write('ACM'); writeln; end; end; end.
Java :
import java.util.Scanner; public class Main{ // static char fun(char c){ // char[] arr = {'a','e','i','o','u','A','E','I','O','U'}; // for(char p:arr){ // if(c == p){ // return toUpper(c); // } // } // return toLower(c); // } // static char toUpper(char c){ // if(c>96 && c<123){ // return c = (char)(c-32); // } // else // return c; // } // static char toLower(char c){ // if(c>64 && c<91){ // return c = (char)(c+32); // } // else // return c; // } static void acm(int x){ for(int i=0;i<x*3;i++){ for(int j=0;j<x;j++){ System.out.print("ACM"); } System.out.println(); } } public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); int t = Integer.parseInt(sc.nextLine()); for(int i=0;i<t;i++){ int m = Integer.parseInt(sc.nextLine()); acm(m); } } }
Python :
import sys l = 1 for line in sys.stdin: M = int(line.split()[0]) if l !=1: for i in xrange(3*M): print 'ACM'*M l += 1
C# :
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string str="ACM"; int t=Convert.ToInt32(Console.ReadLine()); while (t>0) { int n = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < n * 3; i++) { for (int j = 0; j < n; j++) { Console.Write(str); } Console.WriteLine(""); } t--; } } } }
- 1
Information
- ID
- 786
- Time
- 1000ms
- Memory
- 32MiB
- Difficulty
- 10
- Tags
- # Submissions
- 5
- Accepted
- 1
- Uploaded By