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的素因子的乘积、记住与因子相关的都可以尝试着向素数方面靠、、

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cstdlib>
using namespace std; typedef long long int LL ; int main() {
LL n;
cin >> n;
LL res = 1;
for (LL i = 2; i*i<=n; i++) {
if (n %i ==0) {
res *= i;
while (n %i == 0)
n /= i;
}
}
cout << res*n<< endl; return 0;
}

B. Duff in Love的更多相关文章

  1. 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 ...

  2. 【转】Duff's Device

    在看strcpy.memcpy等的实现发现用了内存对齐,每一个word拷贝一次的办法大大提高了实现效率,参加该blog(http://totoxian.iteye.com/blog/1220273). ...

  3. Codeoforces 558 B. Duff in Love

    //   B. Duff in Love time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

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

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

  5. 【LCA】CodeForce #326 Div.2 E:Duff in the Army

    C. Duff in the Army Recently Duff has been a soldier in the army. Malek is her commander. Their coun ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

  10. 达夫设备/达夫算法(Duff's Device)

    主要是下面的代码: register n = (count + 7) / 8;   /\* count > 0 assumed \*/ switch (count % 8) { case 0:  ...

随机推荐

  1. [C#]使用Redis来存储键值对(Key-Value Pair)

    本文为原创文章.源代码为原创代码,如转载/复制,请在网页/代码处明显位置标明原文名称.作者及网址,谢谢! 开发工具:VS2017 语言:C# DotNet版本:.Net FrameWork 4.5及以 ...

  2. DedeCMS V5.7开启memcache缓存的方法配置说明

    一.安装Memcache服务:1.1.linux下的Memcache安装:-------------------------1. 下载 memcache的linux版本,注意 memcached 用 ...

  3. JavaScript获取数组最小值和最大值的方法

    本文实例讲述了JavaScript获取数组最小值和最大值的方法.分享给大家供大家参考.具体如下: ? 1 2 3 4 5 6 var arr = new Array(); arr[0] = 100; ...

  4. Debian安装fail2ban来防止扫描

    vps的root密码不要设置的太简单,这样很容易被攻破,你可以安装如下软件来降低vps被攻破的机会. 输入如下命令: apt-get install fail2ban 提示如下表示安装完成: root ...

  5. Java笔记:字符串详解

    字符串详解 更新时间:2018-1-6 21:20:39 String 字符串创建 String str1="ABC";//推荐使用 String str2 = new Strin ...

  6. Git上传项目到GitHub

    1.注册账户 https://github.com/ 2.创建仓库 3.需要安装 Git   http://msysgit.github.com/ 4.本地创建ssh key(不是必要,不创建ssh可 ...

  7. HTML5本地存储应用sessionStorage和localStorage

    在html5之前,浏览器要实现数据的存储,一般都是用cookie,但是cookie有域名和大小限定. html5流行之后,可以通过localStorage和sessionStorage实现浏览器端的数 ...

  8. NOTIC: Invalid argument supplied for foreach()

    NOTIC: [2] Invalid argument supplied for foreach() Warning: Invalid argument supplied for foreach() ...

  9. Nginx集群之SSL证书的WebApi身份验证

    目录 1       大概思路... 1 2       Nginx集群之SSL证书的WebApi身份验证... 1 3       AuthorizeAttribute类... 2 4       ...

  10. kotlin的方言(语法糖)

    概述 之前介绍了kotlin的快速入门,http://www.cnblogs.com/lizo/p/7231167.html 大多数还是参照java.kotlin中提供了更多更方便的语言特性 这个方言 ...