提出 #71465911
ソースコード 拡げる
/* Code By WCM */
/*
Date:
大致思路:
复杂度:
期望得分:
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <vector>
#include <queue>
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
using namespace std;
inline int read();
void write(int);
void writeln(int);
int main() {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
int n = read(), ans = 0;
for(int i = 1; i <= n; i++) ans += i;
printf("%d\n", ans);
// printf("\nThe time used: ");
// printf("%.2lfs",(double)clock()/CLOCKS_PER_SEC);
return 0;
}
inline int read() {
int res = 0, f = 1;
char ch = getchar();
while(ch < '0' || ch > '9') f = (ch == '-' ? -1 : 1), ch = getchar();
while(ch >= '0' && ch <= '9') res = (res << 1) + (res << 3) + (ch ^ 48), ch = getchar();
return res * f;
}
void write(int x) {
static int sta[35];
int top = 0;
do { sta[top++] = x % 10, x /= 10; } while(x);
while(top) putchar(sta[--top] ^ 48);
}
void writeln(int x) {
write(x);
putchar('\n');
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Triangular Number |
| ユーザ | WZwangchongming |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 100 |
| コード長 | 1191 Byte |
| 結果 | AC |
| 実行時間 | 15 ms |
| メモリ | 3820 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 100 / 100 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example_00.txt, example_01.txt, example_02.txt |
| All | example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| example_00.txt | AC | 15 ms | 3656 KiB |
| example_01.txt | AC | 1 ms | 3536 KiB |
| example_02.txt | AC | 1 ms | 3712 KiB |
| hand_00.txt | AC | 1 ms | 3672 KiB |
| hand_01.txt | AC | 1 ms | 3796 KiB |
| hand_02.txt | AC | 1 ms | 3820 KiB |
| random_00.txt | AC | 1 ms | 3796 KiB |
| random_01.txt | AC | 1 ms | 3796 KiB |
| random_02.txt | AC | 1 ms | 3820 KiB |
| random_03.txt | AC | 1 ms | 3668 KiB |
| random_04.txt | AC | 1 ms | 3796 KiB |