Codeforces Round #117 (Div. 2) B : Vasya's Calendar
問題概要(適当)
カレンダーを手動で合わせるとき何回余分にめくる必要があるか求める問題。
acceptされたコード
#include <cstdio> #include <numeric> using namespace std; const int MAX_N = 2000; int N, D; int as[MAX_N]; void init(){ scanf("%d%d", &D, &N); for(int i=0; i<N; ++i){ scanf("%d", as+i); } } int solve(){ --N; return N*D - accumulate(as, as+N, 0); } int main(){ init(); printf("%d\n", solve()); return 0; }