题目描述

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. 题目的意思就是 找到 一个只由1组成的数x 使得 x%a==0
一开始是这么 做得枚举 x 然后判断是否能被a整除。结果 wa了。
得用高精度做。从左边模拟每一位1除以a 具体看代码
/* ***********************************************
Author :guanjun
Created Time :2016/3/5 11:58:53
File Name :neu1681.cpp
************************************************ */
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <iomanip>
#include <list>
#include <deque>
#include <stack>
#define ull unsigned long long
#define ll long long
#define mod 90001
#define INF 0x3f3f3f3f
#define maxn 1001000
#define cle(a) memset(a,0,sizeof(a))
const ull inf = 1LL << ;
const double eps=1e-;
using namespace std;
priority_queue<int,vector<int>,greater<int> >pq;
struct Node{
int x,y;
};
struct cmp{
bool operator()(Node a,Node b){
if(a.x==b.x) return a.y> b.y;
return a.x>b.x;
}
}; bool cmp(int a,int b){
return a>b;
}
int mp[maxn];
int main()
{
#ifndef ONLINE_JUDGE
//freopen("in.txt","r",stdin);
#endif
//freopen("out.txt","w",stdout);
ll a;
while(cin>>a){
cle(mp);
int num=;
int n=;
while(){
num++;
n=n%a;
if(n==){
printf("Singles' Day is on ");
for(int i=;i<=num;i++){
printf("");
}
printf(".\n");
break;
}
if(mp[n]){
puts("There is no Singles' Day!");break;
}
else mp[n]=;
n=n*+;
}
}
return ;
}
 

最新文章

  1. PDA手持机 移动开单进销存系统 现场出打印凭据和扫码 新的亮点
  2. MySQL使用正则表达式比较字段中的数字
  3. BZOJ-1880 Elaxia的路线 SPFA+枚举
  4. WIN32进阶必备:跟随鼠标移动的子窗口
  5. rapidxml对unicode的支持
  6. 24种设计模式--单例模式【Singleton Pattern】
  7. pecl安装php的ev扩展时的报错处理
  8. wget访问SOAP接口
  9. 七字真言解读TCP三次握手
  10. django中数据库操作——in操作符
  11. 2017-06-28(passwd 主要组与附属组 gpasswd newgrp groups)
  12. DFS(深度优先)算法编程实践
  13. struts2(二)---ModelDriven模型驱动
  14. GDB调试指南-变量查看
  15. VisualStuido C# Files 的值“&lt;&lt;&lt;&lt;&lt;&lt;&lt; .mine”无效。路径中具有非法字符。
  16. 蛋白质结构模型和功能预测:I-TASSER工具的使用
  17. java基础----&gt;数组的基础使用(二)
  18. oracle索引优化
  19. Centos Python3安装共存
  20. mysql -&gt; 索引_07

热门文章

  1. 刷题总结——愤怒的小鸟(NOIPDAY2T3)
  2. mongodb的安装及环境配置
  3. POJ 2762 Going from u to v or from v to u? Tarjan算法 学习例题
  4. 使用&lt;sstream&gt; 替代&lt;stdio.h&gt;
  5. 简单div遮罩
  6. STM32F10x_StdPeriph_Driver_3.5.0(中文版).chm的使用
  7. Windows下配置scrapy需要MVC的14.0版本(转载)
  8. LeetCode:926. 将字符串翻转到单调递增
  9. Spring MVC集成Spring Data Reids和Spring Session实现Session共享
  10. kafka的安装和使用;kafka常用操作命令