题目描述

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

NEU 1681: The Singles的更多相关文章

  1. POJ 1681 (开关问题+高斯消元法)

    题目链接: http://poj.org/problem?id=1681 题目大意:一堆格子,或白或黄.每次可以把一个改变一个格子颜色,其上下左右四个格子颜色也改变.问最后使格子全部变黄,最少需要改变 ...

  2. NEU校园网登录器

    http://www.cnblogs.com/weidiao/p/5124106.html 改自学长的博客. 我们的目标是写一个程序实现自动登录校园网.而这基于的是表单的post机制. 输入校园网网址 ...

  3. HDU 1681 Frobenius

    题目链接:Frobenius 思路:想了很久还是没转过弯来. 递推. 初始化vis[0] = 1,每次有四种方法扩展,这样能扩展到所有能被表示的数.上界的判定,如果一万以内的数都能被表示,那以后的数肯 ...

  4. OpenJudge 2813 画家问题 / Poj 1681 Painter's Problem

    1.链接地址: http://bailian.openjudge.cn/practice/2813 http://poj.org/problem?id=1681 2.题目: 总时间限制: 1000ms ...

  5. 51 nod 1681 公共祖先 (主席树+dfs序)

    1681 公共祖先 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题   有一个庞大的家族,共n人.已知这n个人的祖辈关系正好形成树形结构(即父亲向儿子连边). 在另 ...

  6. NEU(Fst Network Embedding Enhancement via High Order Proximity Approximation)

    NEU(Fst Network Embedding Enhancement via High Order Proximity Approximation) NEU:通过对高阶相似性的近似,加持快速网络 ...

  7. 每日英语:Singles Day in China

    Singles Day in China is the celebration -- or mourning -- of being unattached. Started by students i ...

  8. POJ 1681 Painter's Problem(高斯消元+枚举自由变元)

    http://poj.org/problem?id=1681 题意:有一块只有黄白颜色的n*n的板子,每次刷一块格子时,上下左右都会改变颜色,求最少刷几次可以使得全部变成黄色. 思路: 这道题目也就是 ...

  9. 51nod 1681 公共祖先 | 树状数组

    51nod 1681 公共祖先 有一个庞大的家族,共n人.已知这n个人的祖辈关系正好形成树形结构(即父亲向儿子连边). 在另一个未知的平行宇宙,这n人的祖辈关系仍然是树形结构,但他们相互之间的关系却完 ...

随机推荐

  1. django-Ajax发送POST请求-csrf跨站请求的三种方式

    第一种 <script> $(".eq").on("click",function () { $.ajax({ url:"/eq/&quo ...

  2. Dreamweaver8中文版视频教程 [爱闪教程]Dreamweaver8中文版

    原文发布时间为:2008-07-30 -- 来源于本人的百度文章 [由搬家工具导入] http://www.176net.com/shipin/UploadFiles_1476/teach1/%5B% ...

  3. C++ 中new

    operator new在C++中的各种写法 (2011-09-21 14:59:33) 标签: 杂谈   乍一看,在C++中动态分配内存很简单:new是分配,delete是释放,就这么简单.然而,这 ...

  4. php——配合QQ邮箱发送邮件

    最近做一个域名管理系统的项目,实现在域名还有三十天的时候系统发送邮件到QQ邮箱从而提醒续费: 这里运用到了phpmailer; 1:getAll函数: function getAll($con,$sq ...

  5. codevs——1503 愚蠢的宠物

    1503 愚蠢的宠物  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 黄金 Gold 题解  查看运行结果     题目描述 Description 大家都知道,sheep有两 ...

  6. raspi集成库及安装

    原文:http://blog.csdn.net/xukai871105/article/details/12684617   树莓派来自国外,国外嵌入式开源领域具有良好的分享精神,树莓派各种集成库也层 ...

  7. 74.Search in a 2D Matrix

    /* * 74.Search in a 2D Matrix * 12.5 by Mingyang * 这里面的对应挺巧的: * 这个就是将2D矩阵转化成1行数组的对应表.所以对于二分查找法的初始值为: ...

  8. 应用程序中的server错误,没有名称为“ServiceBehavior”的服务行为

    应用程序中的server错误,没有名称为"ServiceBehavior"的服务行为         今天在阅读"创建和使用Web服务"的相关内容,在浏览器中查 ...

  9. ubuntu 14.04安装nodejs

    http://stackoverflow.com/questions/32902699/cannot-install-ember-on-ubuntu-1404/33495134

  10. 转: DNS 原理入门 (from 阮一峰)

    转自:http://www.ruanyifeng.com/blog/2016/06/dns.html DNS 原理入门   作者: 阮一峰 日期: 2016年6月16日 DNS 是互联网核心协议之一. ...