Submission
# | When | Author | Problem | Language | CPU | Memory | |
---|---|---|---|---|---|---|---|
20838 | 2024-06-09 09:27:14 | AHAMMED_99 | Count Character | C | 0 ms | 1516 kb | Wrong Answer - 1 |
Source Code
#include <stdio.h> #include <string.h> void count_characters(char *s, int n, int *alice_count, int *bob_count) { // Initialize arrays to store counts // Iterate through the string for (int i = 1; i <= n; i++) { // Update Alice's count // Update Bob's count bob_count[i] = bob_count[i - 1] + 1; } } int main() { int T; for (int case_num = 1; case_num <= T; case_num++) { int N; char S[N + 1]; // Arrays to store counts for Alice and Bob int alice_count[N + 1], bob_count[N + 1]; // Calculate counts for Alice and Bob count_characters(S, N, alice_count, bob_count); // Calculate total counts for Alice and Bob int total_alice_count = 0, total_bob_count = 0; for (int i = 0; i <= N; i++) { total_alice_count += alice_count[i]; total_bob_count += bob_count[i]; } // Print the output for this test case } return 0; }