设为首页 加入收藏

TOP

hdu 1427 速算24点【暴力枚举】(二)
2019-07-08 18:11:44 】 浏览:317
Tags:hdu 1427 速算 24点 暴力 枚举
bsp;       else
                    if(ans%c==0&&c!=0)
                        ans/=c;
                    else 
                        continue;
                    p=ans;
                for(l=0;l<4;l++)
                {ans=p;
                    if(l==0)
                        ans+=d;
                    else if(l==1)
                        ans-=d;
                    else if(l==2)
                        ans*=d;
                    else
                        if(ans%d==0&&d!=0)
                            ans/=d;
                        else 
                            continue;
                    if(ans==24)
                    {
                        //printf("%c%d%c%d%c%d%c%d=%d\n",str[i],a,str[j],b,str[k],c,str[l],d,ans); //输出算式
                        return 1;
                    }
                }
            }
        }
    }
    return 0;
}

int kh(int a,int b,int c,int d)  //枚举加括号的所有情况
{
    char str[4]={'+','-','*','/'};
    int ans,bns,sum,i,j,k,l;
    for(i=0;i<4;i++)
 &n

首页 上一页 1 2 3 4 5 下一页 尾页 2/5/5
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Linux 用tcp实现的简单http服务器 下一篇生成前N个自然数随机置换的3个程序

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目