fjnu 1543 Ones
来源:互联网 发布:电脑网络不稳定老掉线 编辑:程序博客网 时间:2024/05/16 14:58
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
Each line contains a number n.
Output
Output the number of digits.
Sample Input
3 7 9901
Sample Output
3612
KEY:给定一个n,看几个连续的1可以整除他;
Source:
#include<iostream>
using namespace std;
int main()
...{
unsigned n, t, T;
while(cin>>n)
...{
t=T=1;
t%=n;
while(t)
...{
t=t*10+1;
T++;
t%=n;
}
cout<<T<<endl;
}
return 0;
}
#include<iostream>
using namespace std;
int main()
...{
unsigned n, t, T;
while(cin>>n)
...{
t=T=1;
t%=n;
while(t)
...{
t=t*10+1;
T++;
t%=n;
}
cout<<T<<endl;
}
return 0;
}
- fjnu 1543 Ones
- FJNU
- Ones
- Ones
- Ones
- ones
- ones
- ones
- FJNU字符串
- FJNU字符串
- fjnu 1772
- Ones(ZJU_1889)
- poj2551 Ones
- JOJ1894:Ones
- Watched Ones
- Ones(P2551)
- zoj1889------------------------------Ones
- Counting Ones
- java 发送mail
- 逆向工程之内核下创建用户进程
- SOA 新业务语言 新系统架构——参考模型和重要概念
- NTFS和FAT32互相转换
- 恢复SSDT使瑞星保护失效
- fjnu 1543 Ones
- 现在,该你出场(英雄会刊首语)
- fjnu 1892 A Mathematical Curiosity
- 怎么做一个壳 Part
- 机器狗写入到userinit.exe文件的下载者源码
- jquery实际项目中的JS例子.
- fjnu 1460 拦截导弹
- 解决不固定的内容的动态维护与选择(跟随TextBox的DIV)
- 触发器的作用