1. Multiple Dwellings
    Baker, Cooper, Fletcher, Miller and Smith live on different floors of an apartment house that contains only five floors.
    Baker does not live on the top floor. Cooper does not live on the bottom floor.
    Fletcher does not live on either the top or the bottom floor. Miller lives on a higher floor than does Cooper.
    Smith does not live on a floor adjacent to Fletchers.
    Fletcher does not live on a floor adjacent to Coopers. Where does everyone live?

--Baker, Cooper, Fletcher, Miller and Smith住在一座房子的不同楼层.

--Baker 不住顶层.

--Cooper不住底层.

--Fletcher 既不住顶层也不住底层.
--Miller住得比Cooper高.
--Smith住的楼层和Fletcher不相邻.
--Fletcher住的楼层和Cooper不相邻.

  1.  
  1. select*from
  2. (select (number) Baker from master.dbo.spt_values where type='P' and number between 1 and 5 ) as a,
  3. (select (number) Cooper from master.dbo.spt_values where type='P' and number between 1 and 5 ) as b,
  4. (select (number) Fletcher from master.dbo.spt_values where type='P' and number between 1 and 5 ) as c ,
  5. (select (number) Miller from master.dbo.spt_values where type='P' and number between 1 and 5 ) as d,
  6. (select (number) Smith from master.dbo.spt_values where type='P' and number between 1 and 5 ) as e
  7. where
  8. Baker<>5 and
  9. Cooper<>1 and
  10. Fletcher not in (1,5) and
  11. Miller>Cooper and
  12. abs(Smith-Fletcher)<>1 and
  13. abs(Fletcher-Cooper)<>1
  14. and Baker<>Cooper
  15. and Baker<>Fletcher
  16. and Baker<>Miller
  17. and Baker<>Smith
  18. and Cooper<>Fletcher
  19. and Cooper<>Miller
  20. and Cooper<>Smith
  21. and Fletcher<>Miller
  22. and Fletcher<>Smith
  23. and Smith<>Miller

查询结果

SQL谜题(楼层谜题)的更多相关文章

  1. Java谜题——库谜题

    1.Java中的不可变对象和可变对象 (1)不可变类:当你获得这个类的实例的引用之后,你不可以改变这个实例的内容.比如:String,BigInteger,BigDecimal,还有基本数据类型的封装 ...

  2. Java谜题——类谜题(二)

    1.域的隐藏 代码如下: class Base { public String className = "Base"; } class Derived extends Base { ...

  3. [TJOI2015] 棋盘

    Description 为了提高智商,ZJY去新世界旅游了.可是旅游过后的ZJY杯具的发现要打开通往原来世界的门,必须要解开门上面画的谜题.谜题是这样的:有个\(n\)行\(m\)列的棋盘,棋盘上可以 ...

  4. 比特币运行原理[z]

    https://baijiahao.baidu.com/s?id=1581755535769652543&wfr=spider&for=pc 这篇文章主要讲解比特币是什么?它的运行原理 ...

  5. 【nodejs】理想论坛帖子下载爬虫1.07 使用request模块后稳定多了

    在1.06版本时,访问网页采用的时http.request,但调用次数多以后就问题来了. 寻找别的方案时看到了https://cnodejs.org/topic/53142ef833dbcb076d0 ...

  6. nodejs源码—初始化

    概述 相信很多的人,每天在终端不止一遍的执行着node这条命令,对于很多人来说,它就像一个黑盒,并不知道背后到底发生了什么,本文将会为大家揭开这个神秘的面纱,由于本人水平有限,所以只是讲一个大概其,主 ...

  7. SQL 谜题(硬币的组合)

    问题:早在ITPUB中看过有个SQL高手,喜欢出谜题,以下是一个谜题.我试用SQL SERVER解决此问题. 用1分,5分,10分,25分,50分硬币凑成一元,总共有几种组合办法? SELECT'1* ...

  8. SQL谜题(加减符号替代)

    问题:将以下字符串”.1.2.3.4.5.6.7.8.9 = 1“中的符号点(.)更改为符号加(+)或符号(-),有多少种方法?请用SQL解决此问题 计算过程: CREATE TABLE #(VAL ...

  9. SQL 谜题(父亲的邮票)

    问题:父亲需要些1分,2分,3分,5分,10分的邮票, 其中两种各买四张,另外的三种各买三张 我忘记是哪几种了?他给了我一些10分硬币,金额刚好买这些邮票 计算及分析过程: --通过极限算法,若都是3 ...

随机推荐

  1. 怎么把本地项目和远程git仓库相连通

    1. 打开在你的项目文件夹,输入下面的命令 git init 输完上面的命令,文件夹中会出现一个.git文件夹,如下图所示,其他的的文件也会出现蓝色小问号的标志 2. 添加所有文件 git add . ...

  2. github怎么退出组织和删除自己创建的组织

    1. 点击头像,进入settings 2. 点击左侧菜单中的 Organizations 切换到Origanizations后,右侧面板中会出现所有的oragnizations,我这里只有一个,是我自 ...

  3. juery学习6——焦点事件

    参考资料 深入理解javascript中的焦点管理:http://www.cnblogs.com/xiaohuochai/p/5874447.html

  4. vs插件ZunKoIDE

    →〇,配置: vs →壹,默认背景图路径 C:\Users\{用户名}\AppData\Local\Microsoft\VisualStudio\14.0\Extensions\gqyswd1b.dv ...

  5. FFmpeg-for IOS 一[安装]

    FFmpeg编译环境搭建 准备 下载 gas-preprocessor 下载 ffmpeg包,ffmpeg 安装yasm,先安装homebrew,输入:ruby -e "$(curl -fs ...

  6. 如何安装 第三方 Go 离线包? (GOPATH、 go install)

    有时候 go get 比较慢,可以考虑用迅雷等下载工具下载下来,然后再本地安装, 如:code.google.com/p/go.net/websocket,如何安装这些离线包? 先在你的 GOPATH ...

  7. js传入参数为字符串问题

    示例: var device_mac="11qweq234ert"; //第一种方式会报错:Onclick SyntaxError: identifier starts immed ...

  8. 部分Android手机拍照后照片被旋转的解决方案

      在部分Android手机(如MT788.Note2)上,使用Camera拍照以后,得到的照片会被自动旋转(90°.180°.270°),这个情况很不符合预期.仔细分析了一下,因为照片属性中是存储了 ...

  9. python Unicode 编码解码

    1 #将Unicode转换成普通的Python字符串:"编码(encode)" 2 unicodestring = u"Hello world" 3 utf8s ...

  10. MAC实用的小工具

    一.XtraFinder(右键菜单扩展) http://www.xuebuyuan.com/173454.html http://www.mamicode.com/info-detail-111618 ...