/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
真夏の N 日間、高橋君は毎日の最高気温と最低気温を記録しました。 i 日目の最高気温は A_i 度、最低気温は B_i 度でした。
1 日の最高気温と最低気温の差が K 度以上の日を「寒暖差の大きい日」と呼びます。各日について、寒暖差の大きい日なら L 、そうでなければ S として、 1 日目から順に並べた長さ N の文字列を出力してください。
制約
- 1 \leq N \leq 100
- 1 \leq K \leq 50
- 0 \leq B_i \leq A_i \leq 50
- 入力はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
N K A_1 B_1 A_2 B_2 \vdots A_N B_N
- 1 行目には、日数 N と基準となる気温差 K がスペース区切りで与えられる。
- 2 行目から N 行にわたり、 1 + i 行目には i 日目の最高気温 A_i と最低気温 B_i がスペース区切りで与えられる。
出力
長さ N の文字列を 1 行で出力せよ。
入力例 1
4 10 35 22 30 25 38 20 29 28
出力例 1
LSLS
入力例 2
1 5 33 30
出力例 2
S
入力例 3
2 8 40 20 27 20
出力例 3
LS
入力例 4
1 1 33 30
出力例 4
L
入力例 5
6 38 12 2 39 18 49 4 26 1 43 12 2 1
出力例 5
SSLSSS
Score : 200 pts
Problem Statement
During N midsummer days, Takahashi recorded the highest and lowest temperatures each day. On day i, the highest temperature was A_i degrees and the lowest temperature was B_i degrees.
A day is called a "day with a large temperature difference" if the difference between the highest and lowest temperatures of that day is at least K degrees. For each day, let L denote a day with a large temperature difference and S denote any other day. Print the string of length N obtained by arranging these characters in order starting from day 1.
Constraints
- 1 \leq N \leq 100
- 1 \leq K \leq 50
- 0 \leq B_i \leq A_i \leq 50
- All input values are integers.
Input
The input is given from Standard Input in the following format:
N K A_1 B_1 A_2 B_2 \vdots A_N B_N
- The first line contains the number of days N and the reference temperature difference K, separated by a space.
- For each of the next N lines, line 1 + i contains the highest temperature A_i and the lowest temperature B_i of day i, separated by a space.
Output
Print a single string of length N on one line.
Sample Input 1
4 10 35 22 30 25 38 20 29 28
Sample Output 1
LSLS
Sample Input 2
1 5 33 30
Sample Output 2
S
Sample Input 3
2 8 40 20 27 20
Sample Output 3
LS
Sample Input 4
1 1 33 30
Sample Output 4
L
Sample Input 5
6 38 12 2 39 18 49 4 26 1 43 12 2 1
Sample Output 5
SSLSSS