Find The Summation of Missing Gifts
Author: Efat Sikder
Problem Setter: Shahriar ShihabMember, IUBAT IITS Programming Club
Mithila and Mojid Mia once shared a joyful relationship, but recent misunderstandings have led to their breakup. During their time together, Majid Mia generously gifted Mithila numerous presents. However, their relationship has soured, and Majid now insists on the return of all the gifts he bestowed upon her. Although he cannot recall the specific order in which he gave these gifts, he does remember the number of the last gift he presented to Mithila.
In response, Mithila, still upset about having to part with all the gifts, has devised a plan. She has decided to return only the gifts she didn't particularly like, holding onto the ones she favored. Given that Majid did not receive all the gifts back, he is determined to find out both the count and the sum of the gifts Mithila chose to retain. Armed with this information, Majid intends to make his case against Mithila. It is worth noting that the gifts are numbered sequentially from 1 to N, where N represents the number of the last gift. Majid seeks assistance in pursuing this matter legally and sending Mithila to prison.
Input Format
➤ The first line of the input should contain a single integer N (1 ≤ N ≤ 9*107), representing the number of the last gift.
➤ The subsequent lines, up to the end of the file (EOF), should contain the gift numbers that Mithila returned.
Output Format
Output the number of gifts Mithila did not return and their summation.
Print a new line after printing the output.
Samples
Input
Output
Input
Output
Language | Time | Memory |
GNU C 11 | 1s | 128MB |
GNU C++ 14 | 1s | 128MB |
GNU C++ 11 | 1s | 128MB |