- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
fama.cs
资源名称:Visual.rar [点击查看]
上传用户:yiyuerguo
上传日期:2014-09-27
资源大小:3781k
文件大小:1k
源码类别:
C#编程
开发平台:
Others
- using System;
- public class myApp
- {
- static void Main()
- {
- int a,b,c,d;
- for(a = 1;a < 40;a++)
- for(b = 1;b < 40;b++)
- for(c = 1;c < 40;c++)
- for(d = 1;d < 40;d++)
- {
- if(a + b + c + d == 40)
- {
- if(Check(a,b,c,d))
- {
- Console.WriteLine("{0}t{1}t{2}t{3}",a,b,c,d);
- }
- }
- }
- Console.WriteLine("DONE");
- Console.ReadLine();
- }
- static bool Check(int a,int b,int c,int d)
- {
- int i,j,k,l;
- i = j = k = l = 0;
- for(int r = 1;r <= 40;r++)
- {
- for(i = -1;i <= 1;i++)
- for(j = -1;j <= 1;j++)
- for(k = -1;k <= 1;k++)
- for(l = -1;l <= 1;l++)
- {
- //如果可以称r重量 则直接跳出去称r+1的重量
- if(a*i + b*j + c*k + d*l == r)
- goto NextLoop;
- }
- //如果不能称r重量,则说明失败 返回假
- return false;
- NextLoop:
- continue;
- }
- return true;
- }
- }