Monday, December 09, 2013

[UVa] 12712 - Pattern Locker

#include <cstdio>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

#define MOD 10000000000007

typedef long long lint;

int main() {

    lint test, l, m, n, kase=1;

    cin >> test;

    while (test--) {

        cin >> l >> m >> n;
        lint init = 1;
        for (lint i = l*l ; i>(l*l-m) ; i--) {
            init = ((init * i)%MOD);
        }
        lint sum = init;
        for (lint i = (l*l-m) ; i>(l*l-n) ; i--) {
            init = ((init * i)%MOD);
            sum = ((sum + init)%MOD);
        }

        cout << "Case " << kase++ << ": " << sum << endl;


    }


    return 0;
}


No comments:

Post a Comment

Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.

Connect Rapoo MT750S with Linux (Tested on Manjaro)

 I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...