結果
| 問題 | 
                            No.1041 直線大学
                             | 
                    
| コンテスト | |
| ユーザー | 
                             horiesiniti
                         | 
                    
| 提出日時 | 2023-02-05 08:05:36 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 772 ms / 2,000 ms | 
| コード長 | 368 bytes | 
| コンパイル時間 | 185 ms | 
| コンパイル使用メモリ | 7,424 KB | 
| 実行使用メモリ | 12,416 KB | 
| 最終ジャッジ日時 | 2024-11-16 08:15:38 | 
| 合計ジャッジ時間 | 9,515 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 37 | 
コンパイルメッセージ
Syntax OK
ソースコード
def fg(p1,p2,p3)
	p2a=p2.zip(p1).map{|e| e[0]-e[1]}
	p3a=p3.zip(p1).map{|e| e[0]-e[1]}
	return p2a[0]*p3a[1]-p2a[1]*p3a[0]
end
ps=[]
n=gets.to_i
n.times{|e|
	ps<<gets.split(" ").map{|e| e.to_i}
}
ans=2
n.times{|i|
	(i+1).upto(n-1){|j|
		c=2
		n.times{|k|
			next if i==k || j==k
			if fg(ps[i],ps[j],ps[k])==0 then
				c+=1
			end
		}
		ans=[ans,c].max
	}
	
}
puts ans
            
            
            
        
            
horiesiniti