2019牛客暑期多校训练营(第五场) A digits 2

检测装置管理培训.pdf 技术分享 立即下载

传送门

链接:https://ac.nowcoder.com/acm/contest/885/A
来源:牛客网
 

You are given a positive integer n which is at most 100.

Please find a positive integer satisfying the following conditions:

1. The sum of all digits of this number is dividable by n.

2. This number is also dividable by n.

3. This number contains no more than 10410^4104 digits.
 

If such an integer doesn't exist, output "Impossible" (without quotation marks).

If there are multiple such integers, please output any one.

输入描述:

The first line contains one integer T indicating that there are T tests.

Each test consists an integer n in a single line.

* 1≤T≤1001 \le T \le 1001≤T≤100

* 1≤n≤1001 \le n \le 1001≤n≤100

输出描述:

For each query, output one line containing the answer. The number you print cannot have leading zeros. If there are multiple answers, you can print any. If such an integer doesn't exist, output "Impossible" (without quotation marks) in a single line.

示例1

输入

3
1
9
12

输出

1
666666
888

说明

For the last test, 888 is dividable by 12 (888 = 12 * 74) and 8 + 8 + 8 = 24 is also dividable by 12 (24 = 12 * 2).

这题就很坑,给的测试样例我还真要看看题解是怎么求的

这题开始想的是用各个进制上求%打表做,直到明白位数是1e4(大),就很难受。

他给你n,假设是19好吧,那我求出来的是最少几个19连在一起满足条件(各个位置和被19,这个值因为是k个19连在一起,所以定能被19整除)就完事了(这里19是用各个位数和判断,把和扩大倍数,不成立是判断位数满足小于1e4,否则就无解),Giao

#include<bits/stdc++.h>
using namespace std;
const int inf = 10000;
int getsum(int x){
    int sum=0;
    while(x){
        sum+=(x%10);
        x/=10;
    }
    return sum;
}
int getbit(int x){
    int bit=0;
    while(x){
        bit++;
        x/=10;
    }
    return bit;
}
int main(){
    int t;cin>>t;
    while(t--){
        int n;scanf("%d",&n);
        int m = getsum(n);
        int k=0;
        for(int i=2;i<inf;i++){
            if(i*m%n==0){
                k=i;
                break;
            }
        }
        if(k==0|| k*getbit(n)>inf){
            printf("Impossible\n");
            continue;
        }
        for(int i=0;i<k;i++){
            cout<<n;
        }
        cout<<endl;
    }
    return 0;
}

 

执行力训练.pdf 技术分享 立即下载

相关推荐

高速加工高级应用之编程策略培训纲要.doc

技术分享

2019牛客ACM暑期多校第五场

A-digits 2 题目描述 You are given a positive integer n which is at most 100. Please find a positive integer satisfying the following conditions: 1. The sum of all digits of this number is dividable ...

。 306

Python实战:5分钟搞定VCF文件中每个样本的SNP统计(附bcftools安装指南)

本文介绍了三种高效统计VCF文件中每个样本SNP数量的Python方法,包括原生解析、结合bcftools的推荐方案以及使用PyVCF3专业库。特别推荐bcftools结合Python的方法,适用于中大型VCF文件,显著提升处理效率。文章还提供了bcftools安装指南和进阶统计技巧,帮助生物信息学分析人员快速完成SNP统计任务。

weixin_30555125的博客 503

牛客多校第五场 A digits 2 签到

题意: 给定一个n,输出一个数,要求这个数所有位之和整除n,并且这个数也整除n,并且位数不许多于1e4 题解: 把这个数n输出n遍。 #include<iostream> using namespace std; int main(){ int t; scanf("%d",&t); while(t--){ int ...

weixin_30788731的博客 188

手把手教你用SlowFast训练自定义手势识别数据集(附FFmpeg抽帧技巧)

本文提供了一份基于SlowFast架构训练自定义手势识别数据集的完整实战指南。文章重点剖析了数据准备的核心挑战,详细讲解了利用FFmpeg进行高、低帧率抽帧的技巧,并介绍了构建半自动标注流水线、生成符合SlowFast要求的AVA格式数据集文件的具体方法。最后,针对手势识别场景,给出了关键的模型训练配置与调优建议,帮助开发者高效完成从数据到模型的全流程。

