HDU4627+LCM
思路是想到了一些 不过愣是没敢写。。。。。。。。。。。
1 /* 2 题意:给定一个整数n(2 <= n <= 109),满足a+b=n并且[a,b]的最小公倍数最大。 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue> 10 #include<map> 11 #include<math.h> 12 using namespace std; 13 typedef long long int64; 14 //typedef __int64 int64; 15 const int maxn = 105; 16 const int inf = 0x7fffffff; 17 const double pi=acos(-1.0); 18 const double eps = 1e-8; 19 int main(){ 20 int T; 21 scanf("%d",&T); 22 while( T-- ){ 23 int64 n; 24 scanf("%I64d",&n); 25 if( n==2 ){ 26 printf("1\n"); 27 continue; 28 } 29 int64 L,R,mid; 30 if( n%2==0 ){ 31 mid = n/2; 32 if( mid%2==0 ){ 33 L = mid-1; 34 R = mid+1; 35 } 36 else{ 37 L = mid-2; 38 R = mid+2; 39 } 40 } 41 else { 42 mid = (n+1)/2; 43 L = mid-1; 44 R = mid; 45 } 46 printf("%I64d\n",L*R); 47 } 48 return 0; 49 }
keep moving...