2016 Blue Bridge Cup Group A first problem users aged ...

User Age

Some that a new understanding of users.
When asked the age of his friends said:
"My age is a 2-digit number, I am older than 27-year-old son,
if I put the age of two digital switching position, just my son's age."

Please work: a User's age how many possibilities there are?

Tips: 30-year-old is one of the possible oh.

Please fill indicates the number of possible cases.
Note: Your submission should be an integer, do not fill in any extra content or descriptive text.
Analysis of the topic, there are tens digit exchange
set of users age A 10 + b
by my age is a 2-digit number, I am older than 27-year-old son
if I put the age of two digital switching position, just my son Age "
: a
10-B 27 + B = 10 + a
given below Code:
#include <stdio.h>
int main () {
int B = 0;
int I = 0;
for (int = a 2; a <= 9; a ++) { // users aged a minimum of 27 from 2 to start the cycle
for (int B = 0; B <=. 9; B ++) {
IF ((A
10 + B-27) == (B * 10 + A)) {
++ I;

		}
	}
	
}
printf("%d",i);
return 0;	

}

Guess you like

Origin blog.csdn.net/weixin_43232423/article/details/84786297