1 solutions

  • 0
    @ 2025-3-3 16:27:12

    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;
    }
    

    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);
    		}
    	}
    		
    }
    
    
    • 1

    Information

    ID
    10134
    Time
    1000ms
    Memory
    32MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By