【B1010/模拟】多项式求导(巧用数组)

【B1010/模拟】多项式求导(巧用数组)

倒序输出时,i不能=maxn ,这是越界访问了,最大从maxn-1开始

#include<iostream>
#include<cstdio>
using namespace std;
const int maxn = 1000;
int main() {
	int p[maxn] = { 0 }, A[maxn] = { 0 },e,x;
	while (scanf("%d%d", &x, &e) != EOF) {
		A[e] = x;
	}
	for (int i = 1; i < maxn; i++) {
		p[i - 1] = A[i] * i;
	}
	for (int i = maxn-1; i >= 0; i--) {
		if (p[i] != 0)	cout << p[i] << " " << i<<" ";
	}
	system("pause");
	return 0;
}

上一篇:什么是OCSP Stapling


下一篇:【http】https加速优化