Pages

Thursday, October 22, 2009

UVA Problem#11530


Question:
http://uva.onlinejudge.org/external/115/11530.html

Solution:
int main(){
.....
..... 

if(s[j]=='a' || s[j]=='d' || s[j]=='g' || s[j]=='j' || s[j]=='m' 
|| s[j]=='p' || s[j]=='t' || s[j]=='w' || s[j]==' '){
c += 1;
}else if(s[j]=='b' || s[j]=='e' || s[j]=='h' || s[j]=='k' 
|| s[j]=='n' || s[j]=='q' || s[j]=='u' || s[j]=='x'){
c += 2;
}else if(s[j]=='c' || s[j]=='f' || s[j]=='i' || s[j]=='l' || 
s[j]=='o' || s[j]=='r' || s[j]=='v' || s[j]=='y'){
c += 3;
}else{
c += 4;
}
....
.... 
 
}


No comments:

Post a Comment