From 4607c827c0b0fe296f12dc4abad96f72c9d451cf Mon Sep 17 00:00:00 2001 From: Algor <1561601523@qq.com> Date: Sun, 15 Oct 2023 21:22:44 +0800 Subject: [PATCH] problem(A1058): make public --- problems/A/A1058/.gitignore | 2 -- problems/A/A1058/A1058.md | 47 +++++++++++++++++++++++++++++++++++++ problems/A/A1058/gen.py | 15 ++++++++++++ problems/A/A1058/std.cpp | 9 +++++++ 4 files changed, 71 insertions(+), 2 deletions(-) delete mode 100644 problems/A/A1058/.gitignore create mode 100644 problems/A/A1058/A1058.md create mode 100644 problems/A/A1058/gen.py create mode 100644 problems/A/A1058/std.cpp diff --git a/problems/A/A1058/.gitignore b/problems/A/A1058/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/problems/A/A1058/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/problems/A/A1058/A1058.md b/problems/A/A1058/A1058.md new file mode 100644 index 0000000..102350b --- /dev/null +++ b/problems/A/A1058/A1058.md @@ -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$。 diff --git a/problems/A/A1058/gen.py b/problems/A/A1058/gen.py new file mode 100644 index 0000000..28eac98 --- /dev/null +++ b/problems/A/A1058/gen.py @@ -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() diff --git a/problems/A/A1058/std.cpp b/problems/A/A1058/std.cpp new file mode 100644 index 0000000..33bd9a2 --- /dev/null +++ b/problems/A/A1058/std.cpp @@ -0,0 +1,9 @@ +#include +using namespace std; +int main() +{ + long long n; + cin >> n; + cout << (1+n)*n/2+1 << endl; + return 0; +}