본문 바로가기
알고리즘/Codeforces

Codeforces Round #660 (Div. 2) AB

by 유시은 2020. 8. 6.
from sys import stdin
T=int(stdin.readline())
for _ in range(T):
    n=int(stdin.readline())
    if n<=30:
        print("NO")
    else:
        if n-30!=6 and n-30!=10 and n-30!=14:
            print("YES")
            print("6 10 14",n-30)
        else:
            if n==36:
                print("YES")
                print("5 6 10 15")
            elif n==40:
                print("YES")
                print("6 9 10 15")
            elif n==44:
                print("YES")
                print("6 7 10 21")
            else:
                print("NO")

 

A - Captain Flint and Crew Recruitment

 

from sys import stdin
T=int(stdin.readline())
for _ in range(T):
    n=int(stdin.readline())
    print("9"*(n-((n-1)//4+1))+"8"*((n-1)//4+1))

 

B - Captain Flint and a Long Voyage

댓글