【数论,水题】UVa 10127 - Ones
题意:给你一个数n,问最少有多少个1构成的“1”串(1,11,...)能整除n;
比如:111能被3整除; 111111能被7整除;...
作为水货觉得只要自己能1A的都是水题=。 =
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;
const int maxn = ;
int main()
{
int n, p[maxn];
while(~scanf("%d", &n))
{
if(!n) {printf("0\n"); continue;}
int len = log10(n)+;
int val = , x;
for(x = ; x < len; x++)
{
val = val* + ;
}
int res = ;
if(val/n == )
{
val = val*+;
x++;
}
res = val%n;
while(res)
{
res = res*+;
res = res%n;
x++;
}
printf("%d\n", x);
}
return ;
}
【数论,水题】UVa 10127 - Ones的更多相关文章
- [ACM_水题] UVA 12502 Three Families [2人干3人的活后分钱,水]
Three Families Three families share a garden. They usually clean the garden together at the end o ...
- HDU 3215 The first place of 2^n (数论-水题)
The first place of 2^n Problem Description LMY and YY are mathematics and number theory lovers. They ...
- POJ 1061 青蛙的约会 数论水题
http://poj.org/problem?id=1061 傻逼题不多说 (x+km) - (y+kn) = dL 求k 令b = n-m ; a = x - y ; 化成模线性方程一般式 : Lx ...
- [ACM_水题] UVA 11729 Commando War [不可同时交代任务 可同时执行 最短完成全部时间 贪心]
There is a war and it doesn't look very promising for your country. Now it's time to act. You have a ...
- [ACM_水题] UVA 11292 Dragon of Loowater [勇士斗恶龙 双数组排序 贪心]
Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shor ...
- Coprime Arrays CodeForces - 915G (数论水题)
反演一下可以得到$b_i=\sum\limits_{d=1}^i{\mu(i)(\lfloor \frac{i}{d} \rfloor})^n$ 整除分块的话会T, 可以维护一个差分, 优化到$O(n ...
- HDU 1576 A/B 数论水题
http://acm.hdu.edu.cn/showproblem.php?pid=1576 写了个ex_gcd的模板...太蠢导致推了很久的公式 这里推导一下: 因为 1 = BX + 9973Y ...
- UVa 489 HangmanJudge --- 水题
UVa 489 题目大意:计算机给定一个单词让你猜,你猜一个字母,若单词中存在你猜测的字母,则会显示出来,否则算出错, 你最多只能出错7次(第6次错还能继续猜,第7次错就算你失败),另注意猜一个已经猜 ...
- UVa 1339 Ancient Cipher --- 水题
UVa 1339 题目大意:给定两个长度相同且不超过100个字符的字符串,判断能否把其中一个字符串重排后,然后对26个字母一一做一个映射,使得两个字符串相同 解题思路:字母可以重排,那么次序便不重要, ...
随机推荐
- homework-06-C++11
http://blog.csdn.net/lancelet/article/details/7220558 http://www.csdn.net/article/2012-05-15/2805585 ...
- HDU 5724 Chess (sg函数)
Chess 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5724 Description Alice and Bob are playing a s ...
- HDU 1856 More is better(并查集)
http://acm.hdu.edu.cn/showproblem.php?pid=1856 More is better Time Limit: 5000/1000 MS (Java/Others) ...
- codeforces 622A Infinite Sequence
A. Infinite Sequence time limit per test 1 second memory limit per test 256 megabytes input standard ...
- javascript 工具方法(长期更新)
//密码强度判断,低级:不到八位:中级:八位以上:高级:八位以上并加入了特殊符号. function pwdStrength(pwd) { var pwdLevel; if ((pwd &&a ...
- 判断滑动方向UITableView
CGFloat lastContentOffset; //ScoreView 滑动位置 -(void)scrollViewWillBeginDragging:(UIScrollView*)scrol ...
- Thinkphp框架----微信公众测试号开发
最开始的一个步骤.注册一个微信公众测试号.URL:https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login; 接口配置的信息,对新手 ...
- UVa297 Quadtrees
// UVa297 Quadtrees // 题意:给两棵四分树的先序遍历,求二者合并之后(黑色部分合并)黑色像素的个数.p表示中间结点,f表示黑色(full),e表示白色(empty) // 算法: ...
- pod install warning
warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 解决方法: sudo chmod 775 /usr/l ...
- 401 Palindromes(回文词)
Palindromes A regular palindrome is a string of numbers or letters that is the same forward as ba ...