Digit-Sum HDU - 5710

 

Let S(N)S(N) be digit-sum of NN, i.e S(109)=10,S(6)=6S(109)=10,S(6)=6

If two positive integers a,ba,b are given, find the least positive integer nnsatisfying the condition a×S(n)=b×S(2n)a×S(n)=b×S(2n)

If there is no such number then output 0. 
Input
The first line contains the number of test caces T(T10)T(T≤10)
The next TT lines contain two positive integers a,b(0<a,b<101)a,b(0<a,b<101)
Output
Output the answer in a new line for each test case. 
Sample Input
3
2 1
4 1
3 4
Sample Output
1
0
55899

 题意很好理解   因为  s(n) 中 各个位数字设  t , t为 1-4 时 放大2倍 为 2t  , t 而 5-9时 放大2倍 则变为 2t -9  

 设 5 -9的个数为L  那么 s(2n)=2s(n)-9L   则 (a-2b)*s(n)=9bL;    s(n) / l =9b / (a-2b)   那么 a-2b 是 5-9的个数   9b是 s(n)    这样我们得保证 a-2b >=0 且 9b - 5*( a-2b)>0     

我们先假设这 a-2b 个数全为 5   设 p=9b - 5*( a-2b)  ;

 

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<queue>
#include<iomanip>
#include<bits/stdc++.h>
#define eps 1e-8
//#define inf 0x7f
//int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
using namespace std;
int aa[300];
int main()
{
    int t,a,b;
    scanf("%d",&t);
    while(t--)
    {
        memset(aa,0,sizeof(aa));
        scanf("%d%d",&a,&b);
        int k2=2*b-a;
        int k1=9*b;
        if(k2<0||b>5*a) 
        {
            printf("0\n");
            continue;
        }
        if(k2==0)
        {
            printf("1\n");
            continue;
        }
        int u=__gcd(k1,k2);
       k1=k1/u;
       k2=k2/u;
        int i;
        int p=k1-(k2*5);
         for(i=0;i<k2;i++) 
         {
              int e=min(4,p);
              aa[i]=5+e;
              p=p-e;

         }
          while(p)
          {
              int e=min(4,p);
              aa[i++]=e;
              p=p-e;
          }
        for(i=i-1;i>=0;i--)
            printf("%d",aa[i]);
            printf("\n");
        }
}




### Free Spoken Digit Dataset 下载与特性 Free Spoken Digit 数据集是一个受到 MNIST 数据集启发而构建的音频数据集,专注于解决通过语音识别数字的任务[^1]。以下是关于此数据集的一些重要信息: #### 数据集基本信息 - **来源**: 此数据集由一位研究者开发并托管于 GitHub 上。 - **规模**: 当前版本包含来自 3 名不同说话者的英语发音录音,总计约 1500 条记录(每位说话者分别录制了从 0 到 9 的数字各 50 遍)[^1]。 #### 如何下载 Free Spoken Digit Dataset? 可以通过访问其官方存储库来获取最新版的数据集文件。具体地址如下: [GitHub Repository: Free-Spoken-Digit-Dataset](https://github.com/Jakobovski/free-spoken-digit-dataset) 在仓库页面中可以找到 `master` 分支下的所有资源以及详细的说明文档。通常情况下,可以直接点击“Code”按钮克隆整个项目到本地环境或者单独下载压缩包形式的内容。 另外值得注意的是,在实际应用过程中如果遇到较大体积的数据传输需求时,则可能需要用到其他工具辅助完成高效下载操作;而对于初学者而言简单利用浏览器界面即可满足基本需求[^3]。 对于更复杂场景比如批量处理多个子目录内的wav格式声音片段等情况则建议编写相应脚本来实现自动化加载流程[^4] 。下面给出一段简单的Python代码用于演示如何读取其中一个样本文件: ```python import librosa import matplotlib.pyplot as plt # 加载单个音频文件示例路径替换为你自己的真实位置 audio_path = './free_spoken_digit_dataset/0_jackson_0.wav' y, sr = librosa.load(audio_path) plt.figure(figsize=(14, 5)) librosa.display.waveplot(y, sr=sr) ``` 以上就是有关 free spoken digit dataset master download 方面的信息介绍啦!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值