s1t2u3的博客 914

使用 DEM 模拟金属烧结过程

了解离散元素法 (DEM) 如何彻底改变烧结工艺,提高制造业的效率和精度。

jkh920184196的博客 1140

2019牛客暑期多校训练营(第五场)A digits

Digitis 链接:https://ac.nowcoder.com/acm/contest/885/A Problem description You are given a positive integer n which is at most 100. Please find a positive integer satisfying the following conditions: ...

StuTan 189

告别迷茫!手把手教你用Altova XMLSpy编写EtherCAT从站ESI文件(附避坑指南)

本文详细介绍了如何使用Altova XMLSpy高效编写EtherCAT从站ESI文件,涵盖核心架构、通信通道配置、过程数据映射等关键步骤,并提供了常见问题排查与性能优化建议。通过实战案例和避坑指南,帮助工程师快速掌握EtherCAT从站开发技巧,提升工作效率。

weixin_42570484的博客 400

AtCoder Beginner Contest 070

A - Palindromic Number Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement You are given a three-digit positive integer N. Determine whether N is a palindromic numbe

干掉学霸我称王的博客 459

某东x-api-eid-token风控参数分析与破解

x-api-eid-token是京东的风控参数,在接口当中,如果没有该参数,有一定的概率能请求成功,但是在请求一段时间后,会报403权限失败的,该参数主要通过jsTk.do这个接口生成,并且会将其存储到cookie当中。

zhouzhou_98的博客 1556

出现 Connection Failed [MySQL][ODBC Driver]Access denied for user ‘root‘@x(using password:YES)解决方法

Connection Failed [MySQL][ODBC 8.0(w) Driver]Access denied for user 'root'@xxxx (using password:YES)

码农研究僧的博客 1064

2019牛客多校第五场 A.digits 2

A.digits 2 题意: t组样例,给你一个数 n (1 <= n <= 100) ,让你输出一个数 x ,x 满足两个条件 : 1 . x 是 n 的倍数. 2 . x 的每一位数字加起来的和也是 n 的倍数。 题解: 直接输出 n 个 n #include <bits/stdc++.h> using namespace...

error311的博客 204

【STM32实物】基于STM32的扫地机器人/小车控制系统设计

扫地机器人系统采用分层结构设计,主要包括底层硬件控制层、中间数据处理层和上层用户交互层。底层硬件控制层负责对各个硬件模块进行控制和数据采集,中间数据处理层负责对采集到的数据进行处理和解算,上层用户交互层负责与用户进行交互并显示系统状态信息。

嵌入式阿齐Archie 1万+

2019牛客暑期多校训练营(第五场)----A- digits 2

首先发出题目链接: 链接:https://ac.nowcoder.com/acm/contest/885/A 来源:牛客网 涉及:思维 点击这里回到2019牛客暑期多校训练营解题—目录贴 题目如下: 代码如下 #include <iostream> using namespace std; int n, t; int main(){ cin >> t; while(t--){ cin >> n; for(int i =

weixin_43702895的博客 209

Android15音频进阶之AudioReach架构agmcap bringup调试(一百二十三)

本篇目的:Android15音频进阶之AudioReach架构agmcap录音调试。

Android系统攻城狮 2237

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

题解 | digits 2-2019牛客暑期多校训练营第五场A题

题目来源于牛客竞赛:https://ac.nowcoder.com/acm/contest/discuss 题目描述: 输入描述: 输出描述: 示例1: 题解: 代码: /*{{{*/ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include&...

lastbye的博客 220

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

2019牛客暑期多校训练营(第五场) digits 2

时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K Special Judge, 64bit IO Format: %lld 题目描述 You are given a positive integer n which is at most 100....

156

贝叶斯统计 [韦来生编]

贝叶斯(Bayes)统计是近几十年来迅速发展起来的数理统计的一个重要分支。贝叶斯方法与经典统计方法的主要不同之处是进行统计推断时除了利用样本信息外,还要利用参数的先验信息,因此可以提高统计推断或统计决策的效果。它在经济、金融、生物、医学、自然科学和社会科学等许多领域具有广泛的应用。贝叶斯方法的研究已渗透到了统计学的几乎所有领域。作者在给中国科学技术大学概率论与数理统计专业本科生开设的“数理统计”课程中有一章专门讲授“贝叶斯方法和统计决策理论”,近十年来也给中国科学技术大学概率统计专业研究生开设过几次“贝叶斯分析”课。本书是在对过去讲稿的内容作了适当的增减和调整的基础上完成的。  本书共分六章。第1章是绪论,介绍了贝叶斯统计的若干基本概念,同时对必要的数理统计的基础知识有重点地作了回顾。第二章介绍了确定先验分布的若干可供选择的方法。第三章介绍了几类常见统计模型参数的后验分布的主要结果和计算方法。第四章和第五章分别介绍了“贝叶斯统计推断”和“贝叶斯统计决策”的内容。第六章介绍了贝叶斯统计计算的若干方法,包括蒙特卡洛方法和马尔可夫链蒙特卡洛(MCMC)方法以及相关统计软件的简介。本书的每一章附右大量的例题和习题,书末附有常用的几个表格和部分习题解答供读者查用。  大约可在54学时内讲授本书的第1章至第六章的主要内容,教师可根据学时需要选讲本书第1章至第六章的部分内容。书中标“*”号的章节可略去不讲,留给读者作为阅读材料。第六章例题中的R代码和部分例题的数据文件等可从作者个人主页下载。  作者在编写本书的过程中参考了J.O.Berger教授的《统计决策论及贝叶斯分析》和茆诗松教授编写的《贝叶斯统计》等书中的一些内容,以及《贝叶斯分析》一书中由张伟平博士编写的有关贝叶斯统计计算的一些内容。在此表示衷心感谢。  本书编写准备过程中,中国科学技术大学统计与金融系的几个研究生帮助完成了本书部分中文的录入和排版,作者对他们的辛勤工作表示真诚的感谢。高等教育出版社为本书的出版给予了大力支持。在此一并致谢。

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

2019牛客暑期多校训练营(第五场) subsequence 1

链接:https://ac.nowcoder.com/acm/contest/885/G 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 You are given two strings s and t composed by digits (characters...

1999 178

2021牛客暑期多校训练营9 H Happy Number

H Happy Number 题目描述 Digits 2, 3 and 6 are happy, while all others are unhappy. An integer is happy if it contains only happy digits in its decimal notation. For example, 2, 3, 263 are happy numbers, while 231 is not. Now Cuber QQ wants to know the n-th hap

porridgexj的博客 306

2019牛客暑期多校训练营(第三场)

A:

Insistor 253

A. Ternary String 牛客网暑期ACM多校训练营(第四场)

 A. Ternary String  牛客网暑期ACM多校训练营(第四场) 题目链接 A ternary string is a sequence of digits, where each digit is either 0, 1, or 2. Chiaki has a ternary string s which can self-reproduce. Every second, a d...

brandong 528

牛客网暑期ACM多校训练营(第四场) A.Ternary String (找规律+欧拉降幂)

题目链接 时间限制:C/C++ 4秒,其他语言8秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 A ternary string is a sequence of digits, where each digit is either 0, 1, or 2. Chiaki has a ternary string s wh...

Fushicho_XF的博客 961

牛客网暑期ACM多校训练营(第三场): A. Ternary String(欧拉降幂+递推)

题目描述 A ternary string is a sequence of digits, where each digit is either 0, 1, or 2. Chiaki has a ternary string s which can self-reproduce. Every second, a digit 0 is inserted after every 1 in the ...

加载中... 479

digits 2

digits 2 震惊了== 我还交的表,发现直接输出n个n就行=== #include<bits/stdc++.h> using namespace std; string s[101]={ "1", "2", "3", "4", "5", "6", "7", "8", "9", "640", "704", "48", "83...

asmallfish1985的博客 328

【 CodeForces - 1060B 】Maximum Sum of Digits(思维,构造)

题干: You are given a positive integer nn. Let S(x)S(x) be sum of digits in base 10 representation of xx, for example, S(123)=1+2+3=6S(123)=1+2+3=6, S(0)=0S(0)=0. Your task is to find two integers a,...

xuanweiace的博客 834
上一篇: 贪心:poj 2287 Tian Ji -- The Horse Racing
下一篇: DP: Brackets Sequence
A_Pathfinder
博客等级 码龄8年 29粉丝 90原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值