有什么问题?

abcdefgPUMPKIN 2020-05-29 04:15:23
#include<stdio.h>
include<stdlib.h>
void count();
void group();
void money();
void judge();
int main()
{
int choice;
while (1)
{
printf("\n\n\n");
printf("**********************枚举法的应用********************\n");
printf("\n");
printf(" 1.核桃的数量\n");
printf(" 2.牌型的种类\n");
printf(" 3.一元币的兑换 \n");
printf(" 4.警察断案\n");
printf(" 0.退出\n");
printf("\n");
printf("*****************************************************\n");
printf("please choice(0-5):");
scanf("%d", &choice);
switch (choice)
{
case 0: exit(0);
case 1: count(); break;
case 2: group(); break;
case 3: money(); break;
case 4: judge(); break;
}
}
}
void count()
{
int a,b,c;scanf("%d%d%d",&a,&b,&c);
while(a!=0&&b!=0&&c!=0) ///a=0 b=0 c=0时退出
{
int i = 1;
while (i > 0)
{
if (i % a == 0 && i % b == 0 && i % c == 0)
{
printf("%d\n", i); break;
}

i++;
}
scanf("%d%d%d", &a, &b, &c);
}

return 0;
}

void monry()
{
int a=1,b=2,c=5,d=10,e=20,f=50;long long s=0;
int i,j,k,x,y,z;
for(i=0;i<=100;i++)
{
for(j=0;j<=50;j++)
{
for(k=0;k<=20;k++)
{
for(x=0;x<=10;x++)
{
for(y=0;y<=5;y++)
{
for(z=0;z<=2;z++)
{
if(a*i+b*j+c*k+d*x+e*y+f*z==100)
s++;
}
}
}
}
}
}
printf("%lld",s);
return 0;
}

void group()
{
int a[13];
int s=0;
for (a[0] = 0; a[0] <= 4; a[0]++)
for (a[1] = 0; a[1] <= 4; a[1]++)
for (a[2] = 0; a[2] <= 4; a[2]++)
for (a[3] = 0; a[3] <= 4; a[3]++)
for (a[4] = 0; a[4] <= 4; a[4]++)
for (a[5] = 0; a[5] <= 4; a[5]++)
for (a[6] = 0; a[6] <= 4; a[6]++)
for (a[7] = 0; a[7] <= 4; a[7]++)
for (a[8] = 0; a[8] <= 4; a[8]++)
for (a[9] = 0; a[9] <= 4; a[9]++)
for (a[10] = 0; a[10] <= 4; a[10]++)
for (a[11] = 0; a[11] <= 4; a[11]++)
for (a[12] = 0; a[12] <= 4; a[12]++)
{
if (a[0] + a[1] + a[2] + a[3] + a[4] + a[5] + a[6] + a[7]
+ a[8] + a[9] + a[10] + a[11] + a[12] == 13)
s++;

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

void judge()
{
char killer;
for (killer = 'A'; killer <= 'D'; killer++)
{
if (((killer != 'A') + (killer == 'C') + (killer == 'D') + (killer != 'D'))==3)
{
printf("killer=%c\n",killer);
}
}
system("pause");
return 0;
}
...全文
30 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

15,440

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