| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
终于过了 ,数据中有循环赫赫。 看看我的恶心输入那位提供点好的输入方法
for(i = 1; i <= c; i ++)
{
cin >> ce[i];
getline(cin, text[i]); //输入一行
pos1 = text[i].find_first_of('"', 0); //找到"
pos2 = text[i].find_last_of('"', text[i].length());//找到"
if(ce[i] == 'C')
{
choice[i][0] = 0;
choice[i][1] = 0;
int pos = pos2 + 2;
while(text[i][pos] >= '0' && text[i][pos] <= '9')
{
choice[i][0] = choice[i][0]*10 + text[i][pos] - '0';
pos ++;
}
// 用最笨的方法得到数字 汗
pos ++;
while(text[i][pos] >= '0' && text[i][pos] <= '9')
{
choice[i][1] = choice[i][1]*10 + text[i][pos] - '0';
pos ++;
}
vchoice.push_back(i);
}
else
{
end[i] = text[i].substr(pos2 + 2, text[i].length() - pos2 - 2);
//得到结果
vend.push_back(i);
}
text[i] = text[i].substr(pos1 + 1, pos2 - pos1 - 1); //得到引号内的 text
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator