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 hdm29682 at 2006-02-17 19:14:07 on Problem 1171
#include <stdio.h>
#include <string.h>
const int table[26]={2,5,4,4,1,6,5,5,1,7,6,3,5,2,3,5,7,2,1,2,4,6,6,7,5,7};
struct {int s,l;}word[40000];
void main(){
	char str[8];int Max=0;
	scanf("%s",str);
	for(int z=0;z<40000&&*str!='.';z++){
		word[z].s=0;
		for(int i=0;i<7&&str[i]!=0;i++){
			word[z].s+=table[str[i]-'a'];
			word[z].l=i;
		}		
		if(word[z].s>Max)Max=word[z].s;
		scanf("%s",str);
	}
	for(int i=0;i<z;i++)
		for(int j=0;j<z;j++)
			if(i!=j){
				if(word[i].l+word[j].l<8){
					if(Max<word[i].s+word[j].s)Max=word[i].s+word[j].s;
				} 
			}
			printf("%d\n",Max);
}

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