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 hansonzh at 2009-03-04 15:48:15 on Problem 1598
#include<iostream>
#include<string>
using namespace std;

struct excuse
{
   int num;
   string str;
};
excuse ex[21];


string keywords[21];

string proce(int start, int end, string st)
{
	char temp[71];
	int j = 0;
	for(int i = start; i < end; i ++)
	temp[j ++] = st[i];
	temp[j] = '\0';
	return (string)temp;
}

int main()
{
    int k, e;
    char tag;
    char temp[71];
	int c = 0;
    while(cin.get(tag) && tag != '\n' && tag != EOF)
    {
	   c ++;
       cin.ignore();
       k = tag - 48;
       cin >> e;
       for(int i = 0; i < k; i ++)
       cin >> keywords[i];
	   cin.ignore();
       for(int i = 0; i < e; i ++)
       {
           ex[i].num = 0;
           cin.getline(temp, 71);
           ex[i].str = (string)(temp);
       }   

	   for(int i = 0; i < e; i ++)
	   {
		   int start = 0, end;
		   int len = 0;
		   string temp_str;
		   bool flag = true;
		   for(int j = 0; j < strlen(ex[i].str.c_str()); j ++)
		   {
			   if(flag)
			   {
				   if((ex[i].str[j] >= 'A' && ex[i].str[j] <= 'Z') || (ex[i].str[j] >= 'a' && ex[i].str[j] <= 'z'))
				   {
					   start = j;
					   flag = false;
				   }
				   continue;
			   }
			   else
			   {
				   if((ex[i].str[j] >= 'A' && ex[i].str[j] <= 'Z') || (ex[i].str[j] >= 'a' && ex[i].str[j] <= 'z'))
				   len ++;
				   else
				   {
					   if(len != 0)
					   {
						   end = start + len + 1;
						   temp_str = proce(start, end, ex[i].str);
						   for(int m = 0; m < k; m ++)
						   {
							   if(stricmp(keywords[m].c_str(), temp_str.c_str()) == 0)  
							   ex[i].num ++;
						   }
					   }
					   len = 0;
					   flag = true;
				   }
			   }
		   }
	   }

	   int max = ex[0].num;
	   for(int i = 1; i < e; i ++)
	   if(max < ex[i].num) max = ex[i].num;

	   cout << "Excuse Set #" << c << endl;
	   for(int i = 0; i < e; i ++)
	   if(max == ex[i].num) cout << ex[i].str << endl;
	   cout << endl;
    }
    system("pause");
    return 0;
}
以上代码在自己的机子上运行的好好的,可提交的时候连编译都通不过,什么原因啊??快崩溃了!!

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