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
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) 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
#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
a = [int(input()) for _ in range(6)] print("Yay!") if a[-2] - a[0] < a[-1] + 1 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
x = [int(input()) for _ in range(6)] print('Yay!' if x[4] - x[0] <= x[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
*a,k=map(int,open(0));print("Y:a(y !"[max(a)-min(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
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>=e-a){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,k,e; 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
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n[]=new int[5]; String s="Yay!"; for(int i=0;i<=4;i++){ n[i]= sc.nextInt();// nこの希望 } int k=sc.nextInt(); for(int i=0;i<=4;i++){ for(int j=0;j<=4;j++){ if(Math.abs(n[i]-n[j])>k){ s=":("; } } } System.out.println(s); }}
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 _ in range(6)) print('Yay!' if abs(a-e) <= 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
s=[int(input()) for i in range(5)] k=int(input()) print("Yay!" if abs(max(s)-min(s))<=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( ":(" 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
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); int a = stdin.nextInt(); int b = stdin.nextInt(); int c = stdin.nextInt(); int d = stdin.nextInt(); int e = stdin.nextInt(); int k = stdin.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 <bits/stdc++.h> int main() { int a, b, c, d, e, k; scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &k); if (e - a <= k) puts("Yay!"); else puts(":("); }
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 sca = new Scanner(System.in); int a = sca.nextInt(),b = sca.nextInt(),c = sca.nextInt(),d = sca.nextInt(),e = sca.nextInt(),k = sca.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
#include<bits/stdc++.h> using namespace std; int main(){ int a, b, c, d, e, k; cin >> a >> b >> c >> d >> e >>k; if(k < e - a) return cout << ":(", 0; 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 <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<<"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
a = [int(input()) for i 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
a=[int(input()) for i in range(5)] print("Yay!" if max(a)-min(a)<=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
a = [input() for _ in range(5)] k = input() if a[4] - a[0] > k: print ':(' else: print 'Yay!'
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 a,d,e; int main() { cin>>a>>d>>d>>d>>d>>e; cout<<(d-a>e?":(":"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<iostream> using namespace std; int main(){ int a,b,c; cin>>a>>b>>b>>b>>b>>c; cout<<((b-a<=c)?"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<iostream> using namespace std; int main(){ int a[6]; for(int i=0;i<6;i++) cin >> a[i]; if(a[5]<a[4]-a[0]) 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
a,b,c,d,e,k=[int(input())for _ 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
n = [int(input()) for _ in range(6)] print(":(" if n[4]-n[0] > n[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
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 <iostream> using namespace std; int A[6],k; int main(){ for(int i=1;i<=5;i++) cin >> A[i]; cin >> k; cout << ((A[5]-A[1]<=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, 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
l = [int(input()) for i 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
#include<iostream> using namespace std; int main() { int a[10],k; for(int i=1;i<=5;i++) cin>>a[i]; cin>>k; if(k<a[5]-a[1]) 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 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 a,b,c,d,e,k; int main(){ 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
a = [] for i in range(6): a.append(input()) maxn = 0 minn = 128 for i in range(5): if(maxn < a[i]): maxn = a[i] if(minn > a[i]): minn = a[i] if(maxn - minn > a[5]): print(":(") else: print("Yay!")
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,k=map(int,open(0)) 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.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int[] n = new int[6]; for (int i = 0; i < 6; i++) { n[i] = sc.nextInt(); } if ((n[4] - n[0]) <= n[5]) { 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
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int abcde[]=new int[5]; for(int i=0;i<abcde.length;i++) { abcde[i]=scan.nextInt(); } int k=scan.nextInt(); scan.close(); if(k<(abcde[abcde.length-1]-abcde[0]))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<stdio.h> int main(){ int a[5],i,j,k; for(i=0;i<5;i++){ scanf("%d",&a[i]); } scanf("%d",&k); if(a[4]-a[0]>k)printf(":(\n"); else printf("Yay!\n"); 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 a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt(), d = sc.nextInt(), e = sc.nextInt(), k = sc.nextInt(); String res = "Yay!"; if (e - a > k){ res = ":("; } System.out.println(res); } }
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 x in range(6)] 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
l = [int(input()) for _ in range(5)] k = int(input()) print(':(' if l[-1] - 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
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
*a,k=map(int,open(0));print("Y:a(y !"[a[4]-a[0]>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
a,b,c,d,e,k = [int(input()) for _ in range(6)] ans = "Yay!" if e-a > k: ans = ":(" print(ans)
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,*x,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.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); int l = sc.nextInt(); int g = sc.nextInt(); int p = sc.nextInt(); long count=0; if(m-n>p ||k-n>p ||l-n>p ||g-n>p||k-m>p||l-m>p||g-m>p||l-k>p||g-k>p||g-l>p) { 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 <bits/stdc++.h> using namespace std; int main(){ vector<int> v(6); for(int i = 0; i < 6; i++) cin >> v[i]; cout << (v[4]-v[0] > v[5] ? ":(" : "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!"; ; }
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 << ":("; 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 min = sc.nextInt(); sc.nextInt(); sc.nextInt(); sc.nextInt(); int max = sc.nextInt(); 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
#include<bits/stdc++.h> using namespace std; int main(){ int n,m,k; cin >> n >> m >> m >> m >> m >> k; if(m-n<=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
a,b,c,d,e,f=[int(input()) for i in range(6)] if -f<=e-a<=f: 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.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { 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("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(input())for i 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 <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; 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,*_,e,k=map(int,open(0).read().split());print(':('*(e-a>k)or'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,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 scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt(); int d = scan.nextInt(); int e = scan.nextInt(); int k = scan.nextInt(); if(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>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; 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
a = [int(input()) for i in range(5)] f = a[-1] - a[0] <= int(input()) print("Yay!" if f 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
L=[int(input()) for i in range(5)] k=int(input()) print('Yay!' if L[4]-L[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
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.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.nextInt(); max = Math.max(max,input); min = Math.min(min,input); } int k = sc.nextInt(); 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
import java.util.*; import java.math.*; public class Main { Scanner sc = new Scanner(System.in); void run(){ // kokonikaku int a[] = new int[5]; for(int i=0;i<5;i++){ a[i]=sc.nextInt(); } int k=sc.nextInt(); int e=0; for(int i=0;i<1;i++){ if(a[i+4]-a[i]>k)e=1; } if(e==1){ System.out.println(":("); } else{ System.out.println("Yay!"); } } public static void main(String[] args) { new Main().run(); } }
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) { 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.print(":("); } else { System.out.print("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) { Scanner sc = new Scanner(System.in); int[] a = new int[5]; for(int i = 0; i < 5; i++) a[i]=Integer.parseInt(sc.next()); int k = Integer.parseInt(sc.next()); System.out.println(a[a.length-1] - a[0] <= 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
L = [int(input()) for _ in range(6)] print(":(" if L[4] - L[0] > L[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
import java.util.Arrays; import java.util.Scanner; public class Main { static String ans="Yay!"; public static void main(String[] args) { Scanner sc = new Scanner(System.in); //Map<Long,Integer>map=new HashMap<>(); int n=5; int a[]=new int[n]; //String s=sc.next(); //int m=sc.nextInt(); //int a=sc.nextInt(); for(int i=0;i<n;i++) { a[i]=sc.nextInt(); } int k=sc.nextInt(); Arrays.sort(a); if(a[4]-a[0]>k)ans=":("; System.out.println(ans); } }
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("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
a = input() b = input() c = input() d = input() e = input() k = input() if max(a,b,c,d,e) - min(a,b,c,d,e) <= k: 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
l = [int(input()) for _ in range(5)] print('Yay!' if max(l) - min(l) <= 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
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!"); 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
A=[int(input()) for _ 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
import java.util.*; class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); ArrayList<Integer> list = new ArrayList<>(); for (int i = 0; i < 5; i++) { list.add(Integer.parseInt(scanner.nextLine())); } int a = list.get(0); int e = list.get(4); int k = Integer.parseInt(scanner.nextLine()); 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 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
#include <iostream> using namespace std; int main(){ int a,b,c,d,e; int k; cin >> a >> b >> c >> d >> e; cin >> 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
l=[int(input()) for _ in range(6)] if l[4]-l[0]<=l[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; 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
a,b,c,d,e,k=[int(input()) for _ in range(6)] 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
raw = raw_input() a = int(raw) raw = raw_input() b = int(raw) raw = raw_input() c = int(raw) raw = raw_input() d = int(raw) raw = raw_input() e = int(raw) raw = raw_input() k = int(raw) if e - a > k: print ':(' else: print 'Yay!'
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
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
#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 << ":("; 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
#abc123a l=[] for i in xrange(6): l.append(int(raw_input())) k=l[-1] if l[4]-l[0]>k: print ':(' else: print 'Yay!'
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<bits/stdc++.h> using namespace std; int main() { int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; (e-a)>k?cout<<":(":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 = [int(input()) for _ in range(6)] print('Yay!'*((e-a)<=k) or ':(')
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; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = 5; int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = Integer.parseInt(sc.next()); } int k = Integer.parseInt(sc.next()); String ans = "Yay!"; if (a[4] - a[0] > k) ans = ":("; System.out.println(ans); } }
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
c = [int(input()) for i in range(6)] print("Yay!" if c[4]-c[0]<=c[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
a,*_,e,k=map(int,open(0).read().split()) print(':(' if k < (e-a) 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 <cmath> 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; 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> #include<algorithm> 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
a,*_,e,k=map(int,open(0));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.*; class Main{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); int[] A=new int[5]; int n=A.length; for(int i=0;i<n;i++){ A[i]=stdIn.nextInt(); } int k = stdIn.nextInt(); String result="Yay!"; for(int m=0;m<n-1;m++){ for(int j=m+1;j<n;j++){ if(A[j]-A[m]>k){ result=":("; break; } } } System.out.println(result); } }
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) { 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>=E-A) { 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,k; cin >> a >> b >> c >> d >> e >> k; string s = "Yay!"; if(e-a>k) s = ":("; cout << s << 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[0]*6] print('Yay!'if A[-2]-A[0]<=A[-1]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 = 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("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,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 <bits/stdc++.h> using namespace std; int main(){ int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; if(abs(a-e)<=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 scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt(); int d = scan.nextInt(); int e = scan.nextInt(); int k = scan.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
#define _GLIBCXX_DEBUG #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
#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!" : ":("); return 0; }
CPP