题目链接:http://vj.hsacm.com/problem/visitOriginUrl.action?id=74912
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <vector>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
if (n == 0)
break;
int peo[205][205];
int happy[205];
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= n; ++j)
{
cin >> peo[i][j];
happy[i] = 1;
}
}
for (int k = 1; k <= n;)
{
int sum = 0;
for (int i = 1; i <= n; ++i)
sum += happy[i] * peo[k][i];
sum *= happy[k];
if (sum < 0)
{
happy[k] *= -1;
k = 1;
continue;
}
k++;
}
cout << "Yes" << endl;
for (int i = 1; i <= n; ++i)
cout << (happy[i] == 1 ? "+" : "-") << endl;
}
return 0;
}