Competitive Programming Solutions

GitHub
back to dashboard

N. Numbers Histogram

Codeforces - Sheet #2 (Loops) · limit: 1s · memory: 256MB · view on codeforces

input

+
5
5 2 4 3 7

output

+++++
++
++++
+++
+++++++
Main.java
static void solve() {

        // Write your solution here
        char ch = in.next().charAt(0);
        int n = in.nextInt();
        while(n-- > 0){
            int i = in.nextInt();
            while(i-- > 0){
                out.print(ch);
            }
            out.println();
        }
    }