解题啦解题啦
来来来,看看大家谁的思路好点,谁写的算法更简洁,更给力代码写的比较乱一点,大家有更好的代码欢迎上传~
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;
}
}
}
}
}
}
{:4_88:}看我的头像 看我的头像{:4_87:} 8个循环``` 本帖最后由 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;
}
鬼哥真是神题神解,呵呵
页:
[1]