UVA 10127题目描述】的更多相关文章

Given any integer 0 ≤ n ≤ 10000 not divisibleby 2 or 5, some multiple of n is a number whichin decimal notation is a sequence of 1’s. Howmany digits are in the smallest such a multipleof n?InputA file of integers at one integer per line.OutputEach out…
#include <iostream>#include <cstdio>#include <cmath> int main(){ int num; while (scanf_s("%d",&num) != EOF) { int cnt = 2; long long testNum = 11; while (true) { if (testNum%num == 0) { break; } testNum = testNum * 10 + 1;…
题目链接: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…
最近在跟着算法竞赛入门经典刷题,发现Uva网站打开超级慢,进个主页面都需要好几秒.后来发现可以通过vjudge网站刷Uva的题目,很是方便,在这mark一下,顺便做一下推荐. vjudge网址:https://vjudge.net,点击后会进入vjudge网站主页,如下图: 可以发现vjudge支持包括POJ.Uva.ZOJ等等一系列OJ网站的题目评测.第一次通过该网站刷题需要先注册一个账号,点击右上角Register按钮,会跳出注册页面: 只需填写好名字.密码.Email.验证码即可注册成功.…
题目链接 题意:给你一个数n,问最少有多少个1构成的“1”串(1,11,...)能整除n; 比如:111能被3整除: 111111能被7整除:... 作为水货觉得只要自己能1A的都是水题=. = #include<iostream> #include<cstdio> #include<cstdlib> #include<cmath> using namespace std; ; int main() { int n, p[maxn]; while(~scan…
时间限制:1秒     空间限制:32768k 斐波那契数列指的是这样一个数列: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368. 可以观察到,从第3个数开始,每个数的值都等于前连个数之和. 同时,定义f(0)=0, f(1)=1. 则 f(2)=f(1)+f(0)=1; f(3)=f(2)+f(1)=2; ... 依次类推,  f(…
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…
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.…
Eugeny has array a = a1, a2, ..., an, consisting of n integers. Each integer ai equals to -1, or to 1. Also, he has m queries: Query number i is given as a pair of integers li, ri (1 ≤ li ≤ ri ≤ n). The response to the query will be integer 1, if the…
MinStack minStack = new MinStack();minStack.push(-2);minStack.push(0);minStack.push(-3);minStack.getMin(); --> 返回 -3.minStack.pop();minStack.top(); --> 返回 0.minStack.getMin(); --> 返回 -2. const minStack = function(){ this.stack = [] // 辅助栈,换更少的时间复…