当前位置: 首页 > 工具软件 > Blanket > 使用案例 >

UVALive 6852 Blanket(暴力)

宗涵蓄
2023-12-01

题意:

N105,M106,0M1
,(a,b),a[0,a],b,
N,,0N

分析:

,0a<b16
cnt[T][mod]:=Tmod
[0,M)

代码:

//
//  Created by TaoSama on 2015-12-12
//  Copyright (c) 2015 TaoSama. All rights reserved.
//
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <vector>
#include <cassert>

using namespace std;
#define pr(x) cout << #x << " = " << x << "  "
#define prln(x) cout << #x << " = " << x << endl
const int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7;

int n, m, ans[N], cnt[20][20];

int main() {
#ifdef LOCAL
    freopen("C:\\Users\\TaoSama\\Desktop\\in.txt", "r", stdin);
//  freopen("C:\\Users\\TaoSama\\Desktop\\out.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(0);

    int t; scanf("%d", &t);
    while(t--) {
        scanf("%d%d", &n, &m);
        memset(cnt, 0, sizeof cnt);
        memset(ans, 0, sizeof ans);
        for(int i = 1; i <= n; ++i) {
            int a, b; scanf("%d%d", &a, &b);
            for(int j = 0; j < a; ++j) ++cnt[b][j];
        }
        for(int i = 0; i < m; ++i) {
            int cur = 0;
            for(int j = 1; j <= 16; ++j)
                cur += cnt[j][i % j];
            ++ans[cur];
        }
        for(int i = 0; i <= n; ++i) printf("%d\n", ans[i]);
    }
    return 0;
}
 类似资料: