# | Problem | Pass Rate (passed user / total user) |
---|---|---|
12946 | Palindromic Primes of Range |
|
12947 | Vigenère Cipher |
|
12948 | Eight Queens Puzzle |
|
12949 | Implement Set Using Linked List |
|
Description
Given two integers Num1, Num2.
Please Write a C program to print out all the palindromic prime numbers between Num1 and Num2 (Included Num1 and Num2).
Input
Two integers Num1, Num2.
Note that:
- Num2 is bigger than Num1.
- 32,767 >= Num2 > Num1 >= 0.
Output
Output should follow below format:
P1 P2 P3 P4 … Pn
Note:
- Need to have a return value('\n') at the end of your string.
- P1 ~ Pn are all palindromic prime numbers between Num1 and Num2.
- P1 ~ Pn should be arranged in ascending power. That means, Pn > … > P4 > P3 > P2 > P1.
- If there are no palindromic primes, print “None\n”.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Vigenère Cipher是一個用一系列的Caesar Cipher來加密文字的演算機制;根據一個設定好的keyword,可以透過以下的表格來進行文字的加密以及解密
(Excerpted from wiki: https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher)
舉例:
- 如果加密過後的文字為LXFOPVEFRNHR,且使用的keyword是LEMON,透過以下步驟可以將文字解密:
- 先將keyword的長度複製對應到加密文字的長度
- 將加密文字與對應到的keyword進行解密
- 解密後即可得出原始未加密的文字
Ciphertext: LXFOPVEFRNHR
Keyword: LEMONLEMONLE
Plaintext: ATTACKATDAWN
給定一個keyword字串,和一個未經加密的PT字串;請試著運算出根據keyword進行Vigenère加密後的文字為何
Input
兩個字串 K, PT,分別代表加密時所需要的keyword和要被加密的文字字串
Note:
- K和PT只包含大寫的英文字母
- 1 <= K字串的長度 <= 15.;1 <= PT字串的長度 <= 2000
Output
輸出比須符合以下格式:
CT
Note:
- 輸出的最後必須要有一個換行符號 ('\n')
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The eight queens puzzle is the problem of placing eight chess queens on an 8 times 8 chessboard and no two queens threaten each other. Thus, a solution requires that no two queens share the same row, column, or diagonal.
One possible solution is shown as the figure below.
Given where you place the first chess queen in column 0.
Please write a C program to show all the possible solutions.
Input
One integer R.
Note:
- 7 >= R >= 0.
Output
Output should follow below format:
n.
c c c c c c c c
c c c c c c c c
c c c c c c c c
c c c c c c c c
c c c c c c c c
c c c c c c c c
c c c c c c c c
c c c c c c c c
Note:
- Need to have a return value('\n') at the end of your string.
- Character c is one of ‘-’ and ‘Q’.
- Need a ‘Space’ between two characters.
- n is the number index of solutions, which starts counting from 1.
- You should print out these solutions in an order based on the row number of the queen (defined as “queen location”) in the column 2. For any two solutions, a tie occurs when the queen locations in the same column are equal. To break the tie, you can sort the tied solutions based the queen locations in the next adjacent column (i.e., column 3). If the tie still exists when sorting based on the queen locations in the column i (i = 3~6), you can continue to pick the queen locations in the following column j (i.e., j=i+1) until the tie breaks.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Please use the provided two files, main.c and function.h, to implement a set. Includes following functions:
- Insert N: insert an element which value is N into a set.
- Erase N: remove the element which value is N from a set.
- Check N: check if the element which value is N is inside a set.
- Traversal: traversal the set.
Note:
- A Set data structure shold never have a same element inside.
- Elements inside a set should be arranged from small to large.
Go download function.c, and only need to submit function.c.
Input
Legal commands:
- “insert N”: Insert an element which value is N into the set.
- “erase N”: Remove the element which value is N and return its pointer. Remove nothing is there is no element which value is N.
- “check N”: Check if the element which value is N is inside a set. Print “true\n” if it’s inside, print “false\n” if it’s not.
- “print”: Traversal the set, and print every element in ordered. Print “Set is empty\n” if set is empty.
Output
No need to handle output. Please use function.c above.