【发布时间】:2015-04-30 21:01:11
【问题描述】:
我确信这是一个简单的问题。老实说,这应该是编写 SAT 求解器最简单的部分,但是,我应该让用户输入数据如下:
Sample Input:
1 <-- 1st number denotes the number of cases I will have
5 <-- 2nd number represents the number of variables, followed
1 2 3 who knows how many clauses.
-1 3 4
-2 -3 5
-5 -1 2
-4 1 -2
-4 -1 -2 -3 -5
*blank line separates the different cases*
.... followed by as many cases as the user said they had
所以,我将这些子句存储到字符串向量中,它们都将进入另一个向量。那么从用户那里获得这种输入的最佳方式是什么?最初没有给出子句数量的事实是最让我困惑的部分。我会尝试一段时间()......但我不知道如何终止它。我想我有点不确定 cin 在这种情况下会如何工作。
感谢您的所有帮助。
【问题讨论】:
-
为什么有六个“变量”?