国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

ZCMU-Problem E - Ones

2019-11-11 05:04:10
字體:
來源:轉載
供稿:網友

PRoblem E: Problem E - Ones

Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 27  Solved: 24[Submit][Status][Web Board]

Description

Given any integer 0 <= n <= 10000 not divisible by 2 or 5, some multiple of n is a number which in decimal notation is a sequence of 1's. How many digits are in the smallest such a multiple of n?

Input

Output

Sample Input

379901

Sample Output

3612

HINT

【解析】這道題的意思其實就是讓我們輸出要有多少個1才能是輸入的n的倍數。比如第一個是輸入3,111才是3的倍數所以輸出3表示有3個1.所以我們只需要枚舉1,11,111等這些全是1的數就可以了。
#include<iostream>#include<cstdio>#include<cstring>using namespace std;int main(){    int n,count1=0;    long long m;    while(~scanf("%d",&n))    {        m=1;        count1=1;        while(m%=n)        {            m=m*10+1;            count1++;        }    printf("%d/n",count1);    }    return 0;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 永康市| 阿图什市| 南靖县| 平阳县| 洞口县| 博乐市| 尚志市| 黄陵县| 米易县| 温宿县| 张北县| 泰和县| 石景山区| 荆州市| 金川县| 宣威市| 灵山县| 南汇区| 马边| 名山县| 汾阳市| 临湘市| 四会市| 乳源| 商城县| 克拉玛依市| 汉源县| 施甸县| 南充市| 青川县| 罗山县| 怀远县| 即墨市| 丽水市| 大洼县| 姚安县| 都安| 普格县| 荣昌县| 玛沁县| 宝清县|