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 |
|---|---|---|---|---|---|
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | def is_lucky(a):
"""
Check if a given number (a) is lucky.
@input: an integer a (1<=a<=10^18)
@output: True - if a is lucky
False - if a is not lucky
"""
if a==0:
ok=False
else:
ok=True
# We assume that a is lucky
while (a>0 and ok==True)... | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input("")
a=len(n)
c=0
n=int(n)
while(n!=0):
d=n%10
if d==4 or d==7:
c+=1
n=n//10
if c==7 or c==4:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | num = input()
count = 0
for digit in num:
if digit == '4' or digit == '7': count += 1
num = str(count)
ans = True
for digit in num:
if digit != '4' and digit != '7': ans = False
if ans: print("YES")
else: print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | x=input()
s=x.count('4')
r=x.count('7')
if (s+r)==4 or (s+r)==7:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input();
co_4=n.count('4');
co_7=n.count('7');
to=co_4+co_7;
if(to==7 or to==4):
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 |
import java.util.Scanner;
public class NearlyLuckyNumber {
static String check(String s){
for (int i = 0; i < s.length(); i++) {
if(s.charAt(i)!='7'&&s.charAt(i)!='4')
return "NO";
}
return "YES";
}
public static void main(String[] args) {
Scanner... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a = (input())
f = 0
c = 0
for char in a:
if char == "4" or char == "7":
c += 1
continue
if c == 4 or c == 7:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
count_4 = n.count("4")
count_7 = n.count("7")
if "4" in n or "7" in n:
if count_4 + count_7 == 4 or count_4 + count_7 == 7:
print("YES")
else:
print("NO")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | l=list(input())
if(l.count('4')+l.count('7')==4 or l.count('4')+l.count('7')==7):
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | number = input()
n = 0
number = str(number)
for i in range(len(number)):
if (number[i] == "4" or number[i] == "7"):
n += 1
if (n == 4 or n == 7):
print "YES"
else:
print "NO" | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
string n;
cin >> n;
int count = 0;
int len = n.size();
for (int i = 0; i < len; i++) {
if (n[i] == '7' || n[i] == '4') {
count++;
}
}
if (count == 4 || count == 7)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
| CPP |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
sum=0
for i in n:
if i=="4" or i=="7":
sum+=1
if sum==4 or sum==7 or sum==47:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=list(map(int, input()))
total=0
for i in n:
if i==7 or i==4:
total+=1
total=[int(x) for x in str(total)]
total2=0
for i in total:
if i==7 or i==4:
total2+=1
if total2==len(total):
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | number = str(input())
counter = 0
for i in number:
if(i == "4" or i == "7"):
counter += 1
for i in str(counter):
if(i != "4" and i != "7"):
print("NO")
quit()
print("YES") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 22 17:15:42 2020
@author: DELL
"""
n=input()
c=n.count('4')
c1=n.count('7')
if c+c1 ==4 or c+c1==7:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | # cook your dish here
n= input()
b = list(n)
a =["4","7"]
cnt =0
for i in b:
if i in a:
cnt +=1
if (cnt==4)or (cnt==7):
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | number = str(int(input()))
c4 = number.count("4")
c7 = number.count("7")
if c4 + c7 == 4:
print("YES")
elif c4 + c7 == 7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
count = 0
for c in n:
if c == '4' or c == '7':
count += 1
if count == 4 or count == 7:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | number=int(input())
number=str(number)
fours=number.count('4')
sevens=number.count('7')
if fours+sevens==4 or fours+sevens==7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=int(input())
count=0
while(n):
if n%10==7 or n%10==4:
count+=1
n=n//10
if count==7 or count==4:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a = list(raw_input())
t = 0
for i in a:
if i=='7' or i=='4':
t += 1
t = list(str(t))
if all([ x=='4' or x == '7' for x in t]):
print 'YES'
else:
print 'NO' | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import java.util.*;
public class P1 {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
long n = sc.nextLong();
int t=0;
long digit;
while(n>0) {
digit=n%10;
n/=10;
if(digit==7||digit==4) {
t++;
}
}
if(t==7||t==4||t==47||t==74) {
System... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
k = 0
for i in range(len(n)):
if n[i] == '4' or n[i] == '7':
k += 1
k = str(k)
for i in range(len(k)):
if k[i] != '4' and k[i] != '7':
print('NO')
break
else:
print('YES') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
ArrayList<String> al = new ArrayList<String>(Arrays.asList(input.next().split("(?!^)")));
int four... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #include <bits/stdc++.h>
int main() {
int i, len, count = 0;
char s[20];
scanf("%s", s);
len = strlen(s);
for (i = 0; i < len; i++) {
if (s[i] == '4' || s[i] == '7') {
count++;
}
}
if (count == 4 || count == 7) {
printf("YES\n");
} else {
printf("NO\n");
}
}
| CPP |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | luckyNumbers = [4,7]
def isNearlyLuckyNumber(number: int) -> bool:
return all(list(map(lambda x: int(x) in luckyNumbers, list(str(sum(list(map(lambda x: x in luckyNumbers ,list(map(lambda x: int(x), list(str(number))))))))))))
val = input()
print("YES" if isNearlyLuckyNumber(int(val)) else "NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #110A-Nearly Lucky Number
str1=input()
n=str(str1.count('4')+str1.count('7'))
if len(n) == (n.count('4')+n.count('7')):
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | k = list(map(int,list(input())))
s = set([4,7])
n = 0
for i in k:
if i in s:
n += 1
l = True
for i in list(str(n)):
if int(i) not in s:l = False
if l:print('YES')
else:print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = list(input())
d = {'4':0,'7':0}
for i in n:
if i in d.keys():
d[i] += 1
if(sum(d.values()) == 4 or sum(d.values()) == 7):
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | nums = list(input())
if nums.count("7") + nums.count("4") == 4 or nums.count("7") + nums.count("4") == 7:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
lst = [int(x) for x in n]
count = 0
for i in lst:
if i == 4 or i == 7:
count+=1
if count==7 or count==4:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import java.util.*;
public class nearlyLuckyNumber
{
public static void main(String[] args)
{
Scanner reader = new Scanner(System.in);
String n = reader.nextLine(); //input
int output = 0;
for(int i = 0; i < n.length(); i++)
{
String sub = n.substring(i,i+1);
if(sub.equals("4") || ... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import sys
import math
n = input()
number = 0
for i in range(len(n)):
if int(n[i]) == 4 or int(n[i]) == 7:
number += 1
if number == 4 or number == 7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | k=input()
l=int(k)
o=0
p=k.count("4")+k.count("7")
if str(p).count("4")+str(p).count("7")==len(str(p)):
print("YES")
o=1
if o==0:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | number = int(input())
n = []
while number!=0:
rem = number % 10
n.append(rem)
number = number // 10
seven = n.count(7)
four = n.count(4)
res = seven + four
if res == 4 or res == 7:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
c=n.count('4') + n.count('7')
c=str(c)
if (c.count('4') + c.count('7')) == len(c):
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.PriorityQueue;
import j... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s=raw_input()
t=["7","4"]
print ["NO","YES"][len(filter(lambda r: sum(map(lambda f: s.count(f),t))==int(r),t))>0] | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input ()
r=[]
for i in n:
if (i=='7' or i=='4'):
r.append (i)
if (len (r)==4 or len (r)==7):
print ("YES")
else:
print ("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
n4 = n.count("4")
n7 = n.count("7")
ssum = str(n4 + n7)
ssum4 = ssum.count("4")
ssum7 = ssum.count("7")
total = ssum4 +ssum7
if total == len(ssum):
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = int(input())
a=str(n)
s = int(a.count('7'))
t = int(a.count('4'))
if(s+t==7 or s+t==4):
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=int(input())
ans=0
while True:
if n==0:
break
if n%10==4 or n%10==7:
ans+=1
n=n//10
if ans==4 or ans==7:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=raw_input()
counter=0
flag=True
for number in n:
if number=='4' or number=='7':
counter+=1
out=str(counter)
for i in out:
if i!='4' and i!='7':
flag=False
break
if flag==True:
print 'YES'
elif flag==False:
print 'NO' | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #%%
n = map(int, list(input()))
luck = 0
for i in n:
if i == 4 or i == 7:
luck += 1
if luck == 4 or luck == 7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | num = list(input())
four = 0
seven = 0
for i in num:
if i=='4':
four+=1
elif i=='7':
seven+=1
if four+seven == 4 or four+seven == 7:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | x = int(input())
d = 0
for i in range(0, len(str(x))):
if int(str(x)[i]) == 4 or int(str(x)[i]) == 7:
d += 1
if d == 4 or d == 7:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
t=0
for i in range(len(n)):
if n[i] == "4" or n[i] == "7":
t+=1
t=str(t)
z=0
for j in range(len(t)):
if t[j] == "4" or t[j] == "7":
z+=1
if z==len(t):
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
a = n.count('4') + n.count('7')
a = str(a)
if set(a) | {'4','7'} == {'4','7'}:
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | t=input()
n=t.count('4')+t.count('7')
print(['NO','YES'][all(j in '47'for j in str(n))])
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | def lucky(n):
if(n == 0):
return False
while(n>0):
if(n%10 == 4 or n%10 == 7):
n = n//10
else:
return False
return True
x = raw_input()
count = 0
for i in x:
if(i == "4" or i == "7"):
count += 1
if(lucky(count)):
print "YES"
else:
print "NO"
| PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1E9 + 7;
const int N = 1E5;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s;
cin >> s;
int lucky = 0;
for (auto c : s) {
if (c == '4' || c == '7') lucky++;
}
if (lucky == 0)
cout << "NO\n";
else {
... | CPP |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
c=0
for i in n:
if i=="4" or i=="7":
c+=1
c=str(c)
d=0
for i in range(len(c)):
if c[i] != "4" and c[i] != "7":
d+=1
if d==0:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
sum1 = 0
flag = 0
while(n!=0):
d = n%10
if((d==4)or(d==7)):
sum1+=1
n/=10
a = list(str(sum1))
for i in a:
if((i!='4')and(i!='7')):
flag = 1
break
if(flag==1):
print "NO"
else:
print "YES"
| PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
string n;
cin >> n;
int cnt = 0;
int s = n.size();
for (int i = 0; i < s; i++) {
if (n[i] == '4' || n[i] == '7') ++cnt;
}
if (cnt == 4 || cnt == 7)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
| CPP |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import sys
n = sys.stdin.readline().strip()
counter = 0
i = 0
while i < len(n):
if n[i] == '4' or n[i] == '7':
counter += 1
i += 1
else:
i += 1
if counter == 4 or counter == 7:
print 'YES'
else:
print 'NO' | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n =int(input())
count=0
while n>0:
if n%10 in [7,4]:
count+=1
n//=10
if count>7:
count+=1
break
if count in [7,4]:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | user_number = input()
luckyNum = 0
for j in user_number:
if j in '47':
luckyNum += 1
else:
continue
if luckyNum == 4 or luckyNum == 7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a=input()
count=0
for letter in a:
if letter =='4' or letter=='7':
count+=1
if count==4 or count == 7:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
k = 0
for i in n:
if i in "47":
k += 1
flag = True
for i in str(k):
if i not in "47":
flag = False
print("YES" if flag else "NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = raw_input()
s = str(n.count('4') + n.count('7'))
if s.count('4') + s.count('7') == len(s):
print "YES"
else:
print "NO" | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=int(input())
m=str(n)
a=m.count('4')+m.count('7')
if a==4 or a==7:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | def luckynum(x):
if x.count('4')+x.count('7') == len(x):
return 1
else:
return 0
num = input()
s = num.count('4')+num.count('7')
if luckynum(str(s)) == 1:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | br, br2, sol = 0, 0, 0
rez = True
num = input()
for i in range(len(num)):
if num[i]=='4' or num[i]=='7':
br+=1
if br==0:
rez = False
while br>0:
if br%10 != 4 and br%10 != 7:
rez = False
br = int(br/10)
if rez:
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | if __name__ == '__main__':
s = raw_input()
n = s.count('4') + s.count('7')
ss = str(n)
if ss.count('4') + ss.count('7') == len(ss):
print('YES')
else:
print('NO')
| PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | num = input()
count=0
for i in range(len(num)):
if num[i] == '4' or num[i]== '7':
count = count +1
count_s=str(count)
cond=True
for j in range(len(count_s)):
if not(count_s[j] == '4' or count_s[j] == '7'):
cond=False
if cond == True:
print('YES')
else :
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | def nearlyLucky() :
n=int(input())
z=n
flag=0
while ( z != 0) :
r= z % 10
z=z//10
if ( r == 4 or r == 7) :
flag =flag + 1
if (flag == 4 or flag == 7) :
print ("YES")
else :
print ("NO")
nearlyLucky()
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=list(input())
count=0
for i in range(len(n)):
if (n[i]=="4" or n[i]=="7"):
count+=1
if count==4 or count==7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a=input()
i=0
if a.count('7')+a.count('4')==7 or a.count('7')+a.count('4')==4:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | from itertools import product
n = input()
c = n.count('4') + n.count('7')
if c == 4 or c == 7:
print('YES')
exit()
for comb in product(['7', '4'], repeat= c):
if str(c) == comb:
print('YES')
exit()
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
a=str(n.count("4")+n.count("7"))
print("YNEOS"[a.count("4")+a.count("7")!=len(a)::2]) | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=int(input())
s=str(n)
lno=s.count('4')
lno+=s.count('7')
if lno==4 or lno==7:print("YES")
else:print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
s = ['4','7']
f = 1
count = 0
for i in range(len(n)):
if n[i] in s:
count +=1
for i in range(len(str(count))):
if str(count)[i] not in s:
f = 0
print("NO")
break
if f == 1:
print("YES")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a = input()
ans = "NO"
b = a.count('4') + a.count('7')
b = str(b)
if b.count('4') + b.count('7') == len(b):
ans = "YES"
print(ans) | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s = raw_input()
n = s.count('4') + s.count('7')
s = str(n)
b = s.count('4') + s.count('7') == len(s)
print 'YES' if b else 'NO'
| PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
count = 0
for element in n:
if element == '4' or element == '7':
count += 1
if count == 4 or count == 7:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | class algoritmo:
counter = 0
def __init__(self, n):
self.n = list(n)
def solver(self):
for i in range(0, len(self.n), 1):
if self.n[i]=="4" or self.n[i]=="7":
algoritmo.counter += 1
else:
pass
if algoritmo.counter==4 or algoritmo.counter==7:
print("YES")
else:
print("NO")
x = algoritmo... | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
count = 0
for i in range(len(n)):
if n[i] == "4" or n[i] == "7":
count += 1
x = str(count)
for i in range(len(x)):
if not (x[i] == "4" or x[i] == "7"):
print("NO")
break
else:
print("YES")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | def solve():
n=int(input())
nl = 0
while(n>0):
r = n%10
if (r == 4) or (r==7):
nl = nl+1
n = n//10
if nl and (nl==7 or nl==4):
return "YES"
else:
return "NO"
print(solve())
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | val = input()
valStr = str(val)
luckCount = 0
for i in range(len(valStr)):
if(int(valStr[i]) == 4 or int(valStr[i])==7):
luckCount+=1
if(luckCount==4 or luckCount == 7):
print("YES")
else:
print("NO") | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a=sum([1 for i in raw_input() if i=='4' or i=='7'])
print'YNEOS'[a!=4 and a!=7::2]
| PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
int count = 0;
while (n != 0) {
if (n % 10 == 4 || n % 10 == 7) {
count += 1;
}
n /= 10;
}
if (count == 4 || count == 7) {
cout << "YES";
} else {
cout << "NO";
}
return 0;
}
| CPP |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | luckyNumbers = [4,7,47,74]
num = list(input())
lucky = False
for i in range(len(luckyNumbers)):
if luckyNumbers[i] == num.count("4") + num.count("7"):
lucky = True
break
if lucky:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | t = input()
count = 0
for i in range(len(t)):
if t[i] in ["4", "7"]:
count+=1
count = str(count)
flag = 1
for i in range(len(count)):
if count[i] in ["4", "7"]:
flag = 1
else:
flag = 0
break
if flag == 0:
print("NO")
else:
print("YES")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s=input()
n = s.count('4') + s.count('7')
print(['NO','YES'][n== 4 or n== 7]) | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a = input()
ans = 0
for x in a:
if x == "4" or x == "7":
ans += 1
if ans == 4 or ans == 7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s = raw_input()
cnt = 0
for ch in s:
if ch == '4' or ch == '7':
cnt += 1
isLucky = True
entered = False
cnt = int(cnt)
while cnt > 0:
entered = True
d = cnt % 10
if d != 7 and d != 4:
isLucky = False
break
cnt /= 10
print "YES" if isLucky and entered else "NO" | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #-------------------------------------------------------------------------------
# Name: module3
# Purpose:
#
# Author: lihua
#
# Created: 26/08/2017
# Copyright: (c) lihua 2017
# Licence: <your licence>
#-------------------------------------------------------------------------------
n=int(raw_inp... | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | i=int(input())
i=str(i)
count=0
for x in i:
if x is '4' or x is '7':
count+=1
if count==4 or count==7:
print('YES')
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | num=input()
count=num.count("7") + num.count("4")
#if set(num) == set(["4","7"]):
#print("YES")
if count == 7 or count == 4:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | number = raw_input()
fours = number.count('4')
sevens = number.count('7')
if set('47').issuperset(set(str(fours + sevens))):
print "YES"
else:
print "NO" | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = int(input())
c = 0
while n>0:
x = n%10
if x==4 or x==7:
c+=1
n = n//10
if c==4 or c==7:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s = input()
k = str(s.count('4')+s.count('7'))
f = k.count('4')+k.count('7')
if f == len(k):
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s=input()
lucky=s.count('4')+s.count('7')
if lucky==4 or lucky==7:
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
@SuppressWarnings("unused")
public class TaskA {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
String... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s = input().strip()
lst = []
for i in range(len(s)):
lst.append(int(s[i]))
res = lst.count(4) + lst.count(7)
if (res == 7 or res == 4) and res!=0:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | num = list(map(int, input()))
count = 0
for i in range(len(num)):
if num[i] == 4 or num[i] == 7:
count+=1
if count == 4 or count == 7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | k=list(input())
count=0
for i in k:
if i==str(4) or i==str(7):
count+=1
if count in [4,7]:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import java.util.Scanner;
public class MainClass
{
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
long num=in.nextLong();
long x,count=0;
while(num>0)
{
x=num%10;
if(x==4||x==7)
{
count++;
... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | nn=int(input())
arr=list(map(int,list(str(nn))))
print("YES" if arr.count(7)+arr.count(4)==7 or arr.count(7)+arr.count(4)==4 else "NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input();
num_lucky_digits=0;
for i in range(len(n)):
if n[i]=="4" or n[i]=="7":
num_lucky_digits=num_lucky_digits+1;
if num_lucky_digits==4 or num_lucky_digits==7:
print("YES");
else:
print("NO");
| PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.