Cody

# Problem 2215. Power supply: 230V to 115V

Solution 2037232

Submitted on 27 Nov 2019 by Allan Smith
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = 230; y = transformer(x); y_correct = 115; if ~isequal(y,y_correct) disp('That is not correct!'); disp('ÆÆÆÆÆÆÆÆÆÆÆÆÈØ8áÿèqBDüaZF\$TWËF®H0ÑÓKÛÆÆÆÈÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆÆ'); disp('ÆÆÆÆÆÆÆÉÔ\$ÜWÃ§Xwí/+«}{}º°{×}pÔ¿*/&v&F§ÉgÁÂÔÔÔÆÆÆÆÆÆÆÆÆÆÆÆ'); disp('ÆÆÆÆÆÆÔÔpæ¼í¢rîC/ìn[**ª°"²_!*\"_^¬ï7&¼n/V2¼ÿ§ÖHÔÆÆÆÆÆÆÆÆÆ'); disp('ÆÆÆÆWÐ0õCtîv½»¬°"¡^¬°³;:²-::÷";^¬¬³°÷¬(}(}{I¾\$ÖE¶MÈÆÆÆÆÆÆ'); disp('ÆÆÆÛP9{{{ï{}ª°³º°²ª²,:::¨¨¨¸'';::¹¹;²ª*{}|¬}íí<t=åÚBÔÕÆÆÆÆ'); disp('ÆÆÆÐÿj&£j{/»°°³"_;;¹;:¸.¸¨¸¸¸¨,¨,''^^°¬¡"ª¦¦{¿{î46bôBÆÈÑÕÆ'); disp('ÆÆÆÕKC¿}¦º~²²!^;:¨¸¨¸¨¸··´·.¸¨¸¸¸:;::~~¯°÷÷{(*<}íIàãK¶ÑÑÆ'); disp('ÆÆÔMýwri¦¯;'':''::¨´.¨ ·· ···`¨¨:;,,¨¨,;²"°°°"_°÷{r±¼FÛÆÆ'); disp('ÆÆ§Tî{¬¬º":;,¸´¸``.·· · ·····´.´···..`¸¨:;__^¯"÷{i{zagWÈ'); disp('ÆÆÖ¼l|²²"¬²;¸.··· · · ······´.¨:_²¨`¸¨:;_ª°¬°¦»}[uaßN'); disp('ÈÔ©n/÷º""_,¸´···· ·········.´¸¨:::-¹;,::;^°*|{+}}}>J5F'); disp('ÆpIc}*«÷²_:¨¸¸`· ´¸.········.``¸¸¨,;­;;;:;­²"ª÷¦}»}vI6ë'); disp('Èdc+¦/}÷"-:''¨`·· ¨,`.·········´¸¸¸¸,:;_^-::'''';_¡*¦«)t=Yå'); disp('ÔAu}÷÷¡ª²¹''¸`¸· ·¨''`.·.·······´``¸¨¨,;­°~:¨¨:;¹;ª¦{|ízÏß'); disp('Ðs{÷¬º¬_¹;¨¨¸´···¨,''¸`··········`¸¨¨::;-¡º::'':­¹¹^¯^°ºí%p'); disp('Ëõî}¬¬ª¬;:,´····´,:,,`´´´.····.·´¸¨¨'':­_"¦­,:::_°¬*°¡"¬{Y'); disp('§øL?}}*ª¡²''¸``·´¸::::¨¨_*I}_¨...`¸,^[ôî\¬{¬;;_^²º¦¬ï{]l}}'); disp('ß5]«¬°¦{¦^:_ª^_,¸::''²;::_~^~;;¨`¨;¯){ti¬ìïº;^+t¿}*°}i\tcî'); disp('ÆS%î}}¦ïI¦^²"¬°;¸::''­::°nÊÊª^~^¨;(°¬ÊÊLz}*÷;¬ï±sVÌx{»/{?]'); disp('ÉKg4{¬¦î¼}¯;:_;£ç¦²:''¸,²:²:,:¡~:;}-:;¡°÷°²?{ÂÝ¾5ï5ntÍruz6'); disp('®k+÷°º¿ii;,;¨¬¸^áIi°¸´`¸¸´·´¨­²­''º*¹:;__²°C+¾án%Iå%j{tI½ç'); disp('Îv³°+{uu±°;;:*>"lz{t_¸······¨;¬_¨;{";::;-¦=">ïîpîZhtï£awD'); disp('j)¬×{rxÍ©i¡^*_?¬²Y}c¬:`.····''^{:¸¨¡÷::-²²}{»{}{Y±aYao¢ô®W'); disp('&l{{?Jnîz¿¬°ª¯lf¬C?ï°::¨´··¸:¬¿¬:;{}:::²°)JYjrYzADhZdÐ#ÆÆ'); disp('LÌl11îIì[ï°~~°~{ÞÊ©±*,::`.¸'':²²i±¼¦ª~^;²º[ÈÔÆmzôG§ÓÓ¶ÛÔÈÆ'); disp('WDîî{ïuîv]°"^«¦÷¿àÕ§/¹::¸¨ªCPEGõ½ð®YCv¬"}ÔÊÊÊÊËÓèÖÕÔÔÉÆÆÆ'); disp('ÈÔë±zI[{{÷"ª°º*{zøÔÊ§¹;­'':&I]tnu}Î¾n¦{"÷1ÊÊÊÊÊÊÔ®ÖÆÆÆÆÆÆÆ'); disp('ÆÆÔK&I\*{*«*¦{{¿±ÆÊÊÊÕ÷°ª;;­:;­²^_­;-°}DÊÊÊÊÊÊÊÊÊÊÆÆÆÆÆÆÆ'); disp('ÆÆÆ#¶©x/il\tîofbÊÊÊÊÊÊÊMz?²²;:¨¸¸¸'';ª¾ÊIÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÆË'); disp('ÆÆÆÆÆÆÖÐMÖdøFsÉÊÊÊÊÊÊÊªÎÆÊÊÖJ°-;-_²uÊV;MÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ'); disp('ÆÆÆÆÆÆÆÆÆÆÈÈÊÊÊÊÊÊÊÊÊÊÊz··!3ÊÊÊÆMËÊë² vÊÔÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ'); disp('ÆÆÆÆÆÆÆÆÆÆÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÖ¿ ·;¬÷²¸ ¦ÊÅÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ'); disp('ÆÆÆÆÆÆÆÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ· ·*42/&bî^:¿ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ'); disp('ÆÆÆÆÆÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ:´-ÊÊÊÊÊÊÖÔ^ ½ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ'); disp('ÆÆËÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ· :ëÊÊÊÊÊÊ¬ PÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ'); disp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ ²ÞÊÊÊÊÝ WÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ'); disp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÉ {ÊÊÊÊ² ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ'); disp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÅ ¹ÊÊÊÊÊ:ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ'); disp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊg µÊÊÊÊËÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ'); disp('ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ8·gÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ'); disp('Is this problem a hair-raiser?'); end assert(isequal(y,y_correct))

ans = 115

2   Pass
% On request of Ned Gulley, some extra testcases (for the, hopefully, stable voltage regulator within the input voltage range specified on the box). assert(isequal(transformer(173),115)) assert(isequal(transformer(225),115)) assert(isequal(transformer(145),115)) assert(isequal(transformer(238),115)) assert(isequal(transformer(163),115)) assert(isequal(transformer(128),115)) assert(isequal(transformer(216),115)) assert(isequal(transformer(164),115)) assert(isequal(transformer(136),115)) assert(isequal(transformer(156),115)) assert(isequal(transformer(166),115)) assert(isequal(transformer(132),115)) assert(isequal(transformer(162),115)) assert(isequal(transformer(227),115)) assert(isequal(transformer(203),115)) assert(isequal(transformer(168),115)) assert(isequal(transformer(174),115)) assert(isequal(transformer(170),115)) assert(isequal(transformer(161),115)) assert(isequal(transformer(226),115)) assert(isequal(transformer(232),115)) assert(isequal(transformer(146),115)) assert(isequal(transformer(151),115)) assert(isequal(transformer(152),115)) assert(isequal(transformer(193),115)) assert(isequal(transformer(201),115)) assert(isequal(transformer(192),115)) assert(isequal(transformer(133),115)) assert(isequal(transformer(137),115)) assert(isequal(transformer(224),115)) assert(isequal(transformer(200),115)) assert(isequal(transformer(221),115)) assert(isequal(transformer(160),115)) assert(isequal(transformer(230),115)) assert(isequal(transformer(176),115)) assert(isequal(transformer(210),115)) assert(isequal(transformer(159),115)) assert(isequal(transformer(177),115)) assert(isequal(transformer(126),115)) assert(isequal(transformer(197),115)) assert(isequal(transformer(141),115)) assert(isequal(transformer(222),115)) assert(isequal(transformer(189),115)) assert(isequal(transformer(223),115)) assert(isequal(transformer(140),115)) assert(isequal(transformer(231),115)) assert(isequal(transformer(236),115)) assert(isequal(transformer(180),115)) assert(isequal(transformer(191),115)) assert(isequal(transformer(149),115)) assert(isequal(transformer(172),115)) assert(isequal(transformer(196),115)) assert(isequal(transformer(135),115)) assert(isequal(transformer(209),115)) assert(isequal(transformer(144),115)) assert(isequal(transformer(233),115)) assert(isequal(transformer(215),115)) assert(isequal(transformer(204),115)) assert(isequal(transformer(187),115)) assert(isequal(transformer(202),115)) assert(isequal(transformer(217),115)) assert(isequal(transformer(171),115)) assert(isequal(transformer(153),115)) assert(isequal(transformer(139),115)) assert(isequal(transformer(148),115)) assert(isequal(transformer(169),115)) assert(isequal(transformer(130),115)) assert(isequal(transformer(219),115)) assert(isequal(transformer(206),115)) assert(isequal(transformer(127),115)) assert(isequal(transformer(129),115)) assert(isequal(transformer(218),115)) assert(isequal(transformer(220),115)) assert(isequal(transformer(213),115)) assert(isequal(transformer(207),115)) assert(isequal(transformer(188),115)) assert(isequal(transformer(179),115)) assert(isequal(transformer(185),115)) assert(isequal(transformer(131),115)) assert(isequal(transformer(157),115)) assert(isequal(transformer(143),115)) assert(isequal(transformer(147),115)) assert(isequal(transformer(138),115)) assert(isequal(transformer(214),115)) assert(isequal(transformer(178),115)) assert(isequal(transformer(182),115)) assert(isequal(transformer(195),115)) assert(isequal(transformer(237),115)) assert(isequal(transformer(155),115)) assert(isequal(transformer(158),115)) assert(isequal(transformer(199),115)) assert(isequal(transformer(211),115)) assert(isequal(transformer(228),115)) assert(isequal(transformer(175),115)) assert(isequal(transformer(150),115)) assert(isequal(transformer(194),115)) assert(isequal(transformer(134),115)) assert(isequal(transformer(229),115)) assert(isequal(transformer(181),115)) assert(isequal(transformer(190),115)) assert(isequal(transformer(165),115)) assert(isequal(transformer(235),115)) assert(isequal(transformer(239),115)) assert(isequal(transformer(212),115)) assert(isequal(transformer(208),115)) assert(isequal(transformer(142),115)) assert(isequal(transformer(198),115)) assert(isequal(transformer(184),115)) assert(isequal(transformer(240),115)) assert(isequal(transformer(205),115)) assert(isequal(transformer(234),115)) assert(isequal(transformer(186),115)) assert(isequal(transformer(183),115)) assert(isequal(transformer(167),115)) assert(isequal(transformer(154),115))

ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115 ans = 115