/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 2ms 324.0 KiB
#2 Wrong Answer 4ms 492.0 KiB
#3 Wrong Answer 5ms 588.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-10-03 13:21:14
Judged By
Score
0
Total Time
5ms
Peak Memory
588.0 KiB