加勒比久久综合,国产精品伦一区二区,66精品视频在线观看,一区二区电影

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

代做ECM2418、代寫 java,Python 程序設計

時間:2023-12-10  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



ECM2418 Computer Languages and Representations Continuous Assessment
Functional and Logic Programming
Dr David Wakeling
Handed out Handed in
Thursday 26th October 2023 (T1:05) Thursday 14th December 2023 (T1:12)
This Continuous Assessment is worth 40% of the module mark.
Question 1: Light Show
Every week, The Sunday Times newspaper publishes a Teaser. Teaser 3172, of Sunday 9th July 2023, was as follows.
My bedside clock displays the time and date using eight digits; for example, at 9.43am on 28th June, the display would be
Each digit in the electronic display lights up some (or all) of seven light seg- ments, the above display lighting up a total of 45 segments.
On one occasion recently, the displayed digits were all different and the total number of lit segments was prime. The same was true exactly one day later. Then, just one minute after the second occasion, the number of lit segments was the average of the numbers of lit segments on those two previous occasions.
What was that third display?
    1

Question 1.1
Show a Haskell function generator1 that returns a list of tuples (HR,MN,DY,MT) that may be solutions to the Teaser. That is, for which, HR, MN, DY and MT are valid hours, minutes, days (assume a non-leap year) and months.
This function will be assessed by the number of tests that it passes, as counted by the function x_generator1 below. The expected answer is 10.
 x_generator1 :: Int x_generator1 =
length [t | t <- ts, t ‘elem‘ g] where
 g = ts =
generator1
[ ( 2,15,14,11)
, ( 4,31,27, 9)
, ( 6,**,10, 8)
 , ( 9, 3,23, 6) , (11,19, 6, 5) , (13,35,19, 3) , (15,51, 2, 2) , (18, 6,16,12)
 , (20 ,22 ,29 ,10) , (22,38,11, 9) ]
Question 1.2
Show a Haskell function tester1 that returns true for tuples (HR,MN,DY,MT) that are solutions to the Teaser. That is, for which the tuple is “magic”, a second tuple exactly one day later is also “magic”, and just one minute on from this second tuple the number of lit segments on the display is the average of the number of lit segments of these two tuples. A tuple (HR,MN,DY,MT) is “magic” if the displayed digits of HR, MN, DY and MT are all be different, and the total number of lit segments in the display is prime.
This function will be assessed by the number of tests that it passes, as counted by the func- tion x_tester1 below. Note that these test cases were NOT produced by generator1. The expected answer is 10.
 x_tester1 :: Int x_tester1 =
length [t | t <- ts, tester1 t] where
 ts =
[ ( 6,59,17,24)
2

 , ( 6,59,17,34)
 , ( 6,59,27,14) , ( 6,59,27,41) , ( 8,59,12,46) , (16,59, 7,24) , (16,59, 7,42)
 , (16,59, 7,43) , (16 ,59 ,27 ,40) , (18,59, 2,46) ]
Question 1.3
On blue18.ex.ac.uk, my program
computes [(16,59,27,4)], from which one can deduce the answer to Teaser 3172 is
in 0.004 seconds. Tune your program so that on the same machine, it computes this answer within 1.000 seconds.
(5 marks)
Question 2: Digital Trio
Teaser 3158, of Sunday 5th May 2023, was as follows.
“I have a couple of subtraction problems for you”, George told Martha. Look: N**N2=N3andN3-N4=N5. CanyousolvethemifItellyouthatN1, N3 and N5 are all three-digit whole numbers whose sum is less than 2000, the same three non-zero digits appearing in all three numbers but no digit being repeated within any of those numbers? N2 and N4 are both two-digit whole numbers using two of the three digits mentioned above, and the first digit of N1 is not equal to the first digit of N2.
What is N1?
 main :: IO () main =
 print (filter tester1 generator1)
 3

