RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00203

Funkcija

Diamond V 다이아몬드 V
난이도
1s
시간 제한
128MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Mirko has written the following function:

int fun() {
    int ret = 0;
    for (int a = X1; a <= Y1; ++a)
        for (int b = X2; b <= Y2; ++b)
            ...
                for (int <N-th> = XN; <N-th> <= YN; ++<N-th>)
                    ret = (ret + 1) % 1000000007;
    return ret;
}
function fun: longint;
var
    ret: longint;
    a, b, ... , y, z: longint;
begin
    ret := 0;
    for a := X1 to Y1 do
        for b := X2 to Y2 do
            ...
                for <N-th> := XN to YN do
                    ret := (ret + 1) mod 1000000007;
    fun := ret;
end;

<N-th> denotes the \(N\)th lowercase letter of the English alphabet. Each \(X_i\) and \(Y_i\) denotes either a positive integer less than or equal to \(100\,000\) or a name of a variable that some outer loop iterates over. For example, \(X_3\) can be either a, b, or an integer literal. At least one of \(X_i\) and \(Y_i\) will be an integer literal (i.e. not a variable name) for every \(i\).

Compute the return value of the function.

제약
입력 형식

The first line of input contains the positive integer \(N\) (\(1 \le N \le 26\)).

For the next \(N\) lines, the \(i\)-th line contains \(X_i\) and \(Y_i\), separated with a space. If \(X_i\) and \(Y_i\) are both integer literals, then \(X_i \le Y_i\).

출력 형식

The first and only line of output must contain the return value of the function.

서브태스크
서브태스크점수설명

Test 1

10점

None

Test 2

9점

None

Test 3

9점

None

Test 4

9점

None

Test 5

9점

None

Test 6

9점

None

Test 7

9점

None

Test 8

9점

None

Test 9

9점

None

Test 10

9점

None

Test 11

9점

None

예제 1
입력
2
1 2
a 3
출력
5
예제 2
입력
3
2 3
1 2
1 a
출력
10
예제 3
입력
3
1 2
a 3
1 b
출력
11
문제 정보

riseoj 작성

출처 COCI 2011/2012 Contest 2

평가 및 의견

Funkcija

개요
출제자 난이도 Diamond V 다이아몬드 V 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Funkcija

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8