QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#64714#4626. Sum Plus Productqinjianbin#AC ✓4ms3548kbC++17481b2022-11-25 13:00:372022-11-25 13:00:39

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-25 13:00:39]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:3548kb
  • [2022-11-25 13:00:37]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define _for(i, a, b) for(int i = (a); i <= (b); i++)
using namespace std;

typedef long long ll;
const int mod = 998244353;

int main()
{
	int T; scanf("%d", &T);
	while(T--)
	{
		int n; scanf("%d", &n);

		ll ans = 1;
		_for(i, 1, n)
		{
			int x; scanf("%d", &x);
			ans = ans * (x + 1) % mod;
		}
		ans--;
		if(ans < 0) ans += mod;
		printf("%lld\n", ans);
	}
	
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 4ms
memory: 3548kb

input:

20
500
732119 592443 487799 985235 815368 743444 295 298638 775259 682852 582519 959745 58200 894834 569370 811779 934590 894530 62915 824557 788216 907951 676664 158503 712163 916901 419672 787605 772426 781424 54232 249035 937144 397358 513471 866695 905096 196496 757032 651037 313683 13446 892474...

output:

114197416
917043234
544093214
401121933
778909293
664748218
176577148
573588739
287522182
393491771
106995199
907165620
901896328
869872965
856266924
464500410
563224721
217487082
379371271
77123502

result:

ok 20 lines