[Offer收割]编程练习赛12 register

Ended

Participants:1323

Verdict:Accepted
Score:100 / 100
Submitted:2017-04-02 13:09:28

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string>
using namespace std;
const int N = 100010;
int sum[N];
int main()
{
    
    int n;
    while (cin >> n) {
        memset(sum, 0, sizeof(sum));
        long long c,d;
        long long l = 0;
        for (int j = 1; j <= n; j++) {
            cin >> c;
            long long length = 0;
            for (int i = 1; i <= c; i++) {
                cin >> d;
                int pre = length+1;
                length += d;
                for (int k = pre; k < length; k++) {
                    sum[k]++;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX