All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Cheap or expensive (Posted on 2023-08-16) Difficulty: 2 of 5
If one assigns $ prices to a letter by its place in the English alphabet i.e. A=1, B=2, .. ..Y=25, Z=26 and the price of a word equals sum of its letters' values - (e.g, DOG is valued @ US$ 26)

find the n-letter words with the lowest and the highest prices:

n=3, 4, .... 10, 11

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution from my word list | Comment 1 of 3
for i=3:11
  low(i)=99999;high(i)=0;
end
loww=string.empty; highw=string.empty;
fid=fopen('c:\words\words.txt','r');
while ~feof(fid)
  w=fgetl(fid);
  if w==lower(w)
    t=sum(w-'a'+1);
    lw=length(w);
    if lw>=3 && lw<=11
      if t<low(lw)
        low(lw)=t;
        loww(lw)=string(w);
      end
      if t>high(lw)
        high(lw)=t;
        highw(lw)=string(w);
      end
    end
  end
end
fclose('all');
for i=3:11
  fprintf('%s %d %s %3d\n',loww(i),low(i),highw(i),high(i))
end

finds

>> cheapOrExpensive
aba 4 wry  66
abba 6 xyst  88
abaca 8 muzzy 111
baccae 15 xystus 128
cabbage 21 zyzzyva 151
cabbaged 25 zyzzyvas 170
beachhead 37 susurrous 171
deadheaded 41 puttyroots 189
abracadabra 52 trustworthy 207


  Posted by Charlie on 2023-08-16 09:22:52
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information