HDU 2304 Electrical Outlets

http://acm.hdu.edu.cn/showproblem.php?pid=2304

一个插头,n个插线板,问最后剩几个能插的电器的

View Code
#include <iostream>
using namespace std ;
int main()
{
    int n;
    scanf("%d",&n);
    while(n--)
    {
        int k;
        scanf("%d",&k);
        int s=0;
        for(int i=0;i<k;i++)
        {
            int w;
            scanf("%d",&w);
            s+=w;
        }
        printf("%d\n",s-k+1);
    }
    return 0;
} 
原文地址:https://www.cnblogs.com/xiaohongmao/p/2528255.html