猜数

  这题我是这样分析的……

  $a*b=g*l=n=k^2 \ and \ (g|a,g|b) \Rightarrow (g*a')*(g*b' )=g*l=k^2 \\ \Rightarrow a' * b' =\frac{l}{g}=(\frac{k}{g})^2  \Rightarrow min(a'+b')=2* \sqrt{\frac{l}{g}}, max(a'+b')=1+\frac{l}{g}$

  然而算ans的时候还需要再乘g……我给忘了【UOJ Easy Round #1】

 1 //UOJ Easy Round1 A
 2 #include<vector>
 3 #include<cmath>
 4 #include<cstdio>
 5 #include<cstring>
 6 #include<cstdlib>
 7 #include<iostream>
 8 #include<algorithm>
 9 #define rep(i,n) for(int i=0;i<n;++i)
10 #define F(i,j,n) for(int i=j;i<=n;++i)
11 #define D(i,j,n) for(int i=j;i>=n;--i)
12 using namespace std;
13 typedef long long LL;
14 const int N=1e5+10;
15 /*******************template********************/
16 
17 LL n,g,l;
18 int main(){
19 #ifndef ONLINE_JUDGE
20     freopen("A.in","r",stdin);
21     freopen("A.out","w",stdout);
22 #endif 
23     int T; scanf("%d",&T);
24     while(T--){
25         scanf("%lld%lld",&g,&l);
26         printf("%lld %lld\n",2*(LL)sqrt(l/g)*g,l+g);
27     }
28     return 0;
29 }
View Code

相关文章:

  • 2021-11-23
  • 2021-10-14
  • 2022-12-23
  • 2021-09-13
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
猜你喜欢
  • 2021-12-04
  • 2021-12-21
  • 2021-05-19
  • 2022-12-23
  • 2022-02-01
  • 2021-11-05
  • 2021-08-06
相关资源
相似解决方案