A. Smiley Faces (A)

Codeforces
IDCF10140A
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Mr. Light got some pieces of paper, each contains one of the three symbols: '.', ':', and ')'. He wants to use these pieces to form as many smiley faces as possible. To form one smiley face he needs one piece with a bracket ')' on it and either two pieces with dots '.', or one piece with a colon ':'. Mr. Light has A, B, and C of each symbol of '.', ':', ad ')', respectively. What is the maximum number of smiley faces he can form? The input contains three space-separated integers A B C (0 ≤ A, B, C ≤ 100), the number of pieces with each symbol of '.', ':', and ')', respectively. Print the maximum number of smiley faces Mr. Light can form, on a single line. ## Input The input contains three space-separated integers A B C (0 ≤ A, B, C ≤ 100), the number of pieces with each symbol of '.', ':', and ')', respectively. ## Output Print the maximum number of smiley faces Mr. Light can form, on a single line. [samples]
**Definitions** Let $ A, B, C \in \mathbb{Z}_{\geq 0} $ denote the counts of symbols '.', ':', and ')', respectively. **Constraints** $ 0 \leq A, B, C \leq 100 $ **Objective** Maximize the number of smiley faces $ S $, where each smiley requires: - One ')' (i.e., consumes 1 from $ C $), and - Either: - Two '.' (i.e., consumes 2 from $ A $), or - One ':' (i.e., consumes 1 from $ B $). Let $ x $ be the number of smileys formed using two '.' and one ')', and $ y $ be the number of smileys formed using one ':' and one ')'. Then: $$ S = x + y $$ subject to: $$ 2x \leq A, \quad y \leq B, \quad x + y \leq C, \quad x, y \in \mathbb{Z}_{\geq 0} $$ Maximize $ S = x + y $ under these constraints.
API Response (JSON)
{
  "problem": {
    "name": "A. Smiley Faces (A)",
    "description": {
      "content": "Mr. Light got some pieces of paper, each contains one of the three symbols: '.', ':', and ')'. He wants to use these pieces to form as many smiley faces as possible. To form one smiley face he needs ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10140A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Mr. Light got some pieces of paper, each contains one of the three symbols: '.', ':', and ')'.\n\nHe wants to use these pieces to form as many smiley faces as possible. To form one smiley face he needs ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ A, B, C \\in \\mathbb{Z}_{\\geq 0} $ denote the counts of symbols '.', ':', and ')', respectively.\n\n**Constraints**  \n$ 0 \\leq A, B, C \\leq 100 $\n\n**Objective**  \nMaximize the num...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments