Submission

Status:

---------

Subtask/Task Score:

0/100

Score: 0

User: cheeseycheese05

Problemset: บวกเลขฐาน

Language: cpp

Time: 0.014 second

Submitted On: 2026-10-13 20:48:34

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    int n;
    if (!(cin >> n)) return 0;

    vector<int> dripstones(n);
    for (int i = 0; i < n; i++) {
        cin >> dripstones[i];
    }

    for (int dripstone : dripstones) {
        // 1. Draw the left side pointing down
        for (int i = 0; i < dripstone; i++) {
            cout << '\\' << "\n";
        }

        // 2. Move cursor up to the top and one column right
        // \033[A moves cursor up, \033[C moves cursor right
        cout << "\033[" << dripstone << "A" << "\033[1C";

        // 3. Draw the right side pointing up
        for (int i = 0; i < dripstone; i++) {
            cout << '/' << "\n" << "\033[1D"; // Move down, then reset 1 column left
        }

        // 4. Move cursor back to the top of this dripstone, and step right for the next one
        cout << "\033[" << dripstone << "A" << "\033[2C";
    }

    cout << "\n"; // Clean exit line
    return 0;
}