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
- NEUOJ 1681
- neuoj 1595
- neuoj 1632
- NEUOJ Problem48
- NEUOJ-1235 Palindrome Substring
- NEUOJ 1484概率dp
- NEUOJ Drink It (模拟)
- NEUOJ 711 (字典树)
- NEUOJ 1262: ASCII Sequence II
- NEUOJ: 1299: 磊磊的难题
- NEUOJ 1393 Some Numbers(线段树)
- NEUOJ 1403: XL's Math Problem II
- NEUOJ 1302: 最大子序列(双向dp)
- NEUOJ 1660 (容斥+矩阵)
- NEUOJ 719 (字典树 字典序)
- NEUOJ 720 (字典树+LCA || 二分+哈希)
- NEUOJ 720 头哥的烦恼
- NEUOJ 1176 Problem: Easy to improve
- 对jsp九大内置对象的理解
- RTMP直播点播-基于开源crtmpserver
- Android 线程本地变量<一> ThreadLocal源码解析
- Android 深入理解Android中的自定义属性
- 59.View the Exhibit and examine the data in the PRODUCTS table.
- NEUOJ 1681
- win10 Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host
- 二级指针和二维数组详解
- 图片 音频等文件转成base64编码
- HTML5新特性
- SVM入门(八)松弛变量
- 初次使用git管理代码~后续使用过程中遇到的问题汇总
- PAT 1101. Quick Sort (25)
- linux安装hadoop2.7.2nodemanager启动停止