c语言趣味编程

三色球问题

 1 #include <iostream>
 2 using namespace std;
 3 int main()
 4 {
 5     int count=0; 
 6     for(int i=0;i<=3;i++)
 7     {
 8         for(int j=0;j<=3;j++)
 9         {
10             for(int k=0;k<=6;k++)
11             {
12                 if(i+k+j==8)
13                 {
14                     count++;
15                 }
16             }
17         }
18     }
19     cout<<count<<endl;
20 }
21  

 

posted @ 2023-05-20 22:03  新晋软工小白  阅读(20)  评论(0)    收藏  举报