big decimal


import java.math.*;

class Solution {
    public int solution(int[] A, int[] B) {
        int size = A.length;
        
        BigDecimal C[] = new BigDecimal[size];
        
        for(int i=0; i< size; i++) {
            C[i] = BigDecimal.valueOf(A[i]).add(BigDecimal.valueOf((double)B[i]/1_000_000));
        }
        
        int count =0;
        
        for (int i=0; i<size; i++) {
            for(int j = i+1; j<size; j++) {
                if(C[i].multiply(C[j]).compareTo(C[i].add(C[j])) >= 0)
                count ++;                
                if (count > 1000_000_000) return 1000_000_000;
            }
        }
        
        return count;
    }

}


            NSLog(@"cd_dong ascending:YES");

            cd = @"동/호수 오름차순";
            NSLog(@"cd_dong ascending:NO");
            cd = @"동/호수 내림차순";


            NSLog(@"cd_dong ascending:NO");
            cd = @"등록일자 오름차순";


            NSLog(@"cd_dong ascending:NO");
            cd = @"등록일자 내림차순";



    NSMutableArray *sortedArray = [NSMutableArray arrayWithCapacity:[mList count]];
    

//    UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"TEST" message:@"subview" delegate:nil cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil];
//    [av setValue:v  forKey:@"accessoryView"];
//    [av show];

NSDictionary* stringAttrs = @{ UITextAttributeFont : font, UITextAttributeTextColor : textColor };
NSDictionary* stringAttrs = @{ UITextAttributeFont : font, NSForegroundColorAttributeName : textColor };

NSDictionary* stringAttrs = @{ NSFontAttributeName : font, NSForegroundColorAttributeName : textColor };

//    CGContextRef context = UIGraphicsGetCurrentContext();
    //    CGContextSetLineWidth(context, 4.0);
    //    CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);
    //    self.view.backgroundColor = [UIColor redColor];
    //    CGRect r = CGRectMake(0, image.size.height - 80, image.size.width, image.size.height - 50);

B
[UIColor colorWithRed:0.71372549 green:0.21568627 blue:0.2 alpha:1.0];

E
[UIColor colorWithRed:0.792156 green:0.5607843 blue:0.3098039 alpha:1.0];

X
[UIColor colorWithRed:0.49411764 green:0.6196078 blue:0.30196078 alpha:1.0];




    //    UIView *myBox  = [[UIView alloc] initWithFrame:CGRectMake(180, 35, 200, 100)];
    //    myBox.backgroundColor = [UIColor lightGrayColor];
    //    [personsArray addObject:myBox];
    ////    [mainPanel addSubview:myBox];
    //
    //
    //    UIView *myBox2  = [[UIView alloc] initWithFrame:CGRectMake(380, 35, 200, 100)];
    //    myBox2.backgroundColor = [UIColor lightGrayColor];
    //    [personsArray addObject:myBox2];
    //
    
    //background Image
    //    UIGraphicsBeginImageContext(self.view.frame.size);
    //    [[UIImage imageNamed:@"apartment.jpg"] drawInRect:self.view.bounds];
    //    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    //    UIGraphicsEndImageContext();
    //    mainPanel.backgroundColor = [UIColor colorWithPatternImage:image];
    













- (void)saveToAlbum:(UIImage *)image {
    NSString *albumName = @"MBASS";

    void (^saveBlock)(PHAssetCollection *assetCollection) = ^void(PHAssetCollection *assetCollection) {
        [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
            PHAssetChangeRequest *assetChangeRequest = [PHAssetChangeRequest creationRequestForAssetFromImage:image];
            PHAssetCollectionChangeRequest *assetCollectionChangeRequest = [PHAssetCollectionChangeRequest changeRequestForAssetCollection:assetCollection];
            [assetCollectionChangeRequest addAssets:@[[assetChangeRequest placeholderForCreatedAsset]]];

        } completionHandler:^(BOOL success, NSError *error) {
            if (!success) {
                NSLog(@"Error creating asset: %@", error);
            }
        }];
    };

    PHFetchOptions *fetchOptions = [[PHFetchOptions alloc] init];
    fetchOptions.predicate = [NSPredicate predicateWithFormat:@"localizedTitle = %@", albumName];
    PHFetchResult *fetchResult = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAny options:fetchOptions];
    if (fetchResult.count > 0) {
        saveBlock(fetchResult.firstObject);
    } else {
        __block PHObjectPlaceholder *albumPlaceholder;
        [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
            PHAssetCollectionChangeRequest *changeRequest = [PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:albumName];
            albumPlaceholder = changeRequest.placeholderForCreatedAssetCollection;

        } completionHandler:^(BOOL success, NSError *error) {
            if (success) {
                PHFetchResult *fetchResult = [PHAssetCollection fetchAssetCollectionsWithLocalIdentifiers:@[albumPlaceholder.localIdentifier] options:nil];
                if (fetchResult.count > 0) {
                    saveBlock(fetchResult.firstObject);
                }
            } else {
                NSLog(@"Error creating album: %@", error);
            }
        }];
    }
}

NSUserDomainMask
// 선택한 로우가 몇번째인지

       
            NSString *query = [NSString stringWithFormat:@" \
                               with t_dfct as ( \
                               select a.cd_dong, a.cd_flor, a.ho, \
                               sum(case b.cd_hndl_stat when 'B' then 1 else 0 end ) as cnt_b, \
                               sum(case b.cd_hndl_stat when 'E' then 1 else 0 end ) as cnt_e, \
                               sum(case b.cd_hndl_stat when 'X' then 1 else 0 end ) as cnt_x from ddtbt_hosh a \
                               left outer join ddtbt_dfct b \
                               on b.cd_dong = a.cd_dong \
                               and b.nohs = a.nohs \
                               and b.id_dfct_ctyp like '%@' \
                               where a.cd_dong = '%@' \
                               group by a.cd_dong, a.cd_flor, a.ho \
                               ) \
                               select cd_dong, cd_flor, ho, \
                               case when (cnt_b + cnt_e) > 0 \
                               then case cnt_x when 0 then 'R' else 'Y' end \
                               else 'G' \
                               end cl_stat \
                               from t_dfct \
                               order by cd_flor desc, ho asc;"



'Blog History' 카테고리의 다른 글

137  (0) 2020.04.06
136  (0) 2020.04.06
182  (0) 2020.03.29
134  (0) 2020.03.29
133  (0) 2020.03.29

+ Recent posts