发新帖

解题啦解题啦

[复制链接]
8908 6
来来来,看看大家谁的思路好点,谁写的算法更简洁,更给力



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

举报 使用道具

回复

精彩评论6

听鬼哥说故事    发表于 2015-9-11 17:49:32 | 显示全部楼层
代码写的比较乱一点,大家有更好的代码欢迎上传~


[C#] 纯文本查看 复制代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFTest
{
    public class Program
    {  
          
        static void Main(string[] args)
        {
            for (double i = 0; i < 100; i++)
            {   
                for (double j = 0; j < 100; j++)
                {
                    double temp = i + j;
                    if (temp == 13)  
                    {
                        for (double k = 0; k < 100; k++)
                        {
                            for (double l = 0; l < 100; l++)
                            {
                                for (double m = 0; m < 100; m++)
                                {
                                    double temp2 = k - l * m;
                                    if (temp2 == 4)
                                    {
                                        for (double n = 0; n < 100; n++)
                                        {
                                            for (double o = 0; o < 100; o++)
                                            {
                                                for (double p = 0; p < 100; p++)
                                                {
                                                    double temp3 = n + o - p;
                                                    if (temp3 == 4)
                                                    {
                                                        if (n > 0)
                                                        {   
                                                            if (k >= n)
                                                            {
                                                                if (i + (k / n) == 4 && j - l * o == 4 && m + p == 5)
                                                                {
                                                                    Console.WriteLine("爱破解,爱鬼哥");
                                                                    Console.WriteLine("第一行:"+i + " " + j +"\n");
                                                                    Console.WriteLine("第二行:"  + k + " " + l + " " + m + "\n");
                                                                    Console.WriteLine("第三行:"  +n + " " + o + "  " + p);

                                                                    Console.ReadKey();
                                                                }
                                                                else
                                                                {
                                                                    continue;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                continue;
                                                            }

                                                        }
                                                        else
                                                        {
                                                            continue;
                                                        }

                                                    }
                                                    else
                                                    {
                                                        continue;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
            }
        }
    }
}



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

举报 使用道具

回复 支持 反对
xxoo    发表于 2015-9-11 10:59:15 | 显示全部楼层
看我的头像

举报 使用道具

回复 支持 反对
skyun1314    发表于 2015-9-11 17:58:14 | 显示全部楼层
看我的头像

举报 使用道具

回复 支持 反对
xxoo    发表于 2015-9-11 18:04:51 | 显示全部楼层
8个循环```

举报 使用道具

回复 支持 反对
rel    发表于 2015-9-13 15:04:17 | 显示全部楼层
本帖最后由 rel 于 2015-9-13 15:06 编辑


人肉算一下会算出个3元一次方程来。。。

#include "stdafx.h"

int main(int argc, char* argv[])
{
    int a , b, c, d, e, f, g, h;
        for (int i = 0;i<100;i++)
        {
        for (int j = 0;j<100;j++)
        {
            for (int k = 0;k<100;k++)
            {
                if (k+j !=0)
                {
                    if ((5-i*j) ==(i*k+4.0)/(k+j-9))
                    {
//                         printf("--------------------------------\r\n");
//                         printf("d:%d,g:%d,e:%d\r\n",i,j,k);
                        d = i;
                        g = j;
                        e = k;

                        b = 4+d*g;
                        if (b>13)
                        {
                            continue;
                        }
                        a = 13-b;
                        c = 4+d*e;
                        if (c>100)
                        {
                            continue;
                        }
                        f =9 -e-g;
                        if (f<0)
                        {
                            continue;
                        }
                        h = f+g-4;
                        if (h<0||h>100)
                        {
                            continue;
                        }

                        printf(" a:%d,b:%d,\r\n c:%d,d:%d,e:%d\r\n f:%d,g:%d,h:%d\r\n",a,b,c,d,e,f,g,h);
                        
                    }
                }
            }
        }
        }
        return 0;
}
[/mw_shl_code]

举报 使用道具

回复 支持 反对
chdlong    发表于 2015-9-13 19:16:36 | 显示全部楼层
鬼哥真是神题神解,呵呵         

举报 使用道具

回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表