NEUOJ 1681

来源:互联网 发布:游戏原画网络班 编辑:程序博客网 时间:2024/05/17 03:05

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.

样例输入

123

样例输出

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;}


本来是道大水题,可是挺多人挂的,给自己留个提醒吧!
应该是取模运算的应用。
看来是时候看看数论了

0 0
原创粉丝点击