076. Jar of Candies

Codeforces
IDCF10269076
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Getting back from the grocery store, you bought a whole bag of candies just for you to eat. You put the candy in a jar, and hide it in your room. Unfortunately, you notice that the number of candies in the jar are going down each day, but you do not know by how much. You want to know how much the thief has stolen every day. The first line $n$ will denote how much candy you had initially, and the second line will always contain a series of descending space-separated integers which indicate the amount of candy remaining each day, starting from the day the first candies were stolen. Output a set of line-separated integers which answers the amount of candy stolen from the candy jar each day. (It turns out that you caught your siblings stealing from your jar while you were absent from your room. Those rascals!) ## Input The first line $n$ will denote how much candy you had initially, and the second line will always contain a series of descending space-separated integers which indicate the amount of candy remaining each day, starting from the day the first candies were stolen. ## Output Output a set of line-separated integers which answers the amount of candy stolen from the candy jar each day. [samples] ## Note (It turns out that you caught your siblings stealing from your jar while you were absent from your room. Those rascals!)
**Definitions** Let $ n \in \mathbb{Z}^+ $ be the initial number of candies. Let $ C = (c_0, c_1, \dots, c_m) $ be a sequence of integers where: - $ c_0 = n $ (initial count), - $ c_i $ (for $ i \geq 1 $) is the number of candies remaining at the end of day $ i $. **Constraints** 1. $ c_0 > c_1 > c_2 > \dots > c_m \geq 0 $ 2. $ m \geq 1 $ **Objective** For each day $ i \in \{1, \dots, m\} $, compute the amount stolen on day $ i $: $$ s_i = c_{i-1} - c_i $$ Output the sequence $ (s_1, s_2, \dots, s_m) $.
API Response (JSON)
{
  "problem": {
    "name": "076. Jar of Candies",
    "description": {
      "content": "Getting back from the grocery store, you bought a whole bag of candies just for you to eat. You put the candy in a jar, and hide it in your room. Unfortunately, you notice that the number of candies i",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269076"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Getting back from the grocery store, you bought a whole bag of candies just for you to eat. You put the candy in a jar, and hide it in your room. Unfortunately, you notice that the number of candies i...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the initial number of candies.  \nLet $ C = (c_0, c_1, \\dots, c_m) $ be a sequence of integers where:  \n- $ c_0 = n $ (initial count),  \n- $ c_i $ (for $...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments