AKADEMI FANTASIA X1C Akademi Fantasia Input Standard input Output Standard output Topic Repetition and Control structure Problem Description Akademi Fantasia (commonly abbreviated as AF) is Malaysia's...

AKADEMI FANTASIA X1C Akademi Fantasia Input Standard input Output Standard output Topic Repetition and Control structure Problem Description Akademi Fantasia (commonly abbreviated as AF) is Malaysia's first reality television show in which a number of contestants compete for the winning title. The format of the show is taken from "La Academia", which originated from Mexico. The judging system totally depends on audiences' SMS votes. The vote is in the form of money. In order to vote, audience can type AFUNDI (3/5/10/20) (contestant name) send to 32777. The number 3, 5, 10 and 20 represent RM3, RMS, RM10 and RM20, respectively. The received SMS will be processed by AF computer server. Your task is to write a program that reads a list of votes values and count the number of valid vote and sum of the votes. For example, if the input is 2, 3, 4, 5, 6 and 7, then the output will be 2 because only two values is valid that are number 3 and 5. Therefore, the sum of the votes is 8. Input Format The first line contains an integer N (1 SN 3100) which is the number of test cases. The following N lines contains a list of integers X(1 SX S20), which represent the votes that ends with -1. Output Format For each test case, output a line in the format Case #n: m p where n is the case number (starting from 1), follows by m that represents number of valid votes and p represents total of votes as shown in the sample output Sample Data Sample input Sample output Case #1: 28 2 3 4 5 6 7 -1 Case #2:00 4 12 -2 16 7 -1 Case #3: 5 58 3 5 10 20 20 -1 3
Nov 19, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here