Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

终于过了 ,数据中有循环赫赫。 看看我的恶心输入

Posted by first at 2006-03-06 12:10:17 on Problem 2023
那位提供点好的输入方法
 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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator