UVA 10127题目描述

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 ?le 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

时间: 2024-08-15 17:40:40

UVA 10127题目描述的相关文章

uva 10127 - Ones(数论)

题目链接:uva 10127 - Ones 题目大意:给出n,问说者少要多少为1才可以整除n. 解题思路:等于是高精度取模,直到余数为0为止. #include <cstdio> #include <cstring> int main () { int n; while (scanf("%d", &n) == 1) { int ans = 1, c = 1; while (c) { c = (c * 10 + 1) % n; ans++; } print

10月日常练习1题目描述

问题1. 最大公约数和最小公倍数问题 题目描述 输入2个正整数 \(x0, y0 (2 \le x0 \lt 100000, 2 \le y0 \le 1000000)\) ,求出满足下列条件的 P,Q 的个数. 条件: P,Q是正整数 要求 P,Q 以 x0 为最大公约数,以 y0 为最小公倍数. 试求:满足条件的所有可能的2个正整数的个数. 输入格式 2个正整数x0,y0 输出格式 1个数,表示求出满足条件的P,Q的个数 样例输入 3 60 样例输出 4 说明/提示 P,Q有4种: 3,60

UVa 10127 - Ones

题目:求一个全是1组成的最小可以整除n的数. 分析:数论,模拟.每次保留mod n的余数乘以10加1即可. 说明:每天一水题. #include <iostream> #include <cstdlib> #include <cstdio> using namespace std; int main() { int n; while (cin >> n) { int value = 1,count = 1; while (value%n) { value =

【POJ1062】昂贵的聘礼 最短路 题目描述还有数据都坑爹

题意:中文题,这里只提供题目传送门 http://poj.org/problem?id=1062 题解:首先若物品1可以由物品2加上x元得到,连一条B -> A的单向边,边权为x. 然后源点向每个物品连一条物品直接价格的边. 然后枚举点权的下限和上限. 好吧,很水.但是数据范围坑爹!!!点权还能是0!!而且酋长等级不一定最高!! 贴代码: #include <cstdio> #include <cstring> #include <algorithm> #defi

【数论,水题】UVa 10127 - Ones

题目链接 题意:给你一个数n,问最少有多少个1构成的“1”串(1,11,...)能整除n; 比如:111能被3整除: 111111能被7整除:... 作为水货觉得只要自己能1A的都是水题=. = 1 #include<iostream> 2 #include<cstdio> 3 #include<cstdlib> 4 #include<cmath> 5 using namespace std; 6 const int maxn = 10010; 7 int

(imcomplete) UVa 10127 Ones

方法:暴力 数论 其实我们可以先证明一下为什么n(不被2和5整除)的一个倍数可以在十进制下被表示成1111111...111, 即证明存在一个形如1111...111的数可以被n整除.n 不能被2和5整除,可以得出 n 和 10 是 互质的(comprime),那么10 mod n 存在一个multiplicative order (https://en.wikipedia.org/wiki/Multiplicative_order).然后我们设11111111...111 (ordn(10)

POJ 1028题目描述

Description Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can be reached by moving backward and forward.

POJ 1035题目描述

Description You, as a member of a development team for a new spell checking program, are to write a module that will check the correctness of given words using a known dictionary of all correct words in all their forms. If the word is absent in the d

POJ 题目1145/UVA题目112 Tree Summing(二叉树遍历)

Tree Summing Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8132   Accepted: 1949 Description LISP was one of the earliest high-level programming languages and, with FORTRAN, is one of the oldest languages currently being used. Lists, w