网站功能开发费用多少钱,seo求职,宜昌广告制作公司,网页的后台管理系统传送门
题意#xff1a; 找出ABnABnABn并且lcm(A,B)\operatorname{lcm}(A,B)lcm(A,B)最小的AAA和BBB。
思路#xff1a; nnn为偶数的时候答案肯定为都是n2\frac{n}{2}2n。当nnn为奇数的时候#xff0c;我们假设xxx为nnn的一个因子#xff0c;那么nmodx0n \bmod x0nmo…传送门
题意 找出ABnABnABn并且lcm(A,B)\operatorname{lcm}(A,B)lcm(A,B)最小的AAA和BBB。
思路 nnn为偶数的时候答案肯定为都是n2\frac{n}{2}2n。当nnn为奇数的时候我们假设xxx为nnn的一个因子那么nmodx0n \bmod x0nmodx0 且 (n−x)modx0(n-x) \bmod x0(n−x)modx0 那么lcm(x,n−x)n−x\operatorname{lcm}(x,n-x)n-xlcm(x,n−x)n−x我们要让lcm\operatorname{lcm}lcm尽可能小就需要让xxx尽可能大所以只需要找nnn最大因子即可。
//#pragma GCC optimize(2)
#includecstdio
#includeiostream
#includestring
#includecstring
#includemap
#includecmath
#includecctype
#includevector
#includeset
#includequeue
#includealgorithm
#includesstream
#includectime
#includecstdlib
#define X first
#define Y second
#define L (u1)
#define R (u1|1)
#define pb push_back
#define mk make_pair
#define Mid (tr[u].ltr[u].r1)
#define Len(u) (tr[u].r-tr[u].l1)
#define random(a,b) ((a)rand()%((b)-(a)1))
#define db puts(---)
using namespace std;//void rd_cre() { freopen(d://dp//data.txt,w,stdout); srand(time(NULL)); }
//void rd_ac() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//AC.txt,w,stdout); }
//void rd_wa() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//WA.txt,w,stdout); }typedef long long LL;
typedef unsigned long long ULL;
typedef pairint,int PII;const int N1000010,mod1e97,INF0x3f3f3f3f;
const double eps1e-6;int n;int main()
{
// ios::sync_with_stdio(false);
// cin.tie(0);int _; scanf(%d,_);while(_--){scanf(%d,n);if(n%20) printf(%d %d\n,n/2,n/2);else{int ans-1;for(int i2;in/i;i)if(n%i0){ansi;break;}if(ans-1) ans1;else ansn/ans;printf(%d %d\n,ans,n-ans);}}return 0;
}
/**/