import java.util.Arrays;
public class TryHelloWorld
{
public int getMinSum(int []A, int []B)
{
int answer = 0;
Arrays.sort(A);
Arrays.sort(B);
for(int i=0;i<B.length;i++) {
answer += A[i]*B[B.length-1-i];
}
return answer;
}
public static void main(String[] args)
{
TryHelloWorld test = new TryHelloWorld();
int []A = {1,2};
int []B = {3,4};
System.out.println(test.getMinSum(A,B));
}
}
public class Caesar { String caesar ( String s , int n ) { n %= 26 ; String result = "" ; char [] temp = s . toCharArray (); for ( int i = 0 ; i < temp . length ; i ++) { if ( temp [ i ]>= 'a' && temp [ i ]<= 'z' ) temp [ i ] = ( char ) (( temp [ i ]+ n )> 'z' ? ( temp [ i ]+ n - 1 )% 'z' + 'a' : ( temp [ i ]+ n )); else if ( temp [ i ]>= 'A' && temp [ i ]<= 'Z' ) temp [ i ] = ( char ) (( temp [ i ]+ n )> 'Z' ? ( temp [ i ]+ n - 1 )% 'Z' + 'A' : ( temp [ i ]+ n )); result += temp [ i ]; } return result ; } public static void main ( String [] args ) { Caesar c = new Caesar (); System . out . println ( "s는 'a B z', n은 4인 경우: " + c . caesar ( ...
댓글
댓글 쓰기