<span style="font-size:36px;">#include <stdio.h>
int main() {
int c, n, i, max, ans;
int a[16], book[102];
scanf("%d", &c);
while(c--) {
ans = 0;
max = 0;
for(i=1; i<101; i++)
book[i] = 0;
scanf("%d", &n);
for(i=1; i<=n; i++) {
scanf("%d", &a[i]);
if(max<a[i])
max = a[i];
book[a[i]] ++;
}
ans += max * 6;
ans += max * 4;
for(i=1; i<=max; i++) {
if(book[i])
ans += 5;
ans += book[i];
}
printf("%d\n", ans);
}
return 0;
}</span>杭电acm4505
最新推荐文章于 2021-05-17 21:44:23 发布
本文提供了一道C语言编程竞赛题目解决方案,该程序通过读取输入数据并使用数组记录和计算来解决特定的数学问题。它展示了如何利用C语言进行高效的数据处理,并通过具体的例子解释了算法的设计思路。
2270

被折叠的 条评论
为什么被折叠?