Question 2.1
Show a Haskell function generator2 that returns a list of tuples (N1,N2,N3,N4,N5) that may be solutions to the Teaser. That is, for which, N1, N3 and N5 are three-digit numbers, and N2 and N4 are two-digit numbers. The same three digits appear in N1, N3 and N5, two of these digits appear in N2, and two of them appear in N4. In each number, no digit is zero and none is repeated. The first digit of N1 is not equal to the first digit on N2.
This function will be assessed by the number of tests that it passes, as counted by the function x_generator2 below. The expected answer is 10.
 x_generator2 :: Int x_generator2 =
 length [t | t <- ts, t ‘elem‘ g] where
g = generator2
ts =
[ ("123","21","123","12","123")
 , ("**","26","261","12","621") , ("219","19","912","21","291") , ("**9","92","9**","**","239") , ("439","94","394","43","394") , ("549","95","945","95","945")
 , ("568","68","586","56","586")
, ("769","67","679","97","796")
, ("879","79","897","98","789")
, ("987","79","789","79","789") ]
(10 marks)
Question 2.2
Show a Haskell function tester2 that returns true for tuples (N1 , N2 , N3 , N4 , N5 ) that are solutions to the Teaser. That is, for which N1 − N2 = N3, N3 − N4 = N5 and N1 + N3 + N5 < 2000.
This function will be assessed by the number of tests that it passes, as counted by the function x_tester2 below. The expected answer is 10.
 x_tester2 :: Int x_tester2 =
length [t | t <- ts, tester2 t] where
 ts =
[ ("138","01","137","50","87")
4

 , ("143","01","142","52","**")
 , ("171","02","169","79","**") , ("152","03","149","54","95") , ("159","04","155","61","94") , ("161","05","156","63","93") , ("182","06","176","80","96")
 , ("151","07","144","57","87") , ("165","08","157","64","93") , ("174","09","165","71","94") ]
(10 marks)
Question 2.3
On blue18.ex.ac.uk, my program
computes [("594","45","549","54","495")] in 0.003 seconds. Tune your program so that on the same machine, it computes this answer within 1.000 seconds.
(5 marks)
Question 3: Easier to Ask the Audience
Teaser 3145, of Sunday 1st January 2023, was as follows.
“I have forgotten the phone number!” complained Martha, about to phone a friend. “So have I!” replied George, “but I have some vague memories of it. It is a perfect square with all the digits different, and the last digit is equal to the number of digits to be dialled. The last-but-one digit is odd and one of the digits is zero. Also the second and third and last-but-one digits are all exact multiples of the first digit. Maybe you can work it out.”
Martha proceeded to dial the number correctly.
What number did she dial?
 main :: IO () main =
 print (filter tester2 generator2)
5

Question 3.1
Show a Prolog predicate generator3 that yields successive numbers N between 1,000 to 1,000,000 (inclusive) that may be solutions to the Teaser. That is, integers N that are perfect squares.
This predicate will be assessed by the number of tests that it passes, as counted by the predicate x_generator3 below. The expected answer is 10.
 x_generator3( N ) :- x_generator3_loop(
[ 1024 , 9409 , 23716 , 51529 , 123**4 , 185761 , 868624 , 962361
 , 982081, 1000000 ], 0, N ).
x_generator3_loop( [], C, C ). x_generator3_loop( [T|TS], C, N ) :-
generator3( T ),
 C1 is C + 1,
x_generator3_loop( TS, C1, N ). x_generator3_loop( [_|TS], C, N ) :-
x_generator3_loop( TS, C, N ).
(10 marks)
Question 3.2
Show a Prolog predicate tester3 that is true for phone numbers N that are solutions to the Teaser. That is, for integers N where all of the digits are different, the last digit is equal to the number of digits, the last-but-one digit is odd and one of the digits is zero. In addition, the second and third and last-but-one digits are all exact multiples of the first digit.
This predicate will be assessed by the number of tests that it passes, as counted by a predicate x_tester3 below. The expected answer is 10.
 x_tester3( N ) :- x_tester3_loop(
[ 123056 , 128036 , 13**76 , 142076 , 148056 , 15**76 , 1**096 , 18**36
 , 193056, 198076 ], 0, N ).
x_tester3_loop( [], C, C ). x_tester3_loop( [T|TS], C, N ) :-
tester3( T ),
 C1 is C + 1,
x_tester3_loop( TS, C1, N ).
6

 x_tester3_loop( [_|TS], C, N ) :-
 x_tester3_loop( TS, C, N ).
(10 marks)
Question 3.3
On Swish Prolog, my program
computes 1**056 in 0.40 seconds. Tune your program so that on the same system, it computes this answer within 2.00 seconds.
(5 marks)
Question 4: Cube Route
Teaser 3149, of Sunday 29th January 2023, was as follows.
I have a set of ten cards, each of which has a different digit written on it. All the cards have been used to make a set of prime numbers. After discarding the smallest prime, and without changing the order of any cards, I have placed the remaining primes in order of decreasing size to give a large number. It is possible, without changing the order of any cards, to break this number into a set composed entirely of cubes. Neither set contains a number with more than four digits.
List, in order of decreasing size, my set of prime numbers.
Question 4.1
Show a Prolog predicate generator4 that yields arrangements of the digits 0 to 9 divided into runs of one, two, three or four digits that form prime numbers. Importantly (and somewhat surprisingly) leading zero digits do not count, so “251” is considered to be prime, but “0251” is not.
This predicate will be assessed by the number of tests that it passes, as counted by a predicate x_generator4 below. The expected answer is 10.
 main :-
generator3( N ), tester3( N ), write( N ).
7

 x_generator4( N ) :-
 x_generator4_loop(
[ [[9 ,6 ,7] ,[4 ,0 ,1] ,[2 ,8 ,3] ,[5]]
, [[9 ,8 ,3] ,[6 ,0 ,1] ,[5] ,[4 ,7] ,[2]]
, [[9 ,8 ,3] ,[6 ,7] ,[4 ,2 ,0 ,1] ,[5]]
, [[9 ,8 ,5 ,1] ,[2] ,[4 ,3] ,[6 ,0 ,7]]
 , [[9 ,8 ,5 ,1] ,[2] ,[3] ,[6 ,0 ,4 ,7]]
, [[9 ,8 ,5 ,1] ,[2] ,[7] ,[4 ,6 ,0 ,3]]
, [[8 ,9] ,[7] ,[6 ,0 ,1] ,[2 ,5 ,4 ,3]]
, [[8 ,9] ,[7] ,[5 ,6 ,3] ,[4 ,0 ,2 ,1]]
, [[8 ,9] ,[5] ,[4 ,7] ,[6 ,0 ,1] ,[3] ,[2]]
 , [[3],[5],[6,0,7],[2],[4,1],[8,9]] ], 0, N ).
x_generator4_loop( [], C, C ). x_generator4_loop( [T|TS], C, N ) :-
generator4( T ),
 C1 is C + 1,
x_generator4_loop( TS, C1, N ). x_generator4_loop( [_|TS], C, N ) :-
x_generator4_loop( TS, C, N ).
(10 marks)
Question 4.2
Show a Prolog predicate tester4 that is true for lists of lists of digits that form prime numbers and may be solutions to the Teaser. That is, for collections of prime numbers that after discarding the smallest prime, may be arranged in order of decreasing size to give a large number that may be divided into runs of one, two three or four digits that form cubes.
This predicate will be assessed by the number of tests that it passes, as counted by the predicate x_tester4 below. The expected answer is 10.
 x_tester4( N ) :- x_tester4_loop(
[ [[8 ,2 ,7] ,[6 ,1] ,[5 ,3] ,[4 ,0 ,9]] , [[8 ,2 ,7] ,[6 ,1] ,[4 ,0 ,9] ,[5 ,3]]
 , [[8 ,2 ,7] ,[5 ,3] ,[6 ,1] ,[4 ,0 ,9]]
, [[8 ,2 ,7] ,[4 ,0 ,9] ,[6 ,1] ,[5 ,3]]
, [[6 ,1] ,[8 ,2 ,7] ,[4 ,0 ,9] ,[5 ,3]]
, [[6 ,1] ,[4 ,0 ,9] ,[5 ,3] ,[8 ,2 ,7]]
, [[5 ,3] ,[6 ,1] ,[4 ,0 ,9] ,[8 ,2 ,7]]
 , [[5 ,3] ,[4 ,0 ,9] ,[6 ,1] ,[8 ,2 ,7]]
, [[4 ,0 ,9] ,[5 ,3] ,[8 ,2 ,7] ,[6 ,1]]
, [[4,0,9],[8,2,7],[6,1],[5,3]] ], 0, N ).
8

  x_tester4_loop( [], C, C ). x_tester4_loop( [T|TS], C, N ) :-
