第九届山东理工大学ACM网络编程擂台赛 热身赛 sdut4087 ldq's Sons

题目链接

Time Limit: 1000MS

Memory Limit: 65536KB

Problem Description

Xuanhuang: Wow, three cute boys. Are they all your sons, ldq?

ldq: Yes.

Xuanhuang: How old are your three sons?

ldq: Just telling you is lack of fun, let me try your IQ.

Xuanhuang: Piece of cake, come on~

ldq: The product of their age equals to 36.

Xuanhuang: Anything else?

ldq: The sum of their age equals to how many bottles of beer we have drunk.

Xuanhuang: Emmm...well, but I still can't make it for sure. Any other clue?

ldq: Have you seen my eldest son?

Xuanhuang: Yes. A very clever boy. Another two will grow up just like him, I think. But why is he wearing a green hat... Oh, I see! How could I not realize it? Now I clearly know the age of your sons!

 

Now you tell me, what is the age of ldq's sons?

Input

No input.

Output

There are three lines of output. Please refer to the example output and the hint. 

Example Input
 
Example Output
ldq's eldest son is 20.
ldq's second son is 19.
ldq's little son is 18.
Hint

Example output is a wrong answer, you should change it into the correct one. Each age is a positive integer.

注:示例只是为了展示输出格式,不是正确答案,你需要把示例中的数字替换为你的答案。

Author
玄黄
思路 题目一共给出了3个条件,第一个最明显,三个数字之积为36,从中可以确定答案的范围,可能正确的答案共有8种,第二个条件是数字之和为一个已知数,并且在前两个条件下得不出唯一解,从中可以将答案范围缩小为9,2,2和6,6,1两种,只有这两个答案的和均为13,因此需要第三个条件来约束,第三个条件为剩下两个儿子均比大儿子年龄小,说明大儿子并不是双胞胎,从而确定答案为9,2,2。另外,由于第一个答案十分明显,在有限的Wrong answer后也可以Accepted此题
#include <stdio.h>
int main ()
{
    printf ("ldq's eldest son is 9.\n");
    printf ("ldq's second son is 2.\n");
    printf ("ldq's little son is 2.\n");
    return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值