首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏饶文津的专栏

    【USACO 2.1】Ordered Fractions

    TASK: 直接枚举,约分,排序,去重 #include<cstdio> #include<algorithm> using namespace std; struct node{ int

    32120发布于 2020-06-02
  • 来自专栏架构驿站

    Dynamic GPU Fractions(动态 GPU 分配),知多少?

    为了解决这一瓶颈,动态 GPU 分配(Dynamic GPU Fractions) 技术便应运而生。 —01 —如何理解动态 GPU 分配(Dynamic GPU Fractions)? 为了有效解决这一难题,业界推出了两项突破性的功能:动态 GPU 分配(Dynamic GPU Fractions) 和 节点级调度器(Node Level Scheduler),旨在从根本上优化 GPU —02 —动态 GPU 分配(Dynamic GPU Fractions)特性解析 通常而言,动态 GPU 分配技术为用户带来了多方面的显著优势,不仅在资源管理上表现优异,同时也极大地提升了 —03 —动态 GPU 分配(Dynamic GPU Fractions)技术的一点见解 动态 GPU 分配(Dynamic GPU Fractions)技术正处于快速发展阶段,其未来发展趋势主要集中在以下几个方面 4、动态 GPU 分配技术的生态化 动态 GPU 分配(Dynamic GPU Fractions)技术的生态化建设是其走向成熟和广泛应用的关键。

    94210编辑于 2025-01-08
  • 来自专栏饶文津的专栏

    【USACO 2.4】Fractions to Decimals(分数转小数)

    题意:给你N/D的分数,让你输出等价的小数,如果是循环小数,用括号把循环节包起来。如果是整数,后面保留一位小数。每行最多输出76个字符。

    47620发布于 2020-06-02
  • 来自专栏XINDOO的专栏

    poj 1131 Octal Fractions(高精度小数进制转换) Java

    虽然题目那么长其实就是把8进制的浮点数转换成10进制,为了练习Java Biginteger 类 我这里用的是Java,也可以用数组模拟。

    75220发布于 2021-01-21
  • 来自专栏CSDN旧文

    CF思维联系–CodeForces - 222 C Reducing Fractions(数学+有技巧的枚举)

    ACM思维题训练集合 To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. However, it turned out that the programs that work with fractions in this representations aren’t complete , they lack supporting the operation of reducing fractions.

    54810发布于 2020-11-03
  • 来自专栏懒人开发

    (7.4)James Stewart Calculus 5th Edition:Integration of Rational Functions by Partial Fractions

    ---- Integration of Rational Functions by Partial Fractions 分式的有理数积分 之前,看见分式 就会想到,需要先合并 ?

    68620发布于 2019-02-25
  • 来自专栏CSDN旧文

    P1458 顺序的分数 Ordered Fractions(有技巧的枚举)+C++类封装=精简代码

    题目描述 输入一个自然数N,对于一个最简分数a/b(分子和分母互质的分数),满足1<=b<=N,0<=a/b<=1,请找出所有满足条件的分数。

    74120发布于 2020-10-28
  • 来自专栏流川疯编写程序的艺术

    spark 数据处理 -- 数据采样【随机抽样、分层抽样、权重抽样】

    # {2147481832: 0.8, 214748183: 0.8} sampled_df = df.stat.sampleBy("x1", fractions, seed) sampled_df.show highlight=sample#pyspark.sql.DataFrame.sample scala 版本 sampleBy def sampleBy[T](col: String, fractions T stratum type col column that defines strata fractions sampling fraction for each stratum. = Map(1 -> 1.0, 3 -> 0.5) df.stat.sampleBy("key", fractions, 36L).show() +---+-----+ |key|value| +-- , dict): raise ValueError("fractions must be a dict but got %r" % type(fractions))

    7.5K10编辑于 2021-12-08
  • 来自专栏老齐教室

    《Python完全自学教程》免费在线连载3.3.2

    这就是标准库中的 fractions 模块所要解决的问题。 >>> import fractions # (4) >>> a = fractions.Fraction(60, 180) # (5) >>> a Fraction (1, 3) 注释(4)引入模块 fractions ,注释(5)使用 fractions.Fraction() 创建分数——注意大小写,其参数中的第一个 60 是分数的分子,第二个 180 是分数的分母 >>> alpha = fractions.Fraction('60/180') * math.pi # (6) >>> fractions.Fraction(math.cos(alpha >>> fractions.Fraction(0.5) Fraction(1, 2) 如注释(3)所示,math.cos(alpha)的值是一个浮点数,再以它为参数,创建分数: >>> fractions.Fraction

    1.6K20编辑于 2022-04-01
  • 来自专栏python3

    Python数值类型

    >>> import fractions >>> fractions.Fraction(1,3) Fraction(1, 3) 还可以根据浮点数的字符串格式构建分数。 >>> fractions.Fraction('0.3') Fraction(3, 10) 然后可以用分数进行运算。 分数加整数: >>> fractions.Fraction(1,3) + 1 Fraction(4, 3) 分数加、减、乘、除分数: >>> fractions.Fraction(1,3) + fractions.Fraction (2,3) Fraction(1, 1) >>> fractions.Fraction(1,3) - fractions.Fraction(2,3) Fraction(-1, 3) >>> fractions.Fraction (1,3) * fractions.Fraction(2,3) Fraction(2, 9) >>> fractions.Fraction(1,3) / fractions.Fraction(2,3)

    2.8K30发布于 2020-01-21
  • 来自专栏龙进的专栏

    numpy矩阵转置

    numpy矩阵转置只需要这样子: import numpy as np import fractions # 设置以分数形式显示 np.set_printoptions(formatter={'all ': lambda x: str(fractions.Fraction(x).limit_denominator())}) # 定义矩阵 c = np.array([[-1/np.sqrt(2), 0,

    1.4K10编辑于 2022-10-31
  • 来自专栏sktj

    python 标准库 数学计算

    50.57'),结果四舍五入保留了两位小数 3、转为str from decimal import * str(Decimal('3.40').quantize(Decimal('0.0'))) 4、fractions from fractions import Fraction print(Fraction(3.5)) print(Fraction(5/6)) print(Fraction(5,6)) print (Fraction('5/6')) 5、fractions.Fraction.from_decimal(v) 6、random.randrange() random.randrange(10) 从0

    89030编辑于 2022-01-10
  • 来自专栏Python小屋

    详解Python中的各种数字类型

    >>> 1_000_000 1000000 >>> 1_2_3_4 1234 >>> 1_2 + 3_4j (12+34j) >>> 1_2.3_45 12.345 (2)分数 Python标准库fractions >>> from fractions import Fraction >>> x = Fraction(3, 5) #创建分数对象 >>> y = Fraction(3, 7) >>> x Fraction , 35) >>> x * 2 #分数与数字之间的运算 Fraction(6, 5) >>> Fraction(3.5) #把实数转换为分数 Fraction(7, 2) (3)高精度实数 标准库fractions >>> from fractions import Decimal >>> 1 / 9 #内置的实数类型 0.1111111111111111 >>> Decimal(1/9) #高精度实数 Decimal

    1.5K40发布于 2018-04-16
  • 来自专栏深度学习

    【python】Fraction类详解及生成分数四则运算“试卷”

    一、前言 实验所需的库 from fractions import Fraction import random from PIL import Image, ImageDraw, ImageFont 标准库中的 random 模块包含用于生成随机数的函数 fractions 模块包含用于处理分数的 Fraction 类 终端指令 conda create -n DL python==3.11 conda import Decimal Fraction(Decimal('1.1')) 输出: Fraction(11, 10) 二、实现过程 Version 1 四则运算 import random from fractions 例如: Version 2 试题list from fractions import Fraction import random from PIL import Image, ImageDraw, ImageFont Version 3 可视化 from fractions import Fraction import random from PIL import Image, ImageDraw, ImageFont

    44810编辑于 2024-07-30
  • 来自专栏龙进的专栏

    使用numpy对矩阵进行求逆

    import numpy as np import fractions a = np.array([[1, 1, 1], [0, 0.5, -2], [0, 1, 1]]) #设置以分数形式显示 np.set_printoptions (formatter={'all': lambda x: str(fractions.Fraction(x).limit_denominator())}) print('原矩阵:\n') print(a

    1.2K10编辑于 2022-10-31
  • 来自专栏GEE数据专栏,GEE学习专栏,GEE错误集等专栏

    Google Earth Engine(GEE)——将城区、森林区和水域实现光谱分离!

    veg = [50, 21, 20, 35, 50, 110, 23]; var water = [51, 20, 14, 9, 7, 116, 4]; // 取消混合,这样就进行了分解 var fractions = image.unmix([urban, veg, water]); Map.addLayer(fractions, {}, 'unmixed');

    25010编辑于 2024-02-01
  • 来自专栏饶文津的专栏

    「c++小学期」实验题目及代码

    (int n=0,int d=0):num(n),den(d){} Fractions(Fractions &b):num(b.num),den(b.den){} ~Fractions( ){} Fractions operator +(Fractions &b){ Fractions t(num+b.num,den+b.den); return t; } Fractions operator -(Fractions &b){ Fractions t(num-b.num,den-b.den); return t; } Fractions operator *(Fractions &b){ Fractions t(num*b.num,den*b.den); return t; } Fractions operator /(Fractions &b){ Fractions a(num*b.den,den*b.num); return

    1.5K40发布于 2020-06-02
  • 来自专栏技术汇

    拿python当作计算器

    你可以用 fractions 模块或者 decimal 模块来处理分数和小数,比如 fractions.Fraction(1, 3) 或者 decimal.Decimal( math.cos(math.pi library/cmath.html https://docs.python.org/3/library/decimal.html https://docs.python.org/3/library/fractions.html

    49010编辑于 2024-05-09
  • 来自专栏未闻Code

    一日一技:在Python里面做分数的运算

    显然,你不能直接 1/10+2/10,而是需要使用Python的 fractions模块。 它的使用方法为: from fractions import Fraction a = Fraction(1, 10) b = Fraction(2, 10) c = a + b print(c) 运行效果如下图所示

    1.7K30发布于 2019-07-30
  • 来自专栏python3

    python第二周 数字类型

    3.1415926,2) 3.14 int() 将一个浮点数转变为整数 hex() 将一个数转变为十六进制数 bin() 将一个数转变为二进制数 内置数学模块math、random、decimal、fractions 模块用来产生随机数,常见用法如下: random.random() random.randint(n,m)  #产生一个n-m之间的随机数 random.choice(list)  #从列表中随机选择一个列表元素 fractions 模块用来处理分数 from  fractions import Fraction x = Fraction(1,3) #创建一个分数对象,分子为1,分母为3 y = Fraction(4,6) x +

    97110发布于 2020-01-15
领券