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

为什么wa了啊?求助

Posted by winer at 2009-03-26 23:44:04
#include<iostream>
using namespace std;
#include<algorithm>
#include<string.h>
int main(void)
{
	char array[101];
	int n,m;
	int i=0;
	cin>>n;
 	int j=n;
	while(j--)
	{
		cin>>array[i];
		i++;
	}
	array[i]='\0';
	sort(array,array+strlen(array));//*****此处不能把strlen(array)改为n
	m=n/2+1;
	int k=0;
	while(m--)
	{
		k=k+(((array[n-m-2]-'0')/2)+1);
	}
	cout<<k<<endl;
	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