NEU 1681: The Singles
题目描述
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的更多相关文章
- POJ 1681 (开关问题+高斯消元法)
题目链接: http://poj.org/problem?id=1681 题目大意:一堆格子,或白或黄.每次可以把一个改变一个格子颜色,其上下左右四个格子颜色也改变.问最后使格子全部变黄,最少需要改变 ...
- NEU校园网登录器
http://www.cnblogs.com/weidiao/p/5124106.html 改自学长的博客. 我们的目标是写一个程序实现自动登录校园网.而这基于的是表单的post机制. 输入校园网网址 ...
- HDU 1681 Frobenius
题目链接:Frobenius 思路:想了很久还是没转过弯来. 递推. 初始化vis[0] = 1,每次有四种方法扩展,这样能扩展到所有能被表示的数.上界的判定,如果一万以内的数都能被表示,那以后的数肯 ...
- OpenJudge 2813 画家问题 / Poj 1681 Painter's Problem
1.链接地址: http://bailian.openjudge.cn/practice/2813 http://poj.org/problem?id=1681 2.题目: 总时间限制: 1000ms ...
- 51 nod 1681 公共祖先 (主席树+dfs序)
1681 公共祖先 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 有一个庞大的家族,共n人.已知这n个人的祖辈关系正好形成树形结构(即父亲向儿子连边). 在另 ...
- NEU(Fst Network Embedding Enhancement via High Order Proximity Approximation)
NEU(Fst Network Embedding Enhancement via High Order Proximity Approximation) NEU:通过对高阶相似性的近似,加持快速网络 ...
- 每日英语:Singles Day in China
Singles Day in China is the celebration -- or mourning -- of being unattached. Started by students i ...
- POJ 1681 Painter's Problem(高斯消元+枚举自由变元)
http://poj.org/problem?id=1681 题意:有一块只有黄白颜色的n*n的板子,每次刷一块格子时,上下左右都会改变颜色,求最少刷几次可以使得全部变成黄色. 思路: 这道题目也就是 ...
- 51nod 1681 公共祖先 | 树状数组
51nod 1681 公共祖先 有一个庞大的家族,共n人.已知这n个人的祖辈关系正好形成树形结构(即父亲向儿子连边). 在另一个未知的平行宇宙,这n人的祖辈关系仍然是树形结构,但他们相互之间的关系却完 ...
随机推荐
- 准备 KVM 实验环境
KVM 是 OpenStack 使用最广泛的 Hypervisor,本节介绍如何搭建 KVM 实验环境 安装 KVM 上一节说了,KVM 是 2 型虚拟化,是运行在操作系统之上的,所以我们先要装一个 ...
- Post Content_Length exceeds the limit
2017.12,公司市场专员反馈我在公司开发与维护的iOS包内审系统在上传ipa包文件的时候报错了.经过调试发现原来是因为上传的文件太大导致报错(由下图可知,接收方允许的最大请求内容为128M,但我们 ...
- 在 Windows 下用 TDM-GCC(MinGW)开发 DLL 涉及到数据同步锁及 DLL 初始化终止化函数的问题
在 Windows 下用 TDM-GCC(MinGW)开发 DLL 如果要用到数据同步锁,理论上可以采用 Windows API 提供的临界区实现(需要用到的函数有 InitializeCritica ...
- webstorm取消自动保存并标识修改的文件为星星标记
a.取消自动保存是去掉一下两个勾选. b.标记星星要勾选下面的选项. c.最终效果.
- Bruce Eckel:编程生涯
大家总是问一个错误的问题:“我应该学习C++还是Java?”在本文中,我将告诉大伙儿:对于选择编程生涯真正需要关注的是哪些问题. 请注意,这篇文章的目标读者并不是那些已经做出自己选择的人.(对于这些人 ...
- T3137 栈练习1 codevs
codevs.cn/problem/3137 题目描述 Description 给定一个栈(初始为空,元素类型为整数,且小于等于100),只有两个操作:入栈和出栈.先给出这些操作,请输出最终栈的栈顶元 ...
- 利用javascript实现在圆周上匀速划动的动画效果
先看下效果:
- Java中循环与选择语句
public class Ifelse{ public static void main(String [] args){ int score=98; if(score>=90&& ...
- Ubuntu 16.04安装Mac OS 12虚拟机资源(没成功,但资源还是可以用)
整理的Mac OS 12虚拟机资源.装虚拟机基本是按这样的套路: 1.先装VM 2.破解VM使其支持Mac OS 12,这个脚本基本是全平台支持,可以看里面的教程文档. 3.用镜像安装系统. 资源: ...
- 【原】理解javascript中的闭包(***********************************************)
阅读目录 什么是闭包? 闭包的特性 闭包的作用: 闭包的代码示例 注意事项 总结 闭包在javascript来说是比较重要的概念,平时工作中也是用的比较多的一项技术.下来对其进行一个小小的总结 回到顶 ...