2016 Personal Training #5 Div.2 Gym 100637J

本文探讨了在超级阶乘数制中表示任意有理数的方法,并提供了具体的算法实现细节,包括输入输出格式及示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

C - 
Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

Description

standard input/output 
Statements

On the most perfect of all planets i1c5l various numeral systems are being used during programming contests. In the second division they use a superfactorial numeral system. In this system any positive integer is presented as a linear combination of numbers converse to factorials:

Here a1 is non-negative integer, and integers ak for k ≥ 2 satisfy 0 ≤ ak < k. The nonsignificant zeros in the tail of the superfactorial number designation  are rejected. The task is to find out how the rational number  is presented in the superfactorial numeral system.

Input

Single line contains two space-separated integers p and q (1 ≤ p ≤ 1061 ≤ q ≤ 106).

Output

Single line should contain a sequence of space-separated integers a1, a2, ..., an, forming a number designation  in the superfactorial numeral system. If several solution exist, output any of them.

Sample Input

Input
1 2
Output
0 1 
Input
2 10
Output
0 0 1 0 4 
Input
10 2
Output
5 
唉,弄半天真是贪心,当时错两边就没再仔细看,倒是卡在数据类型半天。

题意:给你p,q输出满足公式的ai,

思路:从a1开始,a2=p*2!/q,...;直到p为零结束。有个小疑问0<=ak<k这个条件好像没什么用?难道其中有什么...。

代码如下:

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define INF 0x3f3f3f3f
int main()
{
  LL p,q;
  scanf("%lld%lld",&p,&q);
  for(int i=2;;i++)
  {
    int ans=p/q;
    if(ans>=i&&i!=2)
    {
      ans=i-1;
    }
    p=(p-ans*q)*i;
    printf("%d",ans);
    if(p==0)
    {
      printf("\n");break;
    }
    printf(" ");
  }
}











### 安装和运行 Isaac Gym 的方法 在 Ubuntu 22.04 上安装和运行 Isaac Gym 需要特别注意兼容性问题,因为官方推荐的基础环境是 Ubuntu 18.04 或 20.04。以下是详细的安装和配置方法: #### 1. 环境准备 确保系统已更新至最新状态: ```bash sudo apt update && sudo apt upgrade -y ``` 安装必要的依赖项: ```bash sudo apt install -y build-essential cmake git wget unzip libgl1-mesa-glx libxi6 libxrandr2 ``` #### 2. 创建 Anaconda 虚拟环境 使用 Anaconda 创建一个 Python 3.8 的虚拟环境,以确保与 Isaac Gym 的兼容性: ```bash conda create -n isaac_env python=3.8 conda activate isaac_env ``` #### 3. 下载 Isaac Gym 从 NVIDIA 官方网站下载 Isaac Gym 的安装包,并解压到目标目录。例如: ```bash wget https://developer.nvidia.com/isaac-gym-download unzip isaac-gym.zip -d ~/isaac_gym ``` #### 4. 安装 Isaac Gym 进入 `isaac_gym/python/` 目录并安装依赖项: ```bash cd ~/isaac_gym/python/ pip install -e . ``` #### 5. 配置动态链接库路径 由于 Ubuntu 22.04 的库文件路径可能与 Anaconda 环境不一致,需要手动设置 `LD_LIBRARY_PATH`。假设虚拟环境名为 `isaac_env`,执行以下命令: ```bash export LD_LIBRARY_PATH=/home/{user_name}/anaconda3/envs/isaac_env/lib:$LD_LIBRARY_PATH ``` 将上述命令添加到 `~/.bashrc` 文件中以便每次登录时自动加载。 #### 6. 验证安装 切换到示例脚本目录并运行验证脚本: ```bash cd ~/isaac_gym/examples/ python joint_monkey.py ``` 如果一切正常,脚本应成功运行并显示模拟结果。 #### 7. 常见问题及解决方法 - **错误:`ImportError: libpython3.8m.so.1.0: cannot open shared object file: No such file or directory`** 这是因为动态链接库路径未正确配置。按照前述步骤设置 `LD_LIBRARY_PATH` 即可[^1]。 - **显卡驱动问题** 确保显卡驱动已正确安装并支持 CUDA。对于 NVIDIA 显卡,建议安装最新的驱动版本,并验证 CUDA 是否正常工作[^2]。 - **Python 版本冲突** 使用 Anaconda 创建的 Python 3.8 环境可以避免版本冲突。如果仍遇到问题,尝试重新创建虚拟环境并清理缓存[^3]。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值