[洛谷 202406GESP 模拟 二级] 周长与面积计算

Luogu
IDLGB3994
Time1000ms
Memory512MB
DifficultyP1
循环结构
小洛有 $n$ 个正方形,第 $1$ 个正方形的边长为 $1$,第 $2$ 个正方形的边长为 $2$,以此类推,第 $n$ 个正方形的边长为 $n$。它们被紧密地排列成一行。小洛想要知道这个图案的周长和面积分别是多少。 例如当 $n=5$ 时的图案如下图所示。红色的边框代表整个图案的周长,绿色区域代表整个图案的面积: ![](https://cdn.luogu.com.cn/upload/image_hosting/92omqw1x.png) ## Input 输入一个正整数 $n$。 ## Output 输出两行。 第一行一个正整数代表图案的周长; 第二行一个正整数代表图案的面积; [samples] ## Note 对于 $70\%$ 的数据,$1 \leq n \leq 100$; 对于所有数据,$1 \leq n \leq 100000$。
Samples
Input #1
5
Output #1
40
55
Input #2
9
Output #2
108
285
API Response (JSON)
{
  "problem": {
    "name": "[洛谷 202406GESP 模拟 二级] 周长与面积计算",
    "description": {
      "content": "小洛有 $n$ 个正方形,第 $1$ 个正方形的边长为 $1$,第 $2$ 个正方形的边长为 $2$,以此类推,第 $n$ 个正方形的边长为 $n$。它们被紧密地排列成一行。小洛想要知道这个图案的周长和面积分别是多少。 例如当 $n=5$ 时的图案如下图所示。红色的边框代表整个图案的周长,绿色区域代表整个图案的面积: ![](https://cdn.luogu.com.cn/upload/im",
      "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": "LGB3994"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "小洛有 $n$ 个正方形,第 $1$ 个正方形的边长为 $1$,第 $2$ 个正方形的边长为 $2$,以此类推,第 $n$ 个正方形的边长为 $n$。它们被紧密地排列成一行。小洛想要知道这个图案的周长和面积分别是多少。\n\n例如当 $n=5$ 时的图案如下图所示。红色的边框代表整个图案的周长,绿色区域代表整个图案的面积:\n\n![](https://cdn.luogu.com.cn/upload/im...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments