Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
老是WA,请大家帮帮忙#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator