HDU 1096 A+B for Input-Output Practice (VIII)

#include <cstdio>

int main()

{

  int n,m;

  scanf("%d",&m);

  while(scanf("%d",&n)!=EOF)

  {

    int x,ans;

    ans=0;

    for(int i=1; i<=n; i++) 

    {

      scanf("%d",&x);

      ans+=x;

    }

    if (m==1) printf("%d\n",ans);

    else printf("%d\n\n",ans);

    m--;

  }

  return 0;

}

 

你可能感兴趣的:(input)