0% found this document useful (0 votes)
98 views4 pages

ACM ICPC 2010 Latin America

The document describes two problems for an ACM programming competition: 1) The "Mean Median Problem" asks the participant to find the minimum integer C such that the mean and median of integers A, B, and C are equal, given integers A and B. 2) The "Factorial Again!" problem asks the participant to write a program that converts numbers represented in an unusual notation called "ACM notation" into standard decimal notation. The ACM notation assigns each digit a value that is its face value multiplied by the corresponding factorial of its position in the number.
Copyright
© Attribution Non-Commercial (BY-NC)
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)
98 views4 pages

ACM ICPC 2010 Latin America

The document describes two problems for an ACM programming competition: 1) The "Mean Median Problem" asks the participant to find the minimum integer C such that the mean and median of integers A, B, and C are equal, given integers A and B. 2) The "Factorial Again!" problem asks the participant to write a program that converts numbers represented in an unusual notation called "ACM notation" into standard decimal notation. The ACM notation assigns each digit a value that is its face value multiplied by the corresponding factorial of its position in the number.
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 4

acm

International Collegiate Programming Contest

2010

event sponsor

ACM International Collegiate Programming Contest 2010


Latin American Regional Contests
October 22nd-23rd, 2010

Warmup Session

This problem set contains 2 problems; pages are numbered from 1 to 2.

This problem set is used in simultaneous contests hosted in the following countries: Argentina Bolivia Brazil Chile Colombia Cuba Peru Mexico Venezuela
v1.0

General Information
Unless otherwise stated, the following conditions hold for all problems.

Input
1. The input must be read from standard input. 2. The input contains several test cases. Each test case is described using a number of lines that depends on the problem. 3. When a line of data contains several values, they are separated by single spaces. No other spaces appear in the input. There are no empty lines. 4. Every line, including the last one, has the usual end-of-line mark. 5. The end of input is indicated with a line containing certain values that depend on the problem. This line should not be processed as a test case.

Output
1. The output must be written to standard output. 2. The result of each test case must appear in the output using a number of lines that depends on the problem. 3. When a line of results contains several values, they must be separated by single spaces. No other spaces should appear in the output. There should be no empty lines. 4. Every line, including the last one, must have the usual end-of-line mark. 5. No special mark should be written to indicate the end of output.

ACM ICPC2010 Latin American Regional

Problem A
Mean Median Problem
Problem code name: mean The mean of three integers A, B and C is (A + B + C)/3. The median of three integers is the one that would be in the middle if they are sorted in non-decreasing order. Given two integers A and B, return the minimum possible integer C such that the mean and the median of A, B and C are equal.

Input
Each test case is given in a single line that contains two integers A and B (1 A B 109 ). The last test case is followed by a line containing two zeros.

Output
For each test case output one line containing the minimum possible integer C such that the mean and the median of A, B and C are equal. Sample input 1 6 1 0 2 10 1000000000 0 Output for the sample input 0 2 -999999998

ACM ICPC2010 Latin American Regional

Problem B
Factorial Again!
Problem code name: factorial Mathew, an engineering freshman, is developing an original positional notation for representing integer numbers. He called it A Curious Method (ACM for short). The ACM notation uses the same digits as the decimal notation, i.e., 0 through 9. To convert a number A from ACM to decimal notation you must add k terms, where k is the number of digits of A (in the ACM notation). The value of the i-th term, corresponding the i-th digit ai , counting from right to left, is ai i!. For instance 719ACM is equivalent to 5310 , since 7 3! + 1 2! + 9 1! = 53. Mathew has just begun studying number theory, and probably does not know which properties a numbering system should have, but at the moment he is only interested in converting a number from ACM to decimal. Could you help him?

Input
Each test case is given in a single line that contains a non-empty string of at most 5 digits, representing a number in ACM notation. The string does not have leading zeros. The last test case is followed by a line containing one zero.

Output
For each test case output a single line containing the decimal representation of the corresponding ACM number. Sample input 719 1 15 110 102 0 Output for the sample input 53 1 7 8 8

You might also like