Codeforces Round #235 (Div. 2) A. Vanya and Cards

#include <iostream>
using namespace std;

int main(){
    int n,x;
    cin >> n >> x;
    int sum = 0;
    for(int i = 0 ; i <  n ; ++ i){
        int number;
        cin>>  number;
        sum +=number;
    }
    if(sum < 0) sum = -sum;
    cout<<(sum%x ? sum/x+1 : sum/x) <<endl;
}
原文地址:https://www.cnblogs.com/xiongqiangcs/p/3597482.html