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 3322 at 2004-12-20 17:21:23 on Problem 1159
#include<stdio.h> 
#include<math.h> 
#include<malloc.h>
void main(){
	int n,i,k,j,p,s=0;
	char *c;
	scanf("%d\n",&n);

	c=(char *)malloc(sizeof(char)*n);
	for(i=0;i<n;i++){
        scanf("%c",(c+i));
	}
	for (k=48;k<=57;k++){
	  for(p=0,j=0;j<n;j++){
		  
		  if(*(c+j)==k) {p=p+1;}
	  }
	  	  if (p%2==1) s=s+1;
	}
   
	for(k=65;k<=90;k++){
	  for(p=0,j=0;j<n;j++){
		  if(*(c+j)==k) p=p+1;
	  }
	  if (p%2==1) s=s+1;
	}
	
	for(k=97;k<=122;k++){
	  for(p=0,j=0;j<n;j++){
		  if(*(c+j)==k) p=p+1;
	  }
	  if (p%2==1) s=s+1;
	}
    
	if(s!=0) printf("%d\n",s-1);
	else printf("0\n");
  
	


}

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