Submission #71471976


Source Code Expand

#include <bits/stdc++.h>
#define int long long
using namespace std;
namespace IO {
	template<typename T> inline void read(T &x) {
		bool f = 1;
		x = 0;
		char ch = getchar();
		while (ch < '0' || ch > '9') {
			if (ch == '-')f = 0;
			ch = getchar();
		}
		while (ch >= '0' && ch <= '9') x = (x << 1) + (x << 3) + (ch & 15), ch = getchar();
		x = f ? x : -x;
	}
	template<typename T> inline void write(T x) {
		if (x < 0) putchar('-'), x = -x;
		if (x > 9) write(x / 10);
		putchar(('0' + x % 10));
	}
	template <typename T, typename ...Args> inline
	void read(T &x, Args &...args) {read(x),read(args...);}
	template<typename T> inline void write(T x, char c) {write(x), putchar(c);}
}
using namespace IO;
const int INF=1e18;

int n;

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);

	cin>>n;
	cout<<(1+n)*n/2<<"\n";

	return 0;
}

Submission Info

Submission Time
Task A - Triangular Number
User NingMeng_yang
Language C++23 (GCC 15.2.0)
Score 100
Code Size 894 Byte
Status AC
Exec Time 1 ms
Memory 3612 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 11
Set Name Test Cases
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
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3600 KiB
example_01.txt AC 1 ms 3560 KiB
example_02.txt AC 1 ms 3548 KiB
hand_00.txt AC 1 ms 3540 KiB
hand_01.txt AC 1 ms 3480 KiB
hand_02.txt AC 1 ms 3612 KiB
random_00.txt AC 1 ms 3612 KiB
random_01.txt AC 1 ms 3544 KiB
random_02.txt AC 1 ms 3536 KiB
random_03.txt AC 1 ms 3576 KiB
random_04.txt AC 1 ms 3612 KiB