[语言月赛 202503] 长方形

Luogu
IDLGB4243
Time1000ms
Memory512MB
DifficultyP1
2025顺序结构语言月赛
假设一个长方形的长和宽均为整数,给定它的长 $a$ 和面积 $S$,请你求出这个长方形的周长 $L$。 ## Input 输入共一行两个整数 $a, S$,分别代表给定长方形的长和面积。 ## Output 输出一行一个整数,代表输入长方形的周长。 [samples] ## Background 对于一个长为 $a$,宽为 $b$ 的长方形,它的面积是 $S = a \times b$,它的周长是 $L = 2 \times (a + b)$。 ## Note ### 样例 1 说明 给定长方形的面积是 $S = 24$,长为 $a = 4$,因此它的宽是 $b = S \div a = 24 \div 4 = 6$,最终的周长为 $L = 2 \times (a + b) = 2 \times (4 + 6) = 20$。 ### 数据规模与约定 对于 $100\%$ 的数据,$1 \leq a, S \leq 100$。保证 $S$ 是 $a$ 的倍数。 数据中可能出现宽大于长,即,$b \geq a$ 的情况。这仅代表本题的特殊情况,在实际的数学学习中,有关“长”和“宽”的严格定义,请以课堂讲授为准。
Samples
Input #1
4 24
Output #1
20
Input #2
8 72
Output #2
34
Input #3
1 100
Output #3
202
API Response (JSON)
{
  "problem": {
    "name": "[语言月赛 202503] 长方形",
    "description": {
      "content": "假设一个长方形的长和宽均为整数,给定它的长 $a$ 和面积 $S$,请你求出这个长方形的周长 $L$。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB4243"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "假设一个长方形的长和宽均为整数,给定它的长 $a$ 和面积 $S$,请你求出这个长方形的周长 $L$。\n\n## Input\n\n输入共一行两个整数 $a, S$,分别代表给定长方形的长和面积。\n\n## Output\n\n输出一行一个整数,代表输入长方形的周长。\n\n[samples]\n\n## Background\n\n对于一个长为 $a$,宽为 $b$ 的长方形,它的面积是 $S = a \\times b...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments