小试一题

来看看这道爱因斯坦出的智商测试题:他说世界上有98%的人回答不出, 看看你是否属于另外的2%:

有5栋5种颜色的房子,每一位房子的主人国籍都不同。这5个人每人只喝一个牌子的饮料,只抽一个牌子的香烟,只养一种宠物。没有人有相同的宠物,抽相同牌子的香烟,喝相同的饮料。
已知:

1.英国人住在红房子里
2.瑞典人养了一条狗
3.丹麦人喝茶
4.绿房子在白房子左边
5.绿房子主人喝咖啡
6.抽PALL MALL烟的人养了一只鸟
7.黄房子主人抽DUNHILL烟
8.住在中间那间房子的人喝牛奶
9.挪威人住在第一间房子
10.抽混合烟的人住在养猫人的旁边
11.养马人住在DUNHILL烟的人旁边
12.抽BLUE MASTER烟的人喝啤酒
13.德国人抽PRINCE烟
14.挪威人住在蓝房子旁边
15.抽混合烟的人的邻居喝矿泉水

问题是: 谁养鱼?
看看你是不是在那2%里?

我没仔细想,就想写个程序来解决,但发现不好建立数据模型,所以就写了个模型工具来模拟。
Question.JPG

None.gif using  System;
None.gif
using  System.Drawing;
None.gif
None.gif
namespace  Country.Study
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif    
public enum Nationalities
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        None 
=0,
InBlock.gif        England,
InBlock.gif        Sweden,
InBlock.gif        Danmark,
InBlock.gif        Norway,
InBlock.gif        Germany,        
ExpandedSubBlockEnd.gif    }

InBlock.gif    
public enum Pets
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        None 
=0,
InBlock.gif        Dog,
InBlock.gif        Bird,
InBlock.gif        Horse,
InBlock.gif        Cat,
InBlock.gif        Fish,
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    
public enum HoseColors
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        None 
=0,
InBlock.gif        Red,
InBlock.gif        Green,
InBlock.gif        Yellow,
InBlock.gif        Blue,
InBlock.gif        White,
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    
public enum Tobaccos
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        None 
=0,
InBlock.gif        PALL_MALL,
InBlock.gif        DUNHILL,
InBlock.gif        BLUE_MASTER,
InBlock.gif        PRINCE,
InBlock.gif        Compound,
ExpandedSubBlockEnd.gif    }

InBlock.gif
InBlock.gif    
public enum Beverages
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        None 
= 0,
InBlock.gif        Tea,
InBlock.gif        Coffee,
InBlock.gif        Milk,
InBlock.gif        Spring,
InBlock.gif        Beer,
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// Summary description for Puzzle.
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class Puzzle
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
public Puzzle()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//
InBlock.gif            
// TODO: Add constructor logic here
InBlock.gif            
//
ExpandedSubBlockEnd.gif
        }

ExpandedSubBlockEnd.gif    }

InBlock.gif    
//
InBlock.gif
    [System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
InBlock.gif    
public class Person
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
public event EventHandler OnProperChanged;
InBlock.gif        
private Nationalities _Nationality;
InBlock.gif        
private HoseColors _HouseColor;
InBlock.gif        
private Tobaccos _Tobacco;
InBlock.gif        
private Beverages _Beverage;
InBlock.gif        
private Pets _Pet;
InBlock.gif        
//
InBlock.gif
        [System.ComponentModel.Category("Properties")]
InBlock.gif        
public Nationalities Nationality
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return this._Nationality;}
ExpandedSubBlockStart.gifContractedSubBlock.gif            
setdot.gif{this._Nationality = value;this.FireEvent();}
ExpandedSubBlockEnd.gif        }

InBlock.gif        [System.ComponentModel.Category(
"Properties")]
InBlock.gif        
public HoseColors HouseColor
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return this._HouseColor;}
ExpandedSubBlockStart.gifContractedSubBlock.gif            
setdot.gif{this._HouseColor = value;this.FireEvent();}
ExpandedSubBlockEnd.gif        }

InBlock.gif        [System.ComponentModel.Category(
"Properties")]
InBlock.gif        
public Tobaccos Tobacco
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return this._Tobacco;}
ExpandedSubBlockStart.gifContractedSubBlock.gif            
setdot.gif{this._Tobacco = value;this.FireEvent();}
ExpandedSubBlockEnd.gif        }

InBlock.gif        [System.ComponentModel.Category(
"Properties")]
InBlock.gif        
public Beverages Beverage
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return this._Beverage;}
ExpandedSubBlockStart.gifContractedSubBlock.gif            
setdot.gif{this._Beverage = value;this.FireEvent();}
ExpandedSubBlockEnd.gif        }

InBlock.gif        [System.ComponentModel.Category(
"Properties")]
InBlock.gif        
public Pets Pet
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return this._Pet;}
ExpandedSubBlockStart.gifContractedSubBlock.gif            
setdot.gif{this._Pet = value;this.FireEvent();}
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        [System.ComponentModel.Category(
"Event")]
InBlock.gif        
public bool Reset
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
getdot.gif{return false;}
InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this._Beverage = Beverages.None;
InBlock.gif                
this._HouseColor = HoseColors.None;
InBlock.gif                
this._Nationality = Nationalities.None;
InBlock.gif                
this._Pet = Pets.None;
InBlock.gif                
this._Tobacco = Tobaccos.None;
InBlock.gif                
this.FireEvent();
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        [System.ComponentModel.Browsable(
false)]
InBlock.gif        
public System.Drawing.Color    Color
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
switch(this._HouseColor)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
default:
InBlock.gif                    
case HoseColors.None:
InBlock.gif                        
return SystemColors.Control;
InBlock.gif                    
case HoseColors.Blue:
InBlock.gif                        
return Color.Blue;
InBlock.gif                    
case HoseColors.Green:
InBlock.gif                        
return Color.Green;
InBlock.gif                    
case HoseColors.Red:
InBlock.gif                        
return Color.Red;
InBlock.gif                    
case HoseColors.White:
InBlock.gif                        
return Color.White;
InBlock.gif                    
case HoseColors.Yellow:
InBlock.gif                        
return Color.Yellow;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
//
InBlock.gif
        public Person()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this._Beverage = Beverages.None;
InBlock.gif            
this._HouseColor = HoseColors.None;
InBlock.gif            
this._Nationality = Nationalities.None;
InBlock.gif            
this._Pet = Pets.None;
InBlock.gif            
this._Tobacco = Tobaccos.None;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public override string ToString()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//return base.ToString ();
InBlock.gif
            return string.Format(@"Nationality:{0}
InBlock.gifHouse Color:{1}
InBlock.gifPet:{2}
InBlock.gifTobacco:{3}
InBlock.gifBeverage:{4}
",this.Nationality,this.HouseColor,this.Pet,this.Tobacco,this.Beverage);
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void FireEvent()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if(this.OnProperChanged!=null)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.OnProperChanged(this,null);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

InBlock.gif    
//
ExpandedBlockEnd.gif
}

None.gif

None.gif using  System;
None.gif
using  System.Collections;
None.gif
using  System.ComponentModel;
None.gif
using  System.Drawing;
None.gif
using  System.Data;
None.gif
using  System.Windows.Forms;
None.gif
None.gif
namespace  Country.Study
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// Summary description for PersonControl.
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class PersonControl : System.Windows.Forms.UserControl
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
private Person _Person;// = new Person();
InBlock.gif
        public Person Person
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this._Person;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
private int _LastX = 0;
InBlock.gif        
private int _LastY = 0;
InBlock.gif        
private bool _MousDown = false;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary> 
InBlock.gif        
/// Required designer variable.
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private System.ComponentModel.Container components = null;
InBlock.gif
InBlock.gif        
public PersonControl()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
// This call is required by the Windows.Forms Form Designer.
InBlock.gif
            InitializeComponent();
