The Singles
时间限制: 1 Sec 内存限制: 128 MB提交: 272 解决: 66
[ 提交][ 状态][ 讨论版]
题目描述
The Signals’ Day has passed for a few days. Numerous sales promotion campaigns on the shopping sites make us forget that 11.11 is the Signals’ Day. So we should do something to enhance the concept of Singles’ Day.
Let’s give a number a, you should find the minimum number n only consist of digit 1(ie. 111,11111…) which can be divided by a. If the number exist, you should output "Singles' Day is on n.", otherwise you should output "There is no Singles' Day!".
输入
Several test cases.
For each test case:
Input is a integer a(1<=a<=1000000),as described above.
输出
For each test case:
Output "Singles' Day is on n." or "There is no Singles' Day!" in one line.
样例输入
1
2
3
样例输出
Singles' Day is on 1.
There is no Singles' Day!
Singles' Day is on 111.
//
// 1681.c
//
// Created by XFang on 16/02/18
// Copyright ©2016 XFang. All rights reserved.
//
#include<stdio.h>
int main(){
unsigned long long i,a,r;
while(scanf("%llu",&a)!=EOF){
r=0;
if(a%2==0||a%5==0) {
printf("There is no Singles' Day!\n");
}
else {
for(i=1;;i=i*10+1){
r++;
i=i%a;
if(i%a==0) {
break;
}
}
printf("Singles' Day is on ");
for(i=0;i<r;i++)
printf("1");
printf(".\n");
}
}
return 0;
}