Type: Default 1000ms 256MiB

素数求和

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

有一个序列由NN个数字A1,A2,A3,,AnA_1,A_2,A_3,\ldots,A_n组成,请找出其中所有的质数并求和

数据范围

1N10000 1\leq N \leq 10000

1Ai1000000000 1\leq A_i \leq 1000000000

输入

第一行输入一个数字N表示序列一共有N个数字 随后一行N个数字表示该序列的N个数字A1,A2,A3,,AnA_1,A_2,A_3,\ldots,A_n

输出

输出该序列A1,A2,A3,,AnA_1,A_2,A_3,\ldots,A_n中所有质数的总和

样例

5
8 3 7 2 16
12

样例解释

8 3 7 2 16其中只有816不是素数,其余都是素数,所以2+3+7=12

第六届西南石油大学程序设计新生赛

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
12
Start at
2022-11-27 14:10
End at
2022-11-27 18:10
Duration
4 hour(s)
Host
Partic.
100