InBlock.gif
InBlock.gif            
// TODO: Add any initialization after the InitializeComponent call
InBlock.gif
            this._Person = new Person();
InBlock.gif            
this._Person.OnProperChanged +=new EventHandler(_Person_OnProperChanged);
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary> 
InBlock.gif        
/// Clean up any resources being used.
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        protected override void Dispose( bool disposing )
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if( disposing )
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(components != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    components.Dispose();
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
base.Dispose( disposing );
ExpandedSubBlockEnd.gif        }

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
Component Designer generated code#region Component Designer generated code
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary> 
InBlock.gif        
/// Required method for Designer support - do not modify 
InBlock.gif        
/// the contents of this method with the code editor.
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private void InitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            components 
= new System.ComponentModel.Container();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
InBlock.gif        
protected override void OnMouseDown(MouseEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
base.OnMouseDown (e);
InBlock.gif            
this._MousDown = true;
InBlock.gif            
this._LastX = e.X;
InBlock.gif            
this._LastY = e.Y;
InBlock.gif            Cursor.Current 
= Cursors.Hand;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
protected override void OnMouseUp(MouseEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
base.OnMouseUp (e);
InBlock.gif            
this._MousDown = false;
InBlock.gif            Cursor.Current 
= Cursors.Default;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
protected override void OnMouseMove(MouseEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
base.OnMouseMove (e);
InBlock.gif            
if(!this._MousDown) return;
InBlock.gif            
this.Left += e.X - this._LastX;
InBlock.gif            
this.Top += e.Y - this._LastY;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
protected override void OnPaint(PaintEventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//base.OnPaint (e);
InBlock.gif            
//e.Graphics.Clear(Color.Black);
InBlock.gif
            Rectangle m_Rec = new Rectangle(1,1,this.Width-2,this.Height-2);
InBlock.gif            e.Graphics.DrawRectangle(Pens.Black,m_Rec);
InBlock.gif            e.Graphics.DrawString(
this.Person.ToString(),this.Font,Brushes.Black,m_Rec);
InBlock.gif            
base.OnPaint (e);
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
private void _Person_OnProperChanged(object sender, EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.BackColor = this.Person.Color;
InBlock.gif            
this.Refresh();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

None.gif using  System;
None.gif
using  System.Drawing;
None.gif
using  System.Collections;
None.gif
using  System.ComponentModel;
None.gif
using  System.Windows.Forms;
None.gif
None.gif
namespace  Country.Study
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// Summary description for Form5.
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class Form5 : System.Windows.Forms.Form
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
private Country.Study.PersonControl personControl1;
InBlock.gif        
private System.Windows.Forms.PropertyGrid propertyGrid1;
InBlock.gif        
private Country.Study.PersonControl personControl2;
InBlock.gif        
private Country.Study.PersonControl personControl3;
InBlock.gif        
private Country.Study.PersonControl personControl4;
InBlock.gif        
private Country.Study.PersonControl personControl5;
InBlock.gif        
private System.Windows.Forms.Splitter splitter1;
InBlock.gif        
private System.Windows.Forms.Panel panel1;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// Required designer variable.
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private System.ComponentModel.Container components = null;
InBlock.gif
InBlock.gif        
public Form5()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//
InBlock.gif            
// Required for Windows Form Designer support
InBlock.gif            
//
InBlock.gif
            InitializeComponent();
InBlock.gif
InBlock.gif            
//
InBlock.gif            
// TODO: Add any constructor code after InitializeComponent call
InBlock.gif            
//
ExpandedSubBlockEnd.gif
        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// Clean up any resources being used.
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        protected override void Dispose( bool disposing )
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if( disposing )
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(components != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    components.Dispose();
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
base.Dispose( disposing );
ExpandedSubBlockEnd.gif        }

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
Windows Form Designer generated code#region Windows Form Designer generated code
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// Required method for Designer support - do not modify
InBlock.gif        
/// the contents of this method with the code editor.
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private void InitializeComponent()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.personControl1 = new Country.Study.PersonControl();
InBlock.gif            
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
InBlock.gif            
this.personControl2 = new Country.Study.PersonControl();
InBlock.gif            
this.personControl3 = new Country.Study.PersonControl();
InBlock.gif            
this.personControl4 = new Country.Study.PersonControl();
InBlock.gif            
this.personControl5 = new Country.Study.PersonControl();
InBlock.gif            
this.splitter1 = new System.Windows.Forms.Splitter();
InBlock.gif            
this.panel1 = new System.Windows.Forms.Panel();
InBlock.gif            
this.panel1.SuspendLayout();
InBlock.gif            
this.SuspendLayout();
InBlock.gif            
// 
InBlock.gif            
// personControl1
InBlock.gif            
// 
InBlock.gif
            this.personControl1.Location = new System.Drawing.Point(88);
InBlock.gif            
this.personControl1.Name = "personControl1";
InBlock.gif            
this.personControl1.Size = new System.Drawing.Size(15288);
InBlock.gif            
this.personControl1.TabIndex = 0;
InBlock.gif            
this.personControl1.Click += new System.EventHandler(this.personControl1_Click);
InBlock.gif            
// 
InBlock.gif            
// propertyGrid1
InBlock.gif            
// 
InBlock.gif
            this.propertyGrid1.CommandsVisibleIfAvailable = true;
InBlock.gif            
this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Bottom;
InBlock.gif            
this.propertyGrid1.LargeButtons = true;
InBlock.gif            
this.propertyGrid1.LineColor = System.Drawing.SystemColors.ScrollBar;
InBlock.gif            
this.propertyGrid1.Location = new System.Drawing.Point(0253);
InBlock.gif            
this.propertyGrid1.Name = "propertyGrid1";
InBlock.gif            
this.propertyGrid1.PropertySort = System.Windows.Forms.PropertySort.Categorized;
InBlock.gif            
this.propertyGrid1.RightToLeft = System.Windows.Forms.RightToLeft.No;
InBlock.gif            
this.propertyGrid1.Size = new System.Drawing.Size(824216);
InBlock.gif            
this.propertyGrid1.TabIndex = 1;
InBlock.gif            
this.propertyGrid1.Text = "propertyGrid1";
InBlock.gif            
this.propertyGrid1.ToolbarVisible = false;
InBlock.gif            
this.propertyGrid1.ViewBackColor = System.Drawing.SystemColors.Window;
InBlock.gif            
this.propertyGrid1.ViewForeColor = System.Drawing.SystemColors.WindowText;
InBlock.gif            
// 
InBlock.gif            
// personControl2
InBlock.gif            
// 
InBlock.gif
            this.personControl2.Location = new System.Drawing.Point(3288);
InBlock.gif            
this.personControl2.Name = "personControl2";
InBlock.gif            
this.personControl2.Size = new System.Drawing.Size(15288);
InBlock.gif            
this.personControl2.TabIndex = 0;
InBlock.gif            
this.personControl2.Click += new System.EventHandler(this.personControl1_Click);
InBlock.gif            
// 
InBlock.gif            
// personControl3
InBlock.gif            
// 
InBlock.gif
            this.personControl3.Location = new System.Drawing.Point(1688);
InBlock.gif            
this.personControl3.Name = "personControl3";
InBlock.gif            
this.personControl3.Size = new System.Drawing.Size(15288);
InBlock.gif            
this.personControl3.TabIndex = 0;
InBlock.gif            
this.personControl3.Click += new System.EventHandler(this.personControl1_Click);
InBlock.gif            
// 
InBlock.gif            
// personControl4
InBlock.gif            
// 
InBlock.gif
            this.personControl4.Location = new System.Drawing.Point(65616);
InBlock.gif            
this.personControl4.Name = "personControl4";
InBlock.gif            
this.personControl4.Size = new System.Drawing.Size(15288);
InBlock.gif            
this.personControl4.TabIndex = 0;
InBlock.gif            
this.personControl4.Click += new System.EventHandler(this.personControl1_Click);
InBlock.gif            
// 
InBlock.gif            
// personControl5
InBlock.gif            
// 
InBlock.gif
            this.personControl5.Location = new System.Drawing.Point(4968);
InBlock.gif            
this.personControl5.Name = "personControl5";
InBlock.gif            
this.personControl5.Size = new System.Drawing.Size(15288);
InBlock.gif            
this.personControl5.TabIndex = 0;
InBlock.gif            
this.personControl5.Click += new System.EventHandler(this.personControl1_Click);
InBlock.gif            
// 
InBlock.gif            
// splitter1
InBlock.gif            
// 
InBlock.gif
            this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom;
InBlock.gif            
this.splitter1.Location = new System.Drawing.Point(0250);
InBlock.gif            
this.splitter1.Name = "splitter1";
InBlock.gif            
this.splitter1.Size = new System.Drawing.Size(8243);
InBlock.gif            
this.splitter1.TabIndex = 2;
InBlock.gif            
this.splitter1.TabStop = false;
InBlock.gif            
// 
InBlock.gif            
// panel1
InBlock.gif            
// 
InBlock.gif
            this.panel1.Controls.Add(this.personControl4);
InBlock.gif            
this.panel1.Controls.Add(this.personControl1);
InBlock.gif            
this.panel1.Controls.Add(this.personControl5);
InBlock.gif            
this.panel1.Controls.Add(this.personControl2);
InBlock.gif            
this.panel1.Controls.Add(this.personControl3);
InBlock.gif            
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
InBlock.gif            
this.panel1.Location = new System.Drawing.Point(00);
InBlock.gif            
this.panel1.Name = "panel1";
InBlock.gif            
this.panel1.Size = new System.Drawing.Size(824250);
InBlock.gif            
this.panel1.TabIndex = 3;
InBlock.gif            
// 
InBlock.gif            
// Form5
InBlock.gif            
// 
InBlock.gif
            this.AutoScaleBaseSize = new System.Drawing.Size(716);
InBlock.gif            
this.ClientSize = new System.Drawing.Size(824469);
InBlock.gif            
this.Controls.Add(this.panel1);
InBlock.gif            
this.Controls.Add(this.splitter1);
InBlock.gif            
this.Controls.Add(this.propertyGrid1);
InBlock.gif            
this.Font = new System.Drawing.Font("Verdana"9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
InBlock.gif            
this.Name = "Form5";
InBlock.gif            
this.Text = "Form5";
InBlock.gif            
this.panel1.ResumeLayout(false);
InBlock.gif            
this.ResumeLayout(false);
InBlock.gif
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
InBlock.gif        
private void personControl1_Click(object sender, System.EventArgs e)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.propertyGrid1.SelectedObject = (sender as PersonControl).Person;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif


自己慢慢的推理吧。


小做了一个修改:最后结果:
德国人养鱼,在第四间的绿色房子里,喝Coffee,抽PRINCE
思考顺序:
9.挪威人住在第一间房子
14.挪威人住在蓝房子旁边
8.住在中间那间房子的人喝牛奶

4.绿房子在白房子左边
1.英国人住在红房子里
7.黄房子主人抽DUNHILL烟

11.养马人住在DUNHILL烟的人旁边

4.绿房子在白房子左边
1.英国人住在红房子里

5.绿房子主人喝咖啡
15.抽混合烟的人的邻居喝矿泉水
3.丹麦人喝茶
12.抽BLUE MASTER烟的人喝啤酒
13.德国人抽PRINCE烟
6.抽PALL MALL烟的人养了一只鸟
2.瑞典人养了一条狗
10.抽混合烟的人住在养猫人的旁边

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值