Skip to content

Commit

Permalink
problem(A1058): make public
Browse files Browse the repository at this point in the history
  • Loading branch information
HydraBor committed Oct 15, 2023
1 parent 0e8132c commit 4607c82
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
2 changes: 0 additions & 2 deletions problems/A/A1058/.gitignore

This file was deleted.

47 changes: 47 additions & 0 deletions problems/A/A1058/A1058.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 题目描述

Algor 过生日啦,小朋友们欢聚一堂一起吃蛋糕!

$n$ 个小朋友的面前有一块圆形的大蛋糕,正当 Algor 思考如何切蛋糕的时候,Eronano 提出了问题:“如果我们每个人都切一刀的话,最多能把蛋糕分成多少份呢?”。

# 输入格式

一个整数 $n$,表示小朋友的数量。

# 输出格式

一个整数,蛋糕最多能被分成多少份。

# 输入输出样例

```input1
1
```

```output1
2
```

```input2
3
```

```output2
7
```

```input3
5
```

```output3
16
```

# 说明/提示

假设蛋糕是一个规则的圆,小朋友们的每一刀都将完整地切在圆的某一条弦上,必定会导致蛋糕的块数增加。

对于 $80 \%$ 的测试样例,$1 \leq n \leq {10}^3$。

对于全部的测试样例,$1 \leq n \leq {10}^5$。
15 changes: 15 additions & 0 deletions problems/A/A1058/gen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from cyaron import *
from random import randint
CASES = 10

for _t in range(1, CASES + 1):
io = IO(f"{_t}.in")
# ==============================
if _t <= 8:
io.input_writeln(randint(1, int(1e3)))
elif _t == 9:
io.input_writeln(int(1e5 - 1))
else:
io.input_writeln(int(1e5))
# ==============================
io.close()
9 changes: 9 additions & 0 deletions problems/A/A1058/std.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <iostream>
using namespace std;
int main()
{
long long n;
cin >> n;
cout << (1+n)*n/2+1 << endl;
return 0;
}

0 comments on commit 4607c82

Please sign in to comment.