跳到主要内容

東京大学 情報理工学系研究科 創造情報学専攻 2015年2月実施 プログラミング

Author

itsuitsuki

Description (English)

(1) The following function is a function often used as a simple random number generator.

where is a non-negative integer and denotes a modulus operator (the remainder). Write a program that computes for given . Then print the value of by using this program.

(2) Write a program that counts the number of such that and is an even number.

(3) Write a program that counts the number of such that is an odd number, , and is an even number.

(4) Write a program that prints the value of .

(5) Write a program that computes the following function where is a non-negative integer:

Then run the program to print the values of and .

(6) Write a program that computes the smallest positive integer such that for any non-negative integer .

(7) Write a program that computes the smallest positive integer such that for any non-negative integer . Write on the answer sheet why the program correctly computes . is a function defined as follows: