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.)
another list and result Comment 3 of 3 |

ABA    4  ZZZ   78
ABBA    6  ZZZS   97
ABACA    8  YUZUS  112
BACCAE   15  XYSTUS  128
CABBAGE   21  ZYZZYVA  151
CABBAGED   25  ZYZZYVAS  170
BECCACCIA   30  TSUTSUMUS  173
DEADHEADED   41  PUTTYROOTS  189
ABRACADABRA   52  TRUSTWORTHY  207

        program asd
        implicit none
        character name*12,names(3:11)*9,line(11),line11*11,amin*11,amax*11
        integer i,j,k,cmin,cmax,cost
        equivalence(line(1),line11)
        data names/'3n1292.','4n5454.','5n12478.','6n22157.',
        1 '7n32909.','8n40161.','9n40727.','10n35529.','11n27893.'/
           do i=3,11
           name=trim(names(i))//'txt'
           open(2,file=name,status='old')
                cmax=0
                cmin=10**5
                do j=1,400000
                read(2,3,end=4)(line(k),k=1,i)
3               format(11a1)
                   cost=0
                   do k=1,i
                   cost=cost+ichar(line(k))-64
                   enddo
                   if(cost.lt.cmin)then
                   cmin=cost
                   amin=line11
                   endif
                   if(cost.gt.cmax)then
                   cmax=cost
                   amax=line11
                   endif
                enddo
4          print 5,trim(amin),cmin,trim(amax),cmax
5          format(a11,2x,i3,2x,a11,2x,i3)
           enddo
        end

  Posted by Steven Lord on 2023-08-16 13:02:32
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 (0)
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