new file: P10815.cpp
Check cpp / md pair / Check md headers (push) Failing after 2s

This commit is contained in:
hanyixuanten committed 2026-10-23 10:43:08 +00:00
1 parent cd0c65ca4e
commit ac9df32e58
2 files changed
+75

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
x = 0;
bool fu = 0;
char c = getchar_unlocked();
while ((c < '0' || c > '9') && c != '-')
c = getchar_unlocked();
if(c=='-') fu=1, c=getchar_unlocked();
while (c>='0' && c<='9'){
x = 10*x+c-'0', c = getchar_unlocked();
}
x=((fu)?-1:1)*x;
}
int main(){
int n, ans=0;
scanf("%d", &n);
for(int i = 1; i <= n; i++) {
int x;
read(x);
ans+=x;
}
printf("%d\n", ans);
return 0;
}
+50
View File
@@ -0,0 +1,50 @@
# P10815 【模板】快速读入
## 题目背景
**套取数据直接输出抢最优解是恶劣的违规行为,根据情节轻重,最高可以直接封号。**
制约解除作战!
## 题目描述
给你 $n$ 个数,你需要求和并输出。
## 输入格式
第一行一个整数 $n$。
之后一行 $n$ 个整数以空格隔开,表示给定的 $n$ 个数。
## 输出格式
一行一个数表示给定的数的和。
## 输入输出样例 #1
### 输入 #1
```
5
-1 2 -3 4 -5
```
### 输出 #1
```
-3
```
## 说明/提示
对于 $25\%$ 的数据,满足 $n=10^5$。
对于另外 $25\%$ 的数据,满足 $n=10^6$。
对于另外 $25\%$ 的数据,满足 $n=10^7$。
对于另外 $25\%$ 的数据,满足 $n=10^8$。
对于 $100\%$ 的数据,满足所有数在 $[-n,n]$ 之间。
数据保证对于序列的任何前缀,这个前缀的和在 $32$ 位有符号整型的存储范围内。