tester4( T ),
C1 is C + 1,
x_tester4_loop( TS, C1, N ).
 x_tester4_loop( [_|TS], C, N ) :- x_tester4_loop( TS, C, N ).
(10 marks)
Question 4.3
On Swish Prolog, my program
computes a first result in in 33.0 seconds, from which one can deduce the answer to the Teaser is 827, 409, 61, 53. Tune your program so that on the same system, it computes this answer within 120.0 seconds.
(5 marks)
Submission
You should submit a single “.zip” file to the ELE system. Other compression formats, such as “.rar”, “.7z”, “.gz” and “.bz2” are unacceptable, and will receive a mark of zero. The “.zip” file should contain four completed text files “Light.hs” (containing the answer to Question 1), “Trio.hs” (containing the answer to Question 2), “Audience.pl” (con- taining the answer to Question 3) and “Cube.pl” (containing the answer to Question 4).
If there is any question as to whether your functional programs compute the correct result, these questions will be answered on the implementation at
   https://www.tutorialspoint.com/compile_haskell_online.php
If there is any question as to whether your logic programs compute the correct result, these questions will be answered on the implementation at
   https://swish.swi-prolog
 main :-
generator4( XS ), tester4( XS ), write( XS ).
9

All students are reminded of the University regulations on academic honesty and plagiarism.
In particular, functions an predicates clearly intended ONLY to pass the given tests will be treated as malpractice (“an attempt to deceive the examiners”).
請加QQ:99515681 或郵箱:99515681@qq.com   WX:codehelp

