1177三色球

来源:互联网 发布:js文件怎么打开 编辑:程序博客网 时间:2024/04/30 11:32

三色球

Time Limit:1000MS Memory Limit:65536K
Total Submit:606 Accepted:273

Description

若一个口袋中放有若干个球,其中有a个红色的、b个白色的、c个黑色的,从中任取10个球,问共有多少种不同的颜色搭配?

Input

输入a,b,c分别代表红球、白球和黑球的个数。(1 =< a <= 10)(1 =< b <= 10)(1 =< c <= 10)(10 =< a+b+c)

Output

一个整数,表示有多少种不同的颜色搭配。

Sample Input

3 3 6
Sample Output

6
Source

#include <stdio.h>int main(){    int a,b,c;    scanf("%d %d %d",&a,&b,&c);    int x,y,z;    int count=0;    for(x=0;x<=a;x++)    {        for(y=0;y<=b;y++)        {            for(z=0;z<=c;z++)            {                if(x+y+z==10)                {                    count++;                    break;                }            }        }    }    printf("%d",count);    return 0;}