题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1824思路分析:该问题为2-SAT问题;需要注意逻辑推理的等价性;(1)题目第一个条件:每一个队或者队长留下或者其与两名队员同时留下,或者表明只能为两种情况中的一种;假设三人为A,B,C,队长为A,0表示...
分类:
其他好文 时间:
2015-07-27 22:52:44
阅读次数:
132
operatingSystemVersion 为了更复杂的版本比较,operatingSystemVersion能够被直接检查。将它和Swift模式比较和switch语句组合,可以使得代码更简洁。 let?os?=?NSProcessInfo().operatingSystemVersion swit...
分类:
移动开发 时间:
2015-07-27 19:20:01
阅读次数:
181
在学习Java过程中,字符串碰到过String和StringBuffer,其中前者是不可变的,不能对字符串进行修改;后者是可变的,可以不断修改。来到Swift中,对字符串的定义变的更加简单。
(1)概述
Swift中,用let 声明的是字符串常量,不能进行修改。用var声明的是字符串变量,可以修改。通过代码来演示。
let str1 = "Hello1"
var str2 = "Hello2...
分类:
编程语言 时间:
2015-07-27 13:21:32
阅读次数:
210
程序员常常被认为是呆板,宅,不解风情的一帮人。但是有时候,我们也可以使用自己的拿手本领来表现我们的浪漫。由于Swift语言是支持Unicode编码的,而Unicode最新已经支持emoji(绘文字)的表情符号。所以,我想,我们是不是可以使用Swift+Unicode来浪漫一把呢?
废话不说,直接上代码:
let love = "某某某,我\u{1F491}\u{1F492}\u{...
分类:
编程语言 时间:
2015-07-27 13:10:55
阅读次数:
156
??
/*
Let the Balloon Rise
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 89272 Accepted Submission(s): 33796
Problem Description
Con...
分类:
其他好文 时间:
2015-07-26 21:04:34
阅读次数:
105
Some said Live View could only boot up images acquired from 32bit OS evidence. I have to say that it's not true. Ok, the best way to prove it is let t...
分类:
其他好文 时间:
2015-07-26 17:14:52
阅读次数:
159
这篇博客将会学习到Swift中的常量Constants和变量Variable。这是学习语言的基础。其中可以看到Swift每句后面基本都是没有;分号的,如果有加;分号的习惯,也可以加上。
(1)常量声明:Swift将会使用关键字let来声明一个常量。定义常量之后不能再进行修改,否则会报错。
let maxNum = 100
maxNum = 200 //这里会报错,常量值不能进行修改;
...
分类:
编程语言 时间:
2015-07-26 14:17:03
阅读次数:
112
Well, a dynamic programming problem. Let's first define its statedp[i][j]to be the number of distinct subsequences oft[0..i - 1]ins[0..j - 1]. Then we...
分类:
其他好文 时间:
2015-07-26 14:03:02
阅读次数:
99
poj 1860 Currency ExchangeDescription
Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations...
分类:
其他好文 时间:
2015-07-26 11:12:33
阅读次数:
175
05-图2. Saving James Bond - Easy Version (25)
时间限制
200 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
CHEN, Yue
This time let us consider...
分类:
其他好文 时间:
2015-07-26 06:15:34
阅读次数:
143