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
a=[int(input()) for i in range(5)] k=int(input()) print(":(" if max(a)-min(a)>k else "Yay!")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int Na = sc.nextInt(); int Nb = sc.nextInt(); int Nc = sc.nextInt(); int Nd = sc.nextInt(); int Ne = sc.nextInt(); int k = sc.nextInt(); if(Ne-Na<=k)System.out.println("Yay!"); else System.out.println(":("); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int main() { int A, B, C, D, E, K; cin >> A >> B >> C >> D >> E >> K; 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.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int antennaAmounts = 5; int[] antennas = new int[antennaAmounts]; for(int i = 0 ; i < antennaAmounts ; i++) { antennas[i] = sc.nextInt(); } int inputK = sc.nextInt(); sc.close(); if(antennas[antennaAmounts-1] - antennas[0] <= inputK) { 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
lst=[int(input()) for i in range(6)] print('Yay!' if lst[4]-lst[0]<=lst[5] else ':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import sys l = raw_input().split() a = int(l[0]) l = raw_input().split() b = int(l[0]) l = raw_input().split() c = int(l[0]) l = raw_input().split() d = int(l[0]) l = raw_input().split() e = int(l[0]) l = raw_input().split() k = int(l[0]) if b - a > k: print(':(') exit() if c - a > k: print(':(') exit() if d - a > k: print(':(') exit() if e - a > k: print(':(') exit() if c - b > k: print(':(') exit() if d - b > k: print(':(') exit() if e - b > k: print(':(') exit() if d - c > k: print(':(') exit() if e - c > k: print(':(') exit() if d - e > k: print(':(') exit() 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 main(){ int a[5], k; cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> k; if(a[4]-a[0]<=k) cout << "Yay!"; 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[] numlist = new int[5]; int k; for(int i=0;i<5;i++){ numlist[i] = sc.nextInt(); } k = sc.nextInt(); if((numlist[4] - numlist[0])>k){ System.out.println(":("); }else{ System.out.println("Yay!") ; } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a,b,c,d,e=(int(input()) for i in range(5)) k=int(input()) 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<iostream> int main(){int a,b,c,d,e,k;std::cin>>a>>b>>c>>d>>e>>k;puts(e-a>k?":(":"Yay!");}
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main(){ int a,e,k; cin>>a>>e>>e>>e>>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
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
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
a,*_,e,k=(int(input())for _ in[0]*6) 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
import java.util.*; public class Main{ public static void main(String arg[]){ Scanner sc=new Scanner(System.in); int a[]=new int[5]; for(int i=0;i<5;i++) a[i]=sc.nextInt(); int k=sc.nextInt(); int c=0; for(int i=0;i<4;i++){ for(int j=i+1;j<5;j++){ if((a[j]-a[i])>k){ c++; System.out.println(":("); break; } } if(c>0) break; } if(c==0) 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; string ans = ":("; if (e-a <= k) ans = "Yay!"; cout <<ans; cout <<endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
l = [int(input()) for i in range(6)] print("Yay!" if l[4] - l[0] <= l[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
public class Main { private static java.util.Scanner scanner = new java.util.Scanner(System.in); public static void main(String[]$) { int a = scanner.nextInt(); int b = scanner.nextInt(); int c = scanner.nextInt(); int d = scanner.nextInt(); int e = scanner.nextInt(); System.out.println(e - a <= scanner.nextInt() ? "Yay!" : ":("); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a, b, c, d, e, k = [int(input()) for i in range(6)] print("Yay!" if (e - a <= k) else ":(")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main() { int a,b,c,d,e,k; cin >> a >> b >> c >> d >> e >> k; cout << (((e - a) > k) ? ":(" : "Yay!"); return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); sc.nextInt(); sc.nextInt(); sc.nextInt(); int e = sc.nextInt(); int k = sc.nextInt(); sc.close(); 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
[print(":("if e-a>k else"Yay!")for a,_,_,_,e,k in[[int(input())for _ in range(6)]]]
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A[] = new int [5]; for(int i = 0; i<5;i++){ A[i] = sc.nextInt(); } int K = sc.nextInt(); if(K >= (A[4]-A[0]) ){ 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> int main() { int a, b, c, d, e, k; std::cin >> a >> b >> c >> d >> e >> k; if (e - a <= k)std::cout << "Yay!"; else std::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
a, b, c, d, e, k = [int(input()) for i in range(6)] print('Yay!' if k >= e - a else ':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <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 << ":("; 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=(int(input())for _ in[0]*6);print('Y:a(y !'[e-a>k::2])
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn=new Scanner(System.in); int a[]=new int[5]; int z=0,y=0,fin=0; while(z<5){ a[z]=stdIn.nextInt(); z++; }z=0; int k=stdIn.nextInt(); while(z<5){ y=z+1; while(y<5){ if(a[y]-a[z]>k){ fin=1; break; } y++; } z++; } if(fin==1) 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
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int[] ae = new int[5]; for(int i = 0; i < 5; i++){ ae[i] = sc.nextInt(); } int k = sc.nextInt(); if( ae[4] - ae[0] > k ){ System.out.println(":("); } else { System.out.println("Yay!"); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
hs = [int(input()) for i in range(5)] k = int(input()) print(":(" if hs[-1]-hs[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
#include <iostream> using namespace std; int main() { int p[5], k; for(int i=0;i<5;i++) cin >> p[i]; cin >> k; if (p[4]-p[0] > k)cout << ":("; else cout << "Yay!"; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; import java.math.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // 整数の入力 List<Integer> list = new ArrayList<>(); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int k = sc.nextInt(); System.out.println(k>=e-a?"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((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 (k < e - a) 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
x=[int(input()) for _ in range(6)] if x[4]-x[0]>x[-1]: print(":(") else: print("Yay!")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<iostream> 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,b,c,d,e=[int(input())for _ in range(5)] k=int(input()) 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 sys from collections import deque import copy import math def get_read_func(fileobject): if fileobject == None : return raw_input else: return fileobject.readline def main(): if len(sys.argv) > 1: f = open(sys.argv[1]) else: f = None read_func = get_read_func(f); A = [] input_raw = read_func().strip().split() A.append(int(input_raw[0])) input_raw = read_func().strip().split() A.append(int(input_raw[0])) input_raw = read_func().strip().split() A.append(int(input_raw[0])) input_raw = read_func().strip().split() A.append(int(input_raw[0])) input_raw = read_func().strip().split() A.append(int(input_raw[0])) input_raw = read_func().strip().split() k = int(input_raw[0]) if A[len(A) - 1] - A[0] > k: print ":(" return print "Yay!" if __name__ == '__main__': main()
PYTHON
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { @SuppressWarnings("resource") 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
import java.util.Scanner; 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(); System.out.println(e-a>k?":(":"Yay!"); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] d = new int[6]; for(int i = 0; i < d.length; i++) { d[i] = sc.nextInt(); } System.out.println(d[4] - d[0] <= d[5] ? "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<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,d,e,k; cin>>a>>b>>c>>d>>e>>k; (e-a<=k)?cout<<"Yay!":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
s=[int(input()) for _ in range(5)] s.sort() print('Yay!' if s[-1]-s[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
lst=[int(input()) for _ in range(5)] k=int(input()) print(':(' if max(lst)-min(lst)>k else 'Yay!')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[] A = new int[5]; for(int i=0; i<5; i++) A[i] = sc.nextInt(); Arrays.sort(A); System.out.println(A[4]-A[0]<=sc.nextInt()? "Yay!":":("); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); // 整数の入力 int[] a=new int[5]; for(int i=0;i<5;i++){ a[i] = sc.nextInt(); } int k = sc.nextInt(); int flag=0; for(int i=0;i<4;i++){ for(int j=i+1;j<5;j++){ flag+=(a[j]-a[i])>k?1:0; } } // 出力 System.out.println(flag>0?":(":"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[]) { try (Scanner in = new Scanner(System.in)) { int a = in.nextInt(); int b = in.nextInt(); int c = in.nextInt(); int d = in.nextInt(); int e = in.nextInt(); int k = in.nextInt(); System.out.println((e - a) > k ? ":(" : "Yay!"); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#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<<":("<<endl; } else { cout<<"Yay!"; } return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; import java.io.*; public class Main{ public static void main(String[] args){ Scanner s = new Scanner(System.in); int[] arr = new int[5]; for(int i=0; i<5; i++){ arr[i] = s.nextInt(); } int maxd = s.nextInt(); String status ="Yay!"; outerloop: for(int j=0; j<4; j++){ for(int l=j+1; l<5; l++){ if(arr[l]-arr[j] > maxd){ status =":("; break outerloop; } } } System.out.print(status); } }
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
s = [int(input()) for i in range(6)] if abs(s[0]-s[4]) <= s[5]:print('Yay!') else:print(':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int[] a = new int[5]; int i,j; for(i = 0; i < 5; i++) a[i] = scan.nextInt(); int k = scan.nextInt(); for(i = 0; i < 4; i++) { for(j = i + 1; j < 5; j++) { if(Math.abs(a[i] - a[j]) > k) { System.out.println(":("); return; } } } System.out.println("Yay!"); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = Integer.parseInt(sc.next()); sc.next();sc.next();sc.next(); int e = Integer.parseInt(sc.next()); int k = Integer.parseInt(sc.next()); String ans = (e - a > k) ? ":(" : "Yay!"; System.out.println(ans); sc.close(); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; if(e-a>k)cout<<":("; else cout<<"Yay!"; return 0; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d,e; cin>>a>>b>>c>>d>>e; int k; cin>>k; if(e-a<=k){ cout<<"Yay!"<<endl; } else cout<<":("<<endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; using ll=long long; int main(){ vector<long> a(5); ll k; cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k; cout<<(a[4]-a[0]<=k?"Yay!":":(")<<endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main{ public static void main(String []args){ Scanner in = new Scanner(System.in); int number = 5; int max = 0, min = 123; while(number-- > 0){ int k = in.nextInt(); max = Math.max(k, max); min = Math.min(k, min); } int j = in.nextInt(); if(max-min > j) 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
*Pos, K = [int(input()) for _ in range(6)] print('Yay!' if Pos[4] - Pos[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
i=[int(input()) for _ in range(6)] o=':(' if i[4]-i[0]>i[5] else 'Yay!' print(o)
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 scan = new Scanner(System.in); int[] a = new int[5]; for (int i = 0; i < 5; i++) { a[i] = scan.nextInt(); } int k = scan.nextInt(); if (a[4] - a[0] > 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.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Integer a = sc.nextInt(); Integer b = sc.nextInt(); Integer c = sc.nextInt(); Integer d = sc.nextInt(); Integer e = sc.nextInt(); Integer 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
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); int a = sc.nextInt(); sc.nextInt(); sc.nextInt(); sc.nextInt(); int e = sc.nextInt(); int k = sc.nextInt(); System.out.println(e - a > k ? ":(" : "Yay!"); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int[] array = new int[6]; for(int i = 0;i < 6;i++) { array[i] = sc.nextInt(); } int dif = array[4] - array[0]; if(dif <= array[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) { // TODO Auto-generated method stub 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()); if(a[4]-a[0]>k){ System.out.println(":("); }else{ System.out.println("Yay!"); } sc.close(); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int k = sc.nextInt(); String ans = "Yay!"; if(e-a > k) { ans = ":("; } //for(int i = 0; i < n; i++) { //} System.out.println(ans); sc.close(); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include<iostream> using namespace std; int main() { int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; if(e-a>k){ cout<<":("; } else cout<<"Yay!"; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = Integer.parseInt(sc.next()); sc.next(); sc.next(); sc.next(); int e = Integer.parseInt(sc.next()); int k = Integer.parseInt(sc.next()); 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; cout << (e - a > k ? ":(" : "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[] dist =new int[5]; for(int i=0;i<5;i++){ dist[i]=sc.nextInt(); } int limit =sc.nextInt(); if(dist[4]-dist[0] <= limit){ 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
x = [] for i in range(5): x.append(input()) k = input() ans = True for i in range(4): for j in range(i+1, 5): if k < x[j] - x[i]: ans = False if ans: 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
#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; } }
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 = list(int(input()) for _ in range(6)) print("Yay!" if e-a<= 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
#include<iostream> 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!"; 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.*; class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int a[] = new int[5]; for (int i = 0; i < 5; i++){ a[i] = sc.nextInt(); } int k = sc.nextInt(); if (a[4] - a[0] > k) { System.out.println(":("); } else System.out.println("Yay!"); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
a=[int(input()) for x in range(5)] k=int(input()) print('Yay!' if max(a)-min(a)<=k else ':(')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; import java.io.*; import java.math.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); PrintWriter ou = new PrintWriter(System.out); int[] a = new int[5]; for(int i = 0 ; i < 5 ; i++) a[i] = Integer.parseInt(sc.next()); int k = Integer.parseInt(sc.next()); sc.close(); Arrays.sort(a); if(k >= a[4] - a[0]) ou.println("Yay!"); else ou.println(":("); ou.flush(); } }
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> #include<vector> using namespace std; int main(){ int a,b,c,d,e,k; cin>>a>>b>>c>>d>>e>>k; if(e-a<=k){ cout<<"Yay!"<<endl; } else{ cout<<":("<<endl; } }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
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(":("); return; } System.out.println("Yay!"); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <iostream> using namespace std; int a[9]; int main() { for(int i=0; i<6; i++) cin>>a[i]; cout<<(a[4]-a[0]<=a[5] ? "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.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); int d = sc.nextInt(); int e = sc.nextInt(); int k = sc.nextInt(); System.out.println(e-a > k ? ":(" : "Yay!"); } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] array = new int[6]; for (int i = 0; i < 6; i++) { array[i] = sc.nextInt(); } if (array[4] - array[0] > array[5]) { 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
import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub 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(); boolean flag = false; if(e - a > k) { flag = true; } if(flag) { 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
import atexit import io import sys buff = io.BytesIO() sys.stdout = buff @atexit.register def write(): sys.__stdout__.write(buff.getvalue()) l = [] for i in xrange(5): l.append(input()) k = input() ans = 'Yay!' for i in xrange(5): for j in xrange(5): if abs(l[i]-l[j]) > k: ans = ':(' print ans
PYTHON
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; import java.util.stream.IntStream; public class Main { /** アンテナーの数 */ private static final int N = 5; public static void main(String[] args) { try (Scanner scanner = new Scanner(System.in)) { int[] n = IntStream.range(0, 5).map(i -> scanner.nextInt()).sorted().toArray(); int k = scanner.nextInt(); System.out.println((n[N - 1] - n[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
#include <iostream> using namespace std; int main(){ int a, b, k; cin >> a >> b >> b >> b >> b >> k; if (b-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> using namespace std; int a,b,c,d,e,k; int main(){ cin >> a >> b >> c >> d >> e >> k; cout << ((e-a > k)? ":(" : "Yay!") << endl; }
CPP
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
# -*- coding: utf-8 -*- def a(): A = int(raw_input()) B = int(raw_input()) C = int(raw_input()) D = int(raw_input()) E = int(raw_input()) K = int(raw_input()) flag = True if B-A > K: flag = False elif C-A>K: flag = False elif D-A>K: flag = False elif E-A > K: flag = False elif C-B > K: flag =False elif D-B > K: flag = False elif E-B > K: flag =False elif D-C > K: flag = False elif E-C > K: flag = False elif E-D > K: flag = False if flag == True: print "Yay!" else: print ":(" def main(): a() if __name__ == '__main__': main()
PYTHON
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
#include <bits/stdc++.h> using namespace std; int main() { int a[5]; for(int i=0;i<5;i++)cin>>a[i]; sort(a,a+5); int k; cin>>k; puts(k>=a[4]-a[0]?"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
*ant, k = [int(input()) for _ in range(6)] print(':(' if ant[-1] - ant[0] > k else 'Yay!')
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.Scanner; 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("Yay!"); } else { System.out.print(":("); } } }
JAVA
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
x=[int(input()) for i in range(5)] k=int(input()) print("Yay!" if max(x)-min(x)<=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,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=sorted([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
a,b,c,d,e,k=list(int(input()) for _ in range(6)) if e-a > k: print(":(") else: print("Yay!")
PYTHON3
p03075 AtCoder Beginner Contest 123 - Five Antennas
In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively. Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k. Determine if there exists a pair of antennas that cannot communicate directly. Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p. Constraints * a, b, c, d, e and k are integers between 0 and 123 (inclusive). * a < b < c < d < e Input Input is given from Standard Input in the following format: a b c d e k Output Print `:(` if there exists a pair of antennas that cannot communicate directly, and print `Yay!` if there is no such pair. Examples Input 1 2 4 8 9 15 Output Yay! Input 15 18 26 35 36 18 Output :(
6
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int v[] = new int[5]; for (int i = 0; i < 5; i++) v[i] = sc.nextInt(); int k = sc.nextInt(); System.out.println((v[4] - v[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
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,*_,e,k=eval('int(input()),'*6);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 <iostream> using namespace std; int main(){ int a[5],k; for(int i=0;i<5;i++){ cin>>a[i]; } cin>>k; if(a[4]-a[0]<=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 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 && e-a>0){ System.out.println("Yay!"); }else{ System.out.println(":("); } } }
JAVA