Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d,e,k; cin >> a >> b >> c >> d >> e >> k; if ((e-a)>k) cout << ":("; else cout << "Yay!"; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int A=sc.nextInt(); int B=sc.nextInt(); int C=sc.nextInt(); int D=sc.nextInt(); int E=sc.nextInt(); int K=sc.nextInt(); System.out.println(E - A <= K ? "Yay!":":(") ; } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int limit = 5; int [] list = new int [limit]; for(int i = 0 ; i < limit ; ++i) { list[i] = Integer.parseInt(sc.next()); }; int k = Integer.parseInt(sc.next()); if(list[list.length-1] - list[0] <= k) { System.out.println("Yay!"); }else { System.out.println(":("); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a, *_, e, k = [int(input()) for x in ' '*6] print([':(', 'Yay!'][e-a<=k])
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int K = sc.nextInt(); if(K>=b-a && K>=c-a && K>=d-a && K>=e-a && K>=c-b && K>=d-b && K>=e-b && K>=d-c && K>=e-c && K>=e-d){ System.out.println("Yay!"); }else{ System.out.println(":("); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a = int(raw_input()) b = int(raw_input()) c = int(raw_input()) d = int(raw_input()) e = int(raw_input()) k = int(raw_input()) def an (a,b,c,d,e,k) : for i in {b,c,d,e} : if i-a>k : return ":(" for i in {c,d,e} : if i-b>k : return ":(" for i in {d,e} : if i-c>k : return":(" for i in {e} : if i-d>k : return ":(" return "Yay!" ans = an(a,b,c,d,e,k) print ans
PYTHON
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a,b,c,d,e,f=[int(input()) for i in range(6)] print(":(" if e-a>f else "Yay!")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a,k=[int(input())for i in[0]*5],int(input());print(':('if a[4]-a[0]>k else'Yay!')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
l=list(int(input()) for _ in range(5)) m=int(input()) print([":(","Yay!"][l[4]-l[0]<=m])
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main() { int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k; cout << (e - a <= k ? "Yay!" : ":(") << endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[] array = new int[5]; for(int i=0; i<5; i++){ array[i] = sc.nextInt(); } int k = sc.nextInt(); int sub = array[4] - array[0]; if(sub>k){ System.out.println(":("); }else{ System.out.println("Yay!"); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a = [int(input()) for i in range(6)] print('Yay!' if a[4]-a[0]<=a[5] else ':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; class Main { public static void main(String args[]) { Scanner inp = new Scanner(System.in); int a = inp.nextInt(); inp.nextInt();inp.nextInt();inp.nextInt(); int e = inp.nextInt(); int k = inp.nextInt(); if (e - a <= k) System.out.println("Yay!"); else System.out.println(":("); inp.close(); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
def main(): antenna = [] for i in range(5): antenna.append(int(raw_input())) k = int(raw_input()) if (antenna[-1] - antenna[0]) <= k: print("Yay!") else: print(":(") if __name__ == "__main__": main()
PYTHON
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main() { int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k; cout << ((e - a) <= k ? "Yay!" : ":(") << endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
A = [int(input()) for _ in range(5)] k = int(input()) print("Yay!" if (A[4]-A[0])<=k else ":(")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main() { int a,b,c,d,e,k; cin >> a >> b >> c >> d >> e >> k; if (e-a <= k) cout << "Yay!" << endl; else cout << ":(" << endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main(){ int a,b,c,k; cin>>a>>b>>b>>b>>c>>k; if(c-a > k){ cout <<":(" << endl; } else cout << "Yay!" << endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
*a,k = [int(input()) for _ in range(6)] print('Yay!' if max(a) - min(a) <= k else ':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a,b,c,d,e,k=(int(input()) for i in range(6)) print('Yay!' if e-a<=k else ':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<bits/stdc++.h> using namespace std; int main(){ int a[5],k;cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k; if(a[4]-a[0]<=k)cout<<"Yay!"<<endl; else cout<<":("<<endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); int b = scanner.nextInt(); int c = scanner.nextInt(); int d = scanner.nextInt(); int e = scanner.nextInt(); int k = scanner.nextInt(); if (e - a <= k) { System.out.print("Yay!"); } else { System.out.print(":("); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; int dis=e-a; if(dis<=k)puts("Yay!"); else puts(":("); return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
*a,k=map(int,open(0));print(("Yay!",":(")[a[4]-a[0]>k])
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main(int, char**) { int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k; cout << (e - a > k ? ":(" : "Yay!") << endl; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a=[ int(input()) for i in range(6)] print(":(" if (a[4]-a[0])>a[5] else "Yay!")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<iostream> #include<string> using namespace std; int f; int main(){ int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; if(e-a>k){ cout<<":("<<endl; } else cout<<"Yay!"<<endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a,b,c,d,e,k = [int(input()) for _ in range(6)] print("Yay!" if e-a<=k else ":(")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int a[] = new int[5]; for(int i = 0; i < 5; i++) { a[i] = sc.nextInt(); } int k = sc.nextInt(); //for(int i = 1; i < 5; i++) { if(a[4] - a[0] > k) { System.out.println(":("); return; } //} System.out.println("Yay!"); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; cout<<(e-a<=k?"Yay!":":(")<<endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] coordinates = new int[5]; for (int i=0; i<5; i++) { coordinates[i] = sc.nextInt(); } int k = sc.nextInt(); if (coordinates[4] - coordinates[0] <= k) { System.out.println("Yay!"); } else { System.out.println(":("); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main() { int a,b,c,d,e; cin>>a>>b>>c>>d>>e; int k; cin>>k; if(e-a>k) { cout<<":(";} else cout<<"Yay!"; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a,b,c,d,e,k = map(int,open(0).read().split()) if e-a<=k: print("Yay!") else: print(":(")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
ls = [int(input()) for i in range(5)] print('Yay!' if ls[4]-ls[0] <= int(input()) else ':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<iostream> using namespace std; int main(){ int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; if(k>=e-a) cout<<"Yay!"<<endl; else cout<<":("<<endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<iostream> using namespace std; int main(){ int A,B,C,D,E,K; cin>>A>>B>>C>>D>>E>>K; if(E-A<=K) cout<<"Yay!"<<endl; else cout<<":("<<endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
L=[int(input()) for _ in range(6)];print(["Yay!",":("][L[4]-L[0]>L[5]])
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a=[int(input()) for _ in range(5)];k=int(input());print(':(' if max(a)-min(a)>k else 'Yay!')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); // 整数の入力 int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int k = sc.nextInt(); if (e - a > k) { System.out.println(":("); } else { System.out.println("Yay!"); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
l = [int(input()) for i in range(6)] if l[4]-l[0]>l[5]: print(":(") else: print("Yay!")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; import static java.lang.System.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] a = new int[5]; for (int i = 0; i < a.length; i++) { a[i] = sc.nextInt(); } int k = sc.nextInt(); if (a[4] - a[0] > k) { out.println(":("); return; } out.println("Yay!"); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main() { int a, e, k; cin >> a >> k >> k >> k >> e >> k; cout << (e - a > k ? ":(" : "Yay!") << endl; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main(){ int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; if(e-a <= k){ cout <<"Yay!"; }else cout <<":("; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<iostream> using namespace std; int main() { int a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f; if((e-a)>f) cout<<":("; else cout<<"Yay!"; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a = [int(input()) for _ in range(5)] print([":(", "Yay!"][a[-1] - a[0] <= int(input())])
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k; cout << (k < e - a ? ":(" : "Yay!") << endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int k = sc.nextInt(); System.out.println(e-a <= k ? "Yay!":":("); }}
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a=int(input()) input() input() input() print(':(' if int(input())-a>int(input()) else 'Yay!')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a=sc.nextInt(); int b=sc.nextInt(); int c=sc.nextInt(); int d=sc.nextInt(); int e=sc.nextInt(); int k=sc.nextInt(); if (e-a>k) { System.out.println(":("); }else{ System.out.println("Yay!"); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
l=[int(input()) for _ in range(5)] k=int(input()) print(":(" if l[4]-l[0]>k else "Yay!")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int max = 0; int min = 123; int input; for(int i = 0; i < 5; i++){ input = sc.nextByte(); max = Math.max(max,input); min = Math.min(min,input); } int k = sc.nextByte(); if(k >= max - min){ System.out.println("Yay!"); }else{ System.out.println(":("); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<cstdio> int a[11]; int k; int main() { for(int i=0;i<5;i++) scanf("%d", &a[i]); scanf("%d", &k); puts(a[4]-a[0]>k ? ":(" : "Yay!"); return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
l=[int(input()) for i in range(6)] k=l[5] if l[4]-l[0]>k: print(":(") else: print("Yay!")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
S=[int(input()) for i in range(6)] if S[4]-S[0]<=S[5]: print('Yay!') else: print(':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=5; int num[]=new int[5]; for(int i=0;i<n;i++)num[i]=sc.nextInt(); int k=sc.nextInt(); boolean po=true; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(Math.abs(num[i]-num[j])>k)po=false; } } System.out.println((po)?"Yay!":":("); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int f = sc.nextInt(); if ((e - a) > f){ System.out.println(":("); } else { System.out.println("Yay!"); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main(){ int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e; cin>>k; int i=e-a; if(i>k) cout<<":("; else cout<<"Yay!"; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k; cout << (k < (e - a) ? ":(" : "Yay!"); }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
t = [int(input()) for i in range(6)] if t[4] - t[0] <= t[5]: print('Yay!') else: print(':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int e = sc.nextInt(); e = sc.nextInt(); e = sc.nextInt(); e = sc.nextInt(); int k = sc.nextInt(); if(e-a <= k ) System.out.println("Yay!"); else System.out.println(":("); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main(){ int a,b,c,d,e,k; cin >> a >> b >> c >> d >> e >> k; if(e-a > k) cout << ":(" << endl; else cout << "Yay!"; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
A = [int(input()) for i in range(5)] print('Yay!' if A[4]-A[0]<=int(input()) else ":(")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int a,b,c,d,e,k; int main(){ cin >> a >> b >> c >> d >> e >> k; if(e-a>k) cout << ":(" << endl; else cout << "Yay!" << endl; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<cstdio> int main() { int p[5],k; for(int i=0;i<5;i++)scanf("%d",&p[i]); scanf("%d",&k); puts(p[4]-p[0]>k?":(":"Yay!"); }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner s = new Scanner(System.in)) { final int A = s.nextInt(); s.nextInt(); s.nextInt(); s.nextInt(); final int E = s.nextInt(); final int K = s.nextInt(); if(E - A > K) { System.out.println(":("); } else { System.out.println("Yay!"); } } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a = [int(input()) for _ in range(6)] if a[4] - a[0] > a[5]: print(':(') else: print('Yay!')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> int main() { int a, b, c, d, e, k; std::cin >> a >> b >> c >> d >> e >> k; std::cout << ((e - a) > k ? ":(" : "Yay!") << std::endl; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int k = sc.nextInt(); sc.close(); if (e - a <= k) { System.out.println("Yay!"); return; } System.out.println(":("); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main(void) { int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; if((e-a)<=k) cout<<"Yay!"<<endl; else cout<<":("<<endl; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int k = sc.nextInt(); if (Math.abs(a - e) <= k) { System.out.println("Yay!"); } else { System.out.println(":("); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<bits/stdc++.h> using namespace std; int main(void){ int a, b, c, d, e, k; cin>>a>>b>>c>>d>>e>>k; if(e-a <= k)cout<<"Yay!"<<endl; else cout<<":("<<endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main() { int a, b, k; cin >> a >> b >> b >> b >> b >> k; cout << (b - a <= k ? "Yay!" : ":(") << endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] arr = new int[5]; for (int i=0; i<5; i++) { arr[i] = sc.nextInt(); } Arrays.sort(arr); int k = sc.nextInt(); if (arr[4]-arr[0]>k) { System.out.println(":("); } else { System.out.println("Yay!"); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main() { int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k; cout << ((e-a>k)? ":(" : "Yay!") << endl; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int max = 0; int min = 123; int x; for (int i=0; i<5;i++) { x = sc.nextInt(); max =Math.max(max,x); min = Math.min(min,x); } int k = sc.nextInt(); if (max - min > k) System.out.println(":("); else System.out.println("Yay!"); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a=[int(input()) for i in range(6)] if abs(a[4]-a[0])<=a[5]: print("Yay!") else: print(":(")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main(){ int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; if(e-a>k || e-b>k || e-c>k || e-d>k)cout<<":("<<endl; else cout<<"Yay!"<<endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a,*_,e,k=map(int,open(0).read().split());print("Y:a(y !"[e-a>k::2])
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d,e,kyori; cin >> a >> b >> c >> d >> e >> kyori; if(e - a <= kyori) cout << "Yay!"; else cout << ":("; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a,b,c,d,e,k=[int(input()) for _ in range(6)] print('Yay!' if k>=e-a else ':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main(void){ int a,b,c,d,e,k; cin >> a >> b >> c >> d >> e >> k; if (e - a > k) { cout << ":("; } else { cout << "Yay!"; } }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
lst = [] for i in range(0, 5): lst.append(int(raw_input())) k = int(raw_input()) ans = 'Yay!' for i in range(0, 5): for j in range(i+1, 5): if lst[j]-lst[i] > k: ans = ':(' print ans
PYTHON
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
l=[int(input())for _ in range(5)] print([':(','Yay!'][int(input())>=l[4]-l[0]])
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
*a,k=[int(input()) for _ in range(6)] print("Yay!" if max(a)-min(a)<=k else ":(")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] a = new int[5]; for (int i = 0; i < 5; i++) a[i] = sc. nextInt(); System.out.println(a[4]-a[0] <= sc.nextInt() ? "Yay!" : ":("); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); // String[] nyu=sc.nextLine().split(" "); // String nyu=sc.nextLine(); int[] num=new int[6]; for(int i=0;i<6;i++){ num[i]=Integer.parseInt(sc.nextLine()); } if(num[4]-num[0]<num[5]+1){ System.out.println("Yay!"); }else{ System.out.println(":"+"("); } //int A=Integer.parseInt(nyu[0]); //int B=Integer.parseInt(nyu[1]); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
L = [int(input()) for k in range(5)] k = int(input()) print("Yay!" if max(L)-min(L)<=k else ":(")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); boolean ans = true; int[] a = new int[5]; for (int i = 0; i < 5; i++) { a[i] = sc.nextInt(); } int k = sc.nextInt(); if(a[4] - a[0] <= k) System.out.println("Yay!"); else System.out.println(":("); sc.close(); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main(void){ int a,b,c,d,e,k; cin >> a >> b >> c >> d >> e >> k; cout << (e-a-k>0?":(":"Yay!") << endl; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = Integer.parseInt(sc.next()); int b = Integer.parseInt(sc.next()); int c = Integer.parseInt(sc.next()); int d = Integer.parseInt(sc.next()); int e = Integer.parseInt(sc.next()); int k = Integer.parseInt(sc.next()); System.out.println((e - a) <= k ? "Yay!" : ":("); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a,b,c,d,e,k = [int(input()) for i in range(6)] print(':(' if e-a > k else 'Yay!')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a, b, c, d, e, k = [int(raw_input()) for i in range(6)] #print(k) list = [a, b, c, d, e] #print(list) flag = True for i in range(5): y = list[0] list.pop(0) #print(list) alist = map(lambda x: x - y, list) #print(alist) if (all([z <= k for z in alist])) == False: flag = False break else: continue break if flag == True: print("Yay!") else: print(":(")
PYTHON
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a = [int(input()) for i in range(5)] k = int(input()) print('Yay!' if a[-1] - a[0] <= k else ':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; cout<<(e-a>k?":(":"Yay!")<<endl; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
x = [int(input()) for _ in range(6)] print(':(' if x[-2]-x[0] > x[-1] else 'Yay!')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main() { int a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f; if(e-a>f){ cout<<":("<<endl; } else{ cout<<"Yay!"<<endl; } }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main(){ int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; if((e-a)>k)cout<<":("; else cout<<"Yay!"; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main() { int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; if (e-a>k||e-b>k||e-c>k||e-d>k) { cout << ":("; } else cout << "Yay!"; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main() { int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >> k; cout << (e - a > k ? ":(" : "Yay!") << endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.io.CharArrayReader; import java.lang.reflect.Array; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList<Integer> arr = new ArrayList<Integer>(); for(int i=0;i<5;i++)arr.add(sc.nextInt()); int k=sc.nextInt(); Collections.sort(arr); if(arr.get(4)-arr.get(0)>k)System.out.println(":("); else System.out.println("Yay!"); } }
JAVA