Graderpractice for programmers

CSIT Coding Contest #3 (NU Super Coder)

Awaiting submission
จงเขียนโปรแกรมที่รับตัวเลขจำนวนธรรมชาติ ตั้งแต่ 0 ถึง 1015 เข้ามา และแสดงผลรวมของตัวเลขเหล่านั้น

Hint for Java: What type should you use for a really long number?

Awaiting submission
CSIT Freshies are getting lost in SC2!

In between preparing their LINE Hack 2019 submissions, the 3rd and 4th year students have designed a chatbot to help the Freshies find their classroom.

The chatbot can answer the question “Where is X” where X is a room number in the ranges of: 101-118, 201-218, 301-318, 401-418, 501-518.

The chatbot answers “Floor Y” where Y is the floor number of the room. If the room number is not in the ranges above then it answers “Invalid room”.

The input ends when the user enters “Bye”.

Awaiting submission
The Vigenere cipher uses a keyword to encrypt a message. For example, if the key is CSIT then a plaintext would be encrypted to ciphertext as follows.
Vigenere grid
Plaintext:	KOTLINROCKS	(column)
		CSITCSITCSI	(row)
Ciphertext:	MGBEKFZHECA

Input: The first line is the key. The second line is the plaintext.

Output: The ciphertext encryped using Vigenere.

Awaiting submission
Students have been complaining that the wifi speed around NU is unpredictable due to network congestion. Luckily we have an idea to help students connect to the least congested Wifi hotspot wherever they are on campus.
example

Input

The first line contains 3 integers relating to the user’s device: the x position, the y position, and the range of the wifi signal (radius).

The second line contains 1 integer for the number of wifi hotspots.

The third and remaining lines each represent a wifi hotspot, consisting of 4 integers: the x position, the y position, the number of connected users and the id of hotspot.

Output

The id of the hotspot with the least connected users in range of the wifi signal of the user’s device.

Awaiting submission
HTML is a language developed by the World Wide Web Consortium, who define the standards for what is a valid tag. Start tags must have the following format:
  1. The first character of a start tag must be a LESS-THAN character (<).
  2. The next few characters of a start tag must be the element’s tag name.
  3. If there are to be any attributes in the next step, there must first be one space character.
  4. Then, the start tag may have a number of attributes, separated by one space character. An attribute:
    1. Must have a name
    2. Optionally has a single EQUALS SIGN character (=), followed by QUOTATION MARK character ("), followed by the attribute value, followed by QUOTATION MARK character (").
  5. After the attributes, the start tag must be closed by a GREATER-THAN character (>).

Write a parser that determines if a line is a valid start tag.

Input

Multiple lines, each line containing one HTML start tag.

Output

For each line, output true if it is a valid HTML start tag.

Awaiting submission
Last year the ajahn of CSIT became famous for their poetry! Now they are back with new original work.

In their latest work:

  • all words must contain the number of letters as a power of 2 (1, 2, 4, 8, etc)
  • all lines must contain the number of words as a power of 2

Please help them verify their poetry is correct.

Input

The first line contains 1 integer representing the number of lines in the poem.

The remaining lines are the poem to be checked.

Output

If the poem is valid then output “correct”.

If the poem is invalid then output “incorrect lines X” where X is space-separated list of line numbers that do not match the rules above.