Home 코드포시스
Post
Cancel

코드포시스

3줄 요약
알고리즘 처음 접근하게 된다면 연습하기에 가장 적절하다고 생각되는 문제이다.
조건?
풀이

알고리즘 시작

04번 문제 가장 처음으로 낸 800점 문제

알고리즘을 풀기 위한 조건

여기서 한 눈에 알수있는 주어진 조건은

time limit per test:1 second memory limit per test:64 megabytes

시간 제한은 1초이고, 메모리 제한은 64메가 바이트 이내에 들어야 통과가 된다.

테스트 케이스는 하나 즉 8을 입력했을 때 YES가 나와야 accept가 나온다.

이중 중요하게 봐야 될 것은.

They chose the biggest and the ripest one, in their opinion조걵과

divide the watermelon in such a way that each of the two parts weighs even number of kilos이다.

input과 output 조건 보기.

input 에는 The first (and the only) input line contains integer number w (1 ≤ w ≤ 100) — the weight of the watermelon bought by the boys.

즉 w의 조건은 1 에서 100 이하의 값만 들어간다고 보면 된다.

1
2
3
4
5
6
7
8
9
10
11
12
import sys;

input = sys.stdin.in

def solution(){
        w = int(input())
    if w % 2 == 0 and w > 2:
        print("YES")
    else:
        print("NO")
}
solution() 

꼼수로 풀기.

저 조건에 만족하는 식은

This post is licensed under CC BY 4.0 by the author.