123456789101112131415161718192021222324class Solution {public: int maxPoints(vector<vector<int>>& points){ int N =points.size(); if(N == 1) return 1; if(N == 2) return 2; int ans = 2; for(int i = 0; i < N; i++){ unordered_map<long double, int> mp; for(int j = 0; j < N; j++){ if(i == j) continue; if(points[i][0] == points[j][0]) mp[1e9]++; else{ long double tmp = ((long double)points[j][1] - (long double)points[i][1]) / ((long double)points[j][0]-(long double)points[i][0]); mp[tmp]++; } } for(auto [k, v]: mp){ ans = max(ans, v+1); } } return ans; }};Colored by Color Scriptercs
댓글 영역
획득법
① NFT 발행
작성한 게시물을 NFT로 발행하면 일주일 동안 사용할 수 있습니다. (최초 1회)
② NFT 구매
다른 이용자의 NFT를 구매하면 한 달 동안 사용할 수 있습니다. (구매 시마다 갱신)
사용법
디시콘에서지갑연결시 바로 사용 가능합니다.