UVA 10127- Ones 数学
2016-01-05 22:47
344 查看
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
A file of integers at one integer per line.
Output
Each output line gives the smallest integer x > 0
such that p =
∑x−1
i=0 1×10i = a×b, where a is the
corresponding input integer, and b is an integer
greater than zero.
Sample Input
3
7
9901
Sample Output
3
6
12
题意:做少长度的 111.....使得 其能整除n
题解: 不断乘,不断取于就好了
daima
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
A file of integers at one integer per line.
Output
Each output line gives the smallest integer x > 0
such that p =
∑x−1
i=0 1×10i = a×b, where a is the
corresponding input integer, and b is an integer
greater than zero.
Sample Input
3
7
9901
Sample Output
3
6
12
题意:做少长度的 111.....使得 其能整除n
题解: 不断乘,不断取于就好了
//meek #include<bits/stdc++.h> #include <iostream> #include <cstdio> #include <cmath> #include <string> #include <cstring> #include <algorithm> #include<map> #include<queue> using namespace std ; typedef long long ll; #define mem(a) memset(a,0,sizeof(a)) #define pb push_back #define fi first #define se second #define MP make_pair const int N=550; const ll INF = 1ll<<61; const int inf = 1000000007; const int MOD = 2000000011; int main() { int n; while(scanf("%d",&n)!=EOF) { int ans = 1; int tmp = 1 % n; while( tmp ) { tmp = (tmp * 10 + 1) % n; ans++; } printf("%d\n", ans); } return 0; }
daima
相关文章推荐
- Daily Scrum – 1/5
- 5 Speaking Rules you need to know
- Android studio 使用sharesdk详解
- C 语言学习 —— 《明解C语言》
- 缓存淘汰算法--LFU算法
- Collection.synchronized*方法注意事项
- Java笔记——IO流分类
- android 布局 权重与分辨率设置的关系
- 深入java虚拟机(四)
- 第二百七十八天 how can I 坚持
- 【iCore3 双核心板】例程二十六:MODBUS TCP实验——电源监控
- 牛散NO.2:MACD西施说风情,柳下惠高位勿迷情
- 一篇非常详细的 Docker 学习笔记
- 数据库
- 【杭电oj】1162 - Eddy's picture(最小生成树)
- IIS站点配置和DW CS6连接Access数据库
- 设计模式(三):抽象工厂
- Razor 中的@helper 与 @function 用法
- 缓存淘汰算法--LRU算法
- Eclipse中Android工程下布局文件无法正常预览