0% found this document useful (0 votes)
24 views1 page

CSEC-ASTU Exam Score Calculation Guide

The document provides the rules for calculating the score of a midterm exam based on a string of 'O's and 'X's representing correct and incorrect answers. It explains that an 'O' scores the number of consecutive 'O's at that point and an 'X' scores 0. It gives the example string "OXXXOXOOOO" which scores 12 by adding 1+0+0+0+1+0+1+2+3+4. The input will be a string of 'O's and 'X's up to 80 characters long, and the program must output the total score as an integer.

Uploaded by

Abraham Mekuria
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

CSEC-ASTU Exam Score Calculation Guide

The document provides the rules for calculating the score of a midterm exam based on a string of 'O's and 'X's representing correct and incorrect answers. It explains that an 'O' scores the number of consecutive 'O's at that point and an 'X' scores 0. It gives the example string "OXXXOXOOOO" which scores 12 by adding 1+0+0+0+1+0+1+2+3+4. The input will be a string of 'O's and 'X's up to 80 characters long, and the program must output the total score as an integer.

Uploaded by

Abraham Mekuria
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

The 2020/21 CSEC-ASTU Competitive Programming Division

Entrance Contest, August 15, 2021

Problem G: Evaluating
Input file: standard input
Output file: standard output
Time limit: 1s
Balloon color: Red

Yesterday was your midterm exam, and you’ve got a result like “OXXXOXOOOO”. An ‘O’ means a
correct answer of a certain problem and an ‘X’ means a wrong answer. As usual, the score of this exam
is calculated by the sum of the score of each problem.
The score of each problem is calculated by this:
 If the answer for the problem is incorrect, the score is 0. For example, the score of the third
problem is 0.
 If the answer for the problem is correct, the score is calculated by itself and its just previous
consecutive ‘O’s. For example, the score of the 10th problem is 4 since there are 4 consecutive
‘O’s.

Therefore, the score of “OXXXOXOOOO” is 12 which is calculated by “1+0+0+0+1+0+1+2+3+4”.

Given the result of your midterm exam, write a program that calculates the score of the exam.
.

Input
You are given a string that consists of only ‘O’ and ‘X’ and the length of the string is more than 0 and
less than 80.

Output
Print exactly one line that contains the score of the exam.

Examples
Sample Input 1 Sample Output 1
OOO 6

Sample Input 2 Sample Output 2


OOOOXXOOXX 13

You might also like