# | Problem | Pass Rate (passed user / total user) |
---|---|---|
10947 | delete linked list |
|
12602 | OuQ String |
|
12613 | Yet Another Meme Problem |
|
Description
This problem will give you a sequence of positive integers. Use this sequence to create a linked list to store those integers. Next, the problem will give you another sequence of positive integers, p0, p1,…pk-1. Delete the nodes in the position at p0, p1, …pk-1 of the linked list, where 1<=p0<p1<…pk-1<=N. If the node is not existing,do nothing. And show the final results.
For example, if the first sequence is 1, 2, 3, 4, 5, 6,7, a linked list is created as
If the second sequence is 1, 1, 4, do the follows.
After p1=1, the list becomes
because the first node is 1. After p2 = 1, the list becomes
because the first node is 2. After p3 = 4, the list becomes
because the fourth node is 6.
The framework of the program is provided.
- Create a linked list from the input (createList)
- while there are still some data pi
- read in pi
- delete node at pi (deleteNode)
- print the remaining list (printList)
- free the list (freeList)
You will be provided with main.c and function.h. main.c contains the implementation of function printList, and freeList, and function.h contains the definition of node and the interface of createList(&head) and deleteNode(&head, pi). You only need to implement createList(&head) and deleteNode(&head, pi) in function.c, in which head is the head of the linked list, and pi is the node at pi to be deleted.
You will be provided with main.c and function.h, and asked to implement function.c.
For OJ submission:
Step 1. Submit only your function.c into the submission block. (Please choose c compiler)
Step 2. Check the results and debug your program if necessary.
main.c
function.h
Input
The input contains 2 sequence of positive integers as the linklist and the order, except the last one, which is -1, indicating the end of the sequence.
Output
The output contains the sequence of resulting linklist.
Sample Input Download
Sample Output Download
Partial Judge Code
10947.cPartial Judge Header
10947.hTags
Discuss
Description
Define the level 1 string s1 = “OuQ”,
and the level k string sk = “O” + sk−1 + “u” + sk−1 + “Q”.
For example:
- s2 = “O” + s1 + “u” + s1 + “Q” = “OOuQuOuQQ”
- s3 = “OOOuQuOuQQuOOuQuOuQQQ”
Given 3 integeres k,l,r.
Please find all characters of sk[l],sk[l+1],...sk[r−1],sk[r]
Input
There’re multiple testcases in input.
Three integers k,l,r on each line.
- 1 ≤ k ≤ 50
- 0 ≤ l ≤ r < length of sk
- 1 ≤ |r−l+1| ≤ 100
Output
For each testcase, print |r−l+1| characters,sk[l],sk[l+1],...sk[r−1],sk[r], for a line.
Remember ‘\n’ on the end of each line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Problem slightly modified from codeforces educational round 80
You are given two integers A and B, calculate the number of pairs (a,b) such that 1≤a≤A, 1≤b≤B, and the equation a⋅b+a+b=conc(a,b) is true.
conc(a,b) is the concatenation of a and b (for example, conc(12,23)=1223, conc(100,11)=10011). a and b should not contain leading zeroes.
Hints
-
For the first test case in sample input, there is only one suitable pair : a=1, b=9 (1+9+1⋅9=19).
-
Since the number is large in this problem, it is suggested to use
long long int
.
Input
The first line contains t (1≤t≤100) — the number of test cases.
Each test case contains two integers A and B (1≤A, b≤10^9).
Output
Print one integer — the number of pairs (a,b) such that 1≤a≤A, 1≤b≤B, and the equation a⋅b+a+b=conc(a,b) is true.