0% found this document useful (0 votes)
36 views3 pages

A. Balance Number: Sample Input 1 Sample Output 1

The document describes 3 programming problems: 1. Checking if a 4-digit number is a "balance number" where the sum of the first two digits equals the sum of the last two digits. 2. Calculating the percentage of students who scored above the class grade point average. 3. Removing consecutive duplicate characters from a user-entered name. For each problem, the document provides details on the input/output format and sample test cases.
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)
36 views3 pages

A. Balance Number: Sample Input 1 Sample Output 1

The document describes 3 programming problems: 1. Checking if a 4-digit number is a "balance number" where the sum of the first two digits equals the sum of the last two digits. 2. Calculating the percentage of students who scored above the class grade point average. 3. Removing consecutive duplicate characters from a user-entered name. For each problem, the document provides details on the input/output format and sample test cases.
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
You are on page 1/ 3

A.

Balance number

The balance number is a 4-digit number, where the sum of the first two digits is equal to the sum of
the remaining two digits.
Creates a program that allows user enter a 4-digit positive integer, and checks if it's a balance number
or not a balance number.
Input
The input starts with an integer N (1000 ≤ N ≤ 9999).
Output
Prints “Yes” since N is a balance number, otherwise print “No”.
Sample
Sample Input 1 Sample Output 1
1000 No

Sample Input 2 Sample Output 2


1230 Yes

Sample Input 3 Sample Output 3


2213 Yes

Sample Input 4 Sample Output 4


2233 No
B. The rating over average
The percentage of students who scored above the grade point average.
Creates a program that allows user to enter N students, calculates the grade point average (A), counts
the number of students with higher scores than the grade point average (M), then prints ratio of
numbers greater than average (M/N *100%)
Input
The first line contains the number of student in the class N (1 ≤ N ≤ 50).
The second line, containing N integers a0, a1, ..., aN-1 (0 ≤ i ≤ N-1, 0 ≤ ai ≤ 100). They are the final
grade of N students in the class.
Output
The percentage of students whose grade is above average, rounded to exactly 3 decimal places.
Sample
Sample Input 1 Sample Output 1
5 40.000
50 50 70 80 100

Sample Input 2 Sample Output 2


7 57.143
100 95 90 80 70 60 50

Sample Input 3 Sample Output 3


3 33.333
70 90 80

Sample Input 4 Sample Output 4


3 66.667
70 90 81

Sample Input 5 Sample Output 5


9 55.556
100 99 98 97 96 95 94 93 91
C. Remove duplicate characters

Creates a program that allows user entering a name and removes all consecutive duplicate characters.
Input
The input contains a single name that contains only lowercase letters (a–z), no white space. The length
of name is from 1 to 250 characters.
Output
The normalized name.

Sample
Sample Input 1 Sample Output 1
robert robert

Sample Input 2 Sample Output 2


rooobert robert

Sample Input 3 Sample Output 3


roooooobertapalaxxxxios robertapalaxios

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy