9020_골드바흐의_추측
By 박력돌이 | 2020년 2월 18일 |
C#으로 통과한 소스를 기록으로 남겨둔다. 핵심: 1) 에라토스테네스의 체로 소수를 구할 때 for문의 종료 시점을 num이 아닌 Math.Sqrt(num)으로 해서 시도 횟수를 줄인다.2) 소수 끼리 더할 때 이중 for문을 쓰지 말것, 단일 for문을 쓰고 합이 num인 소수 p의 다른 소수는 num - p이다. using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Collections;namespace _9020_골드바흐의_추측{ class Program { static void Main(string[]