http://acm.hdu.edu.cn/showproblem.php?pid=2167
Input
Each board is expressed as a series of lines, where each line is a space-delimited series of numbers. A blank line marks the end of each board (including the last one)(根据题意最后也有一个空行)
#include
<
iostream
>
#include
<
sstream
>
#include
<
string
>
#include
<
vector
>
using
namespace
std;
bool
run()
...
{
string s;
vector <vector <int> > v;
while(true)
...{
if (!getline(cin,s)) return false;
if (s=="")break;
stringstream ss(s);
int t;
vector <int> tv;
while(ss>>t)
...{
tv.push_back(t);
}
v.push_back(tv);
}
for(int i=0;i<v.size();i++)
...{
for(int j=0;j<v[i].size();j++)
cout << " "<<v[i][j];
cout << endl;
}
cout <<endl;
return true;
}


int
main()
...
{
while(run());
return 0;
}
return true;
}


int
main()
...
{
while(run());
return 0;
}
140

被折叠的 条评论
为什么被折叠?



