QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#21263#2817. 鸽鸽的分割glory_to_the_qy#AC ✓3ms3660kbC++20271b2022-03-04 14:15:422022-05-08 02:48:35

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-08 02:48:35]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3660kb
  • [2022-03-04 14:15:42]
  • 提交

answer

#include <bits/stdc++.h>

long long f[10005];

int main() {
	int x;
	while (std::cin >> x) {
		f[0] = 1;
		f[1] = 1;
		f[2] = 2;
		for (int i = 3; i <= x; ++i)
			f[i] = f[i - 1] + i - 1 + (i - 1) * (i - 2) * (i - 3) / 6;
		std::cout << f[x] << '\n';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3660kb

input:

0
1
2
3
4
5
6
7
8
9
10
20
30
40
50
60
61
62
63
64

output:

1
1
2
4
8
16
31
57
99
163
256
5036
27841
92171
231526
489406
523686
559737
597619
637393

result:

ok 20 lines