B. Duff in Love
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Duff is in love with lovely numbers! A positive integer x is called lovely if and only if there is no such positive integer a > 1 such that a2 is a divisor of x.

Malek has a number store! In his store, he has only divisors of positive integer n (and he has all of them). As a birthday present, Malek wants to give her a lovely number from his store. He wants this number to be as big as possible.

Malek always had issues in math, so he asked for your help. Please tell him what is the biggest lovely number in his store.

Input

The first and only line of input contains one integer, n (1 ≤ n ≤ 1012).

Output

Print the answer in one line.

Sample test(s)
Input
10
Output
10
Input
12
Output
6
Note

In first sample case, there are numbers 1, 2, 5 and 10 in the shop. 10 isn't divisible by any perfect square, so 10 is lovely.

In second sample case, there are numbers 1, 2, 3, 4, 6 and 12 in the shop. 12 is divisible by 4 = 22, so 12 is not lovely, while 6 is indeed lovely.

题意:给一个数n  然你找到最大的一个数x    x满足两个条件 1.是n的因子 2.x不能整除 任何正整数的平方

a题水果  看到这题 蒙蔽了 敲了一边 果然超时!!!打我呀?? 还不如不敲

补一下姿势   将n分解素因子得到n  =p1^k1*p2^k2*…pm^km  例如   12=2^2*3^1

举一个例子 模拟一边 给将来 自己看

12 的因子 1 2 3 4 6 12

12=2^2*3^1

从2-->sqrt(12)=3

12%(2*2)==0-->n=12/2=6-->

6%(2*2)!=0->

i++-->3

3>sqrt(6)

break;

!!!!!sqrt(n)是为了保证素因子!!!

#include<bits/stdc++.h>
using namespace std;
int main()
{
__int64 n;
scanf("%I64d",&n);
for(__int64 i=2;i<=sqrt(n);i++)
{
while(n%(i*i)==0)
n=n/i;
}
printf("%I64d\n",n);
return 0;
}

Codeforces Round #326 (Div. 2) B Duff in Love 简单数论 姿势涨的更多相关文章

  1. Codeforces Round #326 (Div. 2) D. Duff in Beach dp

    D. Duff in Beach Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/probl ...

  2. Codeforces Round #326 (Div. 2) C. Duff and Weight Lifting 水题

    C. Duff and Weight Lifting Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest ...

  3. Codeforces Round #326 (Div. 2) B. Duff in Love 分解质因数

    B. Duff in Love Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/proble ...

  4. Codeforces Round #326 (Div. 2) A. Duff and Meat 水题

    A. Duff and Meat Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/probl ...

  5. Codeforces Round #326 (Div. 1) - C. Duff in the Army 树上倍增算法

    题意:一个n个点的数, m个人住在其中的某些点上, 每个人的标号1-m, 询问u-v 路径上标号前a个人,并输出标号,a < 10. 作法, 利用倍增, ID[j][i] 表示i到i的第2^j个 ...

  6. Codeforces Round #326 Div.1 C.Duff in the Army 树上倍增

    题意概述: 给出一棵N个结点的树,然后有M个居民分散在这棵树的结点上(允许某个结点没有居民).现在给出一些询问形如u,v,a,定义k=min(x,a),其中x表示的是u->v路径上的居民数量.将 ...

  7. Codeforces Round #326 (Div. 2) B. Pasha and Phone C. Duff and Weight Lifting

    B. Pasha and PhonePasha has recently bought a new phone jPager and started adding his friends' phone ...

  8. Codeforces Round #326 (Div. 2)-Duff and Meat

    题意: Duff每天要吃ai千克肉,这天肉的价格为pi(这天可以买好多好多肉),现在给你一个数值n为Duff吃肉的天数,求出用最少的钱满足Duff的条件. 思路: 只要判断相邻两天中,今天的总花费 = ...

  9. 「日常训练」Duff in the Army (Codeforces Round #326 Div.2 E)

    题意(CodeForces 588E) 给定一棵\(n\)个点的树,给定\(m\)个人(\(m\le n\))在哪个点上的信息,每个点可以有任意个人:然后给\(q\)个询问,每次问\(u\)到\(v\ ...

随机推荐

  1. 游戏AI之群组行为

    群组行为指的是多个对象组队同时进行的情况.每个boid需满足分离,队列,凝聚三个基本的规则. 分离:群组中的每个个体都与相邻的个体保持一定的距离. 队列:群组以相同的速度,向相同的方向移动. 凝聚:与 ...

  2. 前端开发工程师 - 01.页面制作 - 第4章.CSS

    第4章.CSS CSS简介 Cascading Style Sheet 层叠样式表:定义页面中的表现样式 history: CSS1(1996)--CSS2(1998)--着手CSS3草案(拆分成很多 ...

  3. Spring ApplicationContext 简介

    ApplicationContext是对BeanFactory的扩展,实现BeanFactory的所有功能,并添加了事件传播,国际化,资源文件处理等.   configure locations:(C ...

  4. hihocoder刷题 扫雷游戏

    题目1 : 扫雷游戏 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定一个N × N的方格矩阵,其中每个格子或者是'*',表示该位置有一个地雷:或者是'.',表示该位 ...

  5. 最全的Markdown语法

    目录 Markdown语法 多级标题 引用与注释 插入代码 行内代码 代码段 图片 超链接 行内超链接 参数式超链接 字体 表格 分割线 多级列表 无序列表 有序列表 多选框 LaTeX公式 行内La ...

  6. spring 整合hibernate注解时候,出现“Unknown entity: com.ssh.entry.Admin; nested exception is org.hibernate.MappingException: Unknown entity: com.ssh.entry.Admin”异常的问题

    今天学习使用ssh框架的时候,出现一个异常,弄了好久才找到,在这记录一下,我的sb错误1.spring整合hibernate,取代*.hbm.xml配置文件   在applicationContext ...

  7. Centos/Linux 下升级python2.7至3.5.0

    (一) 安装Python3.5 (1)在安装python之前,因为linux系统下默认没有安装wget,gcc,首先安装wget,gcc: [root@node6 python_scripts]# y ...

  8. Greedy Gift Givers 贪婪的送礼者

    Description 对于一群要互送礼物的朋友,TRW要确定每个人送出的钱比收到的多多少.在这一个问题中,每个人都准备了一些钱来送礼物,而这些钱将会被平均分给那些将收到他的礼物的人.然而,在任何一群 ...

  9. 基于NABCD评论“欢迎来怼”团队Alpha版作品

    NABCD分析 N(需求) 随着博客园网页版的出现,大家希望能够随时看自己博客,查看别人的博客,以及写博客,评论博客等功能.对于学生的我们,及时了解作业的动态很重要,电脑不能随时携带,但手机随身携带, ...

  10. 软工实践Alpha冲刺(2/10)

    队名:我头发呢队 组长博客 作业博客 杰(组长) 过去两天完成了哪些任务 查看了讯飞开放平台的sdk 查阅了Google Material Design 2的官方文档 接下来的计划 继续打磨UI界面: ...