rihit0/mcko
收藏Hugging Face2024-05-15 更新2024-06-12 收录
下载链接:
https://hf-mirror.com/datasets/rihit0/mcko
下载链接
链接失效反馈官方服务:
资源简介:
'''
#1
#1111.1111_2 + 23.32_4
print(15.9375 + 11.875)
#27.8125 -> 1B.D
#4
mx = []
for n in range(1, 1000):
z = n
s = ''
while z > 0:
s = str(z % 2) + s
z //= 2
if n % 2 == 0:
s += str(z.count('1') % 2)
print(s)
s = (str(bin(sum((list(map(int, str(n).split())))))))[2:] + s
else:
s += '0'
s += (str(bin(sum((list(map(int, str(n).split())))))))[2:]
r = int(s, 2)
if r >= 200:
break
else:
print(n, r)
#5
def binaryOfFraction(fraction):
binary = str()
while (fraction):
fraction *= 2
if (fraction >= 1):
int_part = 1
fraction -= 1
else:
int_part = 0
binary += str(int_part)
return binary
def floatingPoint(real_no):
sign_bit = 0
if(real_no < 0):
sign_bit = 1
real_no = abs(real_no)
int_str = bin(int(real_no))[2 : ]
fraction_str = binaryOfFraction(real_no - int(real_no))
ind = int_str.index('1')
exp_str = bin((len(int_str) - ind - 1) + 127)[2 : ]
mant_str = int_str[ind + 1 : ] + fraction_str
mant_str = mant_str + ('0' * (23 - len(mant_str)))
return sign_bit, exp_str, mant_str
sign_bit, exp_str, mant_str = floatingPoint(14.59375)
ieee_32 = str(sign_bit) + exp_str + mant_str
print(ieee_32)
ieee_32 = int(ieee_32, 2)
ieee_32 = hex(ieee_32)
print(ieee_32)
#6
x = 640
y = 192
m = 150 * 1024 * 8
proz = 2
color = (m/(x * y)) - proz
print(2 ** color)
#7
workers = 3000 - 150
for a in range(10000):
if 800 + 730 + 900 - 90 - 70 - 120 + 2*a == workers:
print(a)
#a = 140
#8
p = 157
q = 733
e = 17
def f(p, q):
return (p - 1) * (q - 1)
for d in range(10 ** 5):
if (d*e) % f(p, q) == 1:
print(d)
#10
print((59 << 1) & (~14 | (133 >> 2)))
#11
def fn(x, y):
if x == y:
return 1
if x < y:
return fn(x+2, y) + fn(x+3, y) + fn(x+5, y)
else:
return 0
print(fn(20, 35)) #если проходит через какое-то число, разделить на две функции
#12
count = 0
for s in range(2, 10000, 2):
n = 120
while s > 0:
s = s // 6
n = n - 6
if n == 108:
count += 1
print(count)
#13
f = open('11.txt')
s = [int(x) for x in f]
count = 0
sums = []
for i in range(1, len(s) - 1):
if s[i] % 8 == 0 and s[i + 1] % 8 == 0:
count += 1
sums.append(s[i] + s[i + 1])
print(count)
print(min(sums))'''
提供机构:
rihit0
原始信息汇总
数据集概述
数据集内容
本数据集包含一系列编程代码片段,涉及以下几个方面:
- 计算两个数的和并转换为十六进制。
- 生成一系列二进制字符串,并计算其对应的十进制值。
- 定义函数
binaryOfFraction和floatingPoint,用于处理浮点数的二进制表示。 - 计算图像处理中的颜色深度。
- 解决一个关于工人数量的问题。
- 实现RSA加密算法中的模数计算。
- 进行位运算操作。
- 定义递归函数
fn,用于计算特定条件下的返回值。 - 统计特定条件下的循环次数。
- 读取文件数据,并统计满足特定条件的元素对数量及其和的最小值。
数据集用途
本数据集适用于编程学习和算法测试,特别是对二进制运算、算法实现和数据处理感兴趣的用户。
数据集特点
- 包含多种编程问题和解决方案。
- 涉及算法和数据处理的实际应用。
- 适合用于教学和自学编程。



