Download Practices(3/7) - Intelligent Data Systems Laboratory

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Choice modelling wikipedia , lookup

Transcript
Practices
컴퓨터의 개념 및 실습
5월 4일
Intelligent Data Systems Lab.
Department of Computer Science & Engineering
Practice 1
 Heating and cooling degree-days are measures used by
utility companies to estimate energy requirements. If the
average temperature for a day is below 60, then the
number of degrees below 60 is added to the heating
degree-days. If the temperature is above 80, the amount
over 80 is added to the cooling degree-days. Write a
program that accepts a sequence of average daily
temps and computes the running total of cooling and
heating degree-days. The program should print these
two totals after all the data has been processed.
컴퓨터의 개념 및 실습
Practice 2
 The Syracuse sequence is generated by starting with a
natural number and repeatedly applying the following
function until reaching 1:
𝑥/2 , 𝑖𝑓 𝑥 𝑖𝑠 𝑒𝑣𝑒𝑛
𝑠𝑦𝑟 𝑥 =
3𝑥 + 1, 𝑖𝑓 𝑥 𝑖𝑠 𝑜𝑑𝑑
 For example, the Syracuse sequence starting with 5 is:
5, 16, 8, 4, 2, 1. Write a program that gets a starting
value from the user and then prints the Syracuse
sequence for that starting value.
컴퓨터의 개념 및 실습
Practice 3
 The Goldbach conjecture asserts that every even
number is the sum of two prime numbers. Write a
program that gets a number from the user, checks to
make sure that it is even, and then finds two prime
numbers that sum to the number.
 Hints: Take advantage of a function we developed in the
last class to determine whether the input is a prime
number or not.
컴퓨터의 개념 및 실습