/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 324.0 KiB
#2 Wrong Answer 3ms 316.0 KiB

Code

#include <iostream>
#include <string>
using namespace std;

// Function to remove characters at even positions
    string removeEvenPositionChars(const string& str) {
    string result;
    for (size_t i = 1; i < str.size(); i += 2) {
        result += str[i];
    }
    return result;
}

// Function to repeatedly remove even position characters until no even positions are left
    string processString(const string& str) {
    string result = str;
    while (result.size() > 1) {
        result = removeEvenPositionChars(result);
    }
    return result;
}

int main() {
    int T;
    cin >> T;
    cin.ignore(); // Ignore the newline character after the integer input

    while (T--) {
        string S;
        getline(cin, S);

        string result = processString(S);
        cout << result << endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1080 String Algorithm
Contest
Bangladesh 2.0
Language
C++17 (G++ 13.2.0)
Submit At
2024-08-16 17:38:51
Judged At
2024-11-11 03:11:10
Judged By
Score
0
Total Time
3ms
Peak Memory
324.0 KiB