掃一掃在手機打開當前頁
  • 上一篇:CSC8204 代寫、Secure Software程序
  • 下一篇:INT305 代做、代寫 Python 語言編程
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    在线午夜精品| 日韩精品91亚洲二区在线观看| 亚洲成人精选| 日本亚洲天堂网| 国产精品亚洲成在人线| 国产一区导航| 日韩精品久久久久久久电影99爱| 欧美黄色精品| 日韩精品免费观看视频 | 清纯唯美亚洲经典中文字幕| 91精品福利观看| 亚洲成人不卡| 另类图片国产| 欧美福利影院| 欧美高清视频看片在线观看| 国产欧美日韩精品一区二区三区 | 欧美天堂亚洲电影院在线观看| 国产乱码精品一区二区亚洲| 欧美一区91| 欧美国产美女| 99国产精品视频免费观看一公开| 欧美五码在线| 色妞ww精品视频7777| 91视频亚洲| 三级久久三级久久| 日本精品久久| 美女福利一区二区三区| 久久国产精品亚洲77777| 欧美综合在线视频观看| 精品久久ai电影| 91蜜桃臀久久一区二区| 亚洲视频分类| 国产综合久久久| 亚洲香蕉久久| 一区二区三区国产精华| 日韩高清在线观看| 欧美一区精品| 老司机精品视频网| 欧美亚洲黄色| 精品日本视频| 精品国产欧美日韩一区二区三区| 伊人久久av| av中文在线资源库| 色999日韩| 国产精品yjizz视频网| 日本大胆欧美人术艺术动态| 亚洲一区二区免费看| 99伊人成综合| 午夜在线精品| 视频在线在亚洲| 免费高清视频精品| 日产午夜精品一线二线三线| 四季av一区二区凹凸精品| 成人影院在线| 正在播放日韩精品| 日韩欧美中字| 超碰这里只有精品| 另类一区二区三区| 麻豆精品一区二区综合av| 麻豆国产精品777777在线| 久久久久97| 国产一区三区在线播放| 精品中文字幕一区二区三区四区| 亚洲自拍电影| 超碰在线成人| 久久国产小视频| 很黄很黄激情成人| 免费看日韩精品| 天堂网在线最新版www中文网| 欧洲一级精品| 欧美亚洲免费| 国产精品亚洲二区| 亚洲图色一区二区三区| 日韩精品免费一区二区在线观看| 欧美 日韩 国产 一区| 99re国产精品| 欧美国产一区二区三区激情无套| 日韩中文影院| 日本欧美一区二区| 三级在线观看视频| 一区在线免费| av最新在线| 久久99久久久精品欧美 | 国内精品亚洲| 日韩电影免费在线| 天堂成人娱乐在线视频免费播放网站 | 亚洲国产一成人久久精品| 免费观看久久久4p| 韩国女主播一区二区| 久久香蕉网站| 国产精品极品| 亚洲欧美日本日韩| 麻豆精品蜜桃| 最新亚洲国产| 麻豆精品99| 久久国产成人| 久久亚洲人体| 日韩vs国产vs欧美| 91精品在线观看国产| 免费在线看一区| 欧美v亚洲v综合v国产v仙踪林 | 精品中国亚洲| 亚洲综合99| 精品国产美女a久久9999| 国产午夜久久av| 久久精品道一区二区三区| 六月婷婷一区| 免费视频一区| 都市激情久久| 日韩在线一区二区三区| 青青青伊人色综合久久| 97se亚洲| 色偷偷综合网| 欧美激情1区2区3区| 天堂成人娱乐在线视频免费播放网站| 亚洲欧美高清| 日本在线不卡一区| 激情小说一区| 成人亚洲欧美| 国产一区不卡| 艳女tv在线观看国产一区| 精品欧美日韩精品| 日本人妖一区二区| 午夜在线精品偷拍| 亚洲在线久久| 亚洲欧美一区在线| 成人在线视频免费看| 欧美三级乱码| 麻豆视频在线观看免费网站黄| 一区二区三区日本视频| 亚洲精品va| 欧美aⅴ一区二区三区视频| 久久精品91| 天天综合91| 精品中国亚洲| 热久久久久久| 精品精品99| 亚洲国产尤物| 国产毛片精品| 欧美日韩尤物久久| 欧美高清视频看片在线观看| 日韩高清欧美| 亚洲www.| 中文字幕一区二区精品区| 91嫩草精品| 日韩一级毛片| 欧美日韩一区二区三区在线电影| 日韩影院二区| 欧美大奶一区二区| 先锋欧美三级| 99久久久久久中文字幕一区| 开心久久婷婷综合中文字幕| 久久福利综合| 日韩高清一区在线| 伊人成年综合电影网| 成人国产精品久久| 人人爽香蕉精品| 久久久久毛片免费观看| 天堂中文在线播放| 成人性生交大片免费看96| 亚洲精品69| 成人短片线上看| 高清在线一区二区| 色琪琪久久se色| 99久久香蕉| 久久精品理论片| 红桃视频国产精品| 国产真实有声精品录音| 激情黄产视频在线免费观看| 极品国产人妖chinesets亚洲人妖| 日韩一级视频| 日韩视频不卡| 欧美不卡在线观看| 欧美一区二区| 媚黑女一区二区| 日本99精品| 久久国产人妖系列| 国产精品外国| 国产成人一二| 亚洲精品美女| 日本а中文在线天堂| 久久国产日韩| 国产日韩欧美一区二区三区| 亚洲一级少妇| 婷婷六月综合| 嫩呦国产一区二区三区av| 一区二区三区成人精品| 石原莉奈在线亚洲二区| 嫩草国产精品入口| 中文字幕乱码亚洲无线精品一区 | 精品久久中文| 亚洲深深色噜噜狠狠爱网站| 97精品中文字幕| 亚洲午夜在线| 久久99成人| 美女爽到高潮91| 97精品国产一区二区三区| 亚洲韩日在线| 久久视频社区| 欧美日本二区|