Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate.

The path consists of nn consecutive tiles, numbered from 11 to nn. Ujan will paint each tile in some color. He will consider the path aesthetic if for any two different tiles with numbers ii and jj, such that |j−i||j−i| is a divisor of nn greater than 11, they have the same color. Formally, the colors of two tiles with numbers ii and jj should be the same if |i−j|>1|i−j|>1 and nmod|i−j|=0nmod|i−j|=0 (where xmodyxmody is the remainder when dividing xx by yy).

Ujan wants to brighten up space. What is the maximum number of different colors that Ujan can use, so that the path is aesthetic?

Input

The first line of input contains a single integer nn (1≤n≤10121≤n≤1012), the length of the path.

Output

Output a single integer, the maximum possible number of colors that the path can be painted in.

Examples
input

Copy
4
output

Copy
2
input

Copy
5
output

Copy
5
Note

In the first sample, two colors is the maximum number. Tiles 11 and 33 should have the same color since 4mod|3−1|=04mod|3−1|=0. Also, tiles 22and 44 should have the same color since 4mod|4−2|=04mod|4−2|=0.

In the second sample, all five colors can be used.

#include<bits/stdc++.h>
using namespace std;
int main(){
long long n;cin>>n;
int flag = ;
long long num = n;
for(long long i=;i*i<=n;i++){
if(n%i==){
num=__gcd(num,i);
num=__gcd(num,n/i);
}
}
cout<<num<<endl;
}
//求除1以外所以因子的最大公约数
/*我们枚举n的所有的因子 a[1],a[2],a[3]....a[x]。
翻译过来就是我们每a[1]个,都得相同;每a[2]个都得相同;....;每a[x]个都得相同。
那么实际上这个东西的循环节就等于他们的最小公倍数。
那么最多个颜色就是n/lcm,实际上就是gcd。因为gcd x lcm = n */

Codeforces Round #599 (Div. 2) C. Tile Painting的更多相关文章

  1. Codeforces Round #599 (Div. 1) A. Tile Painting 数论

    C. Tile Painting Ujan has been lazy lately, but now has decided to bring his yard to good shape. Fir ...

  2. Codeforces Round #599 (Div. 2) D. 0-1 MST(bfs+set)

    Codeforces Round #599 (Div. 2) D. 0-1 MST Description Ujan has a lot of useless stuff in his drawers ...

  3. Codeforces Round #599 (Div. 2)

    久违的写篇博客吧 A. Maximum Square 题目链接:https://codeforces.com/contest/1243/problem/A 题意: 给定n个栅栏,对这n个栅栏进行任意排 ...

  4. Codeforces Round #599 (Div. 2) Tile Painting

    题意:就是给你一个n,然后如果  n mod | i - j | == 0  并且 | i - j |>1 的话,那么i 和 j 就是同一种颜色,问你最大有多少种颜色? 思路: 比赛的时候,看到 ...

  5. Codeforces Round #353 (Div. 2) B. Restoring Painting 水题

    B. Restoring Painting 题目连接: http://www.codeforces.com/contest/675/problem/B Description Vasya works ...

  6. Codeforces Round #461 (Div. 2) C. Cave Painting

    C. Cave Painting time limit per test 1 second memory limit per test 256 megabytes Problem Descriptio ...

  7. Codeforces Round #599 (Div. 2)D 边很多的只有0和1的MST

    题:https://codeforces.com/contest/1243/problem/D 分析:找全部可以用边权为0的点连起来的全部块 然后这些块之间相连肯定得通过边权为1的边进行连接 所以答案 ...

  8. Codeforces Round #599 (Div. 2) E. Sum Balance

    这题写起来真的有点麻烦,按照官方题解的写法 先建图,然后求强连通分量,然后判断掉不符合条件的换 最后做dp转移即可 虽然看起来复杂度很高,但是n只有15,所以问题不大 #include <ios ...

  9. Codeforces Round #599 (Div. 1) C. Sum Balance 图论 dp

    C. Sum Balance Ujan has a lot of numbers in his boxes. He likes order and balance, so he decided to ...

随机推荐

  1. 《深入理解java虚拟机》读书笔记一——第二章

    第二章 Java内存区域与内存溢出异常 1.运行时数据区域 程序计数器: 当前线程所执行的字节码的行号指示器,用于存放下一条需要运行的指令. 运行速度最快位于处理器内部. 线程私有. 虚拟机栈: 描述 ...

  2. Vue快速认识

    1.Vue入门初识 1.1 Vue.js是什么? 一位华裔前Google工程师(尤雨溪)开发的前端js库 作用: 动态构建用户界面 特点: 遵循MVVM模式 编码简洁, 体积小, 运行效率高, 移动/ ...

  3. Linux之温故知新2

    1.关于ssh免密码登陆的ssh-keygen, ssh-copy-id的使用, 然后使用ssh-copy-id user@remote将公钥传给服务器, 以及别名 1 C:\Users\linxmo ...

  4. python中一些相似用法的区别:index()和find(),dict[]和get()

    index和find在字符串中的区别: index()方法和find()方法相似,唯一的区别就是find方法不包含索引值会返回-1,而index()不包含索引值会抛出异常   同样的:获取字典dict ...

  5. JavaScript的HelloWorld创建

    JavaScript JavaScript(简写为JS)是一门世界上最流行的脚本语言. ECMAScript是JavaScript的一个标准,最新版本到es6版本. 但是开发环境和线上环境存在版本不一 ...

  6. WMITools修复wmi劫持--hao643.com/jtsh123劫持(修改快捷方式跳转至hao123.com)

    >症状:所有浏览器快捷方式,都被加上尾巴,例如IE的:"C:\Program Files\Internet Explorer\iexplore.exe" http://hao ...

  7. Django_发邮件

    1. 设置项

  8. Python之路Day07

    基础数据类型补充 str s.capitalize() -- 首字母大写 s.title() -- 每个单词首字母大写 s.swapcase() -- 大小写转换 s.center() -- 居中/填 ...

  9. jQuery func

    1.  $(selector).each(function(index,element)); -----------index 选择器的index位置,element --当前的元素 2. _.eac ...

  10. amazon 1

    # 跨境电商 Amazon 丰富强大的海外站 开店流程 https://www.cifnews.com/article/48921 注册事项以及二审怎么过 https://www.cifnews.co ...