# Daily Coding Challenge #81

This is a series of Daily Coding Challenge. Each day I show a few solutions written in C++. The questions are from coding practice/contest sites such as HackerRank, LeetCode, Codeforces, Atcoder and etc.

/*
Codeforces Round #660 (Div. 2) - A. Captain Flint and Crew Recruitment
https://codeforces.com/contest/1388/problem/A
*/

#include <bits/stdc++.h>
using namespace std;
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
typedef long long ll;
const ll MOD = 1000000007;

void solve(){
int n; cin >> n;
if (n<=30) {
// the first 3 nearly prime numbers are 6,10 and 14
// so n<=6+10+14 is NO
printf("NO\n");
} else {
printf("YES\n");
int k=n-30;
if (k==6||k==10||k==14) {
// since we need 4 different numbers
// if k is either 6,10 or 14, take n-31 instead
k=n-31;
printf("6 10 15 %d\n", k);
} else {
// else just print 6 10 14 n-k
printf("6 10 14 %d\n", k);
}
}
}

int main()
{
FAST_INP;
int t;
cin >> t;
while(t--){
solve();
}
return 0;
}


/*
Codeforces Round #660 (Div. 2) - B. Captain Flint and a Long Voyage
https://codeforces.com/contest/1388/problem/B
*/

#include <bits/stdc++.h>
using namespace std;
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
typedef long long ll;
const ll MOD = 1000000007;

void solve(){
int n; cin >> n;
// max r - when at least 4*x-3 digits are removed
// 4*x-3<=n
// x<=(n+3)/4
int x=(n+3)/4;
for(int i=0;i<n-x;i++) printf("9");
for(int i=0;i<x;i++) printf("8");
printf("\n");
}

int main()
{
FAST_INP;
int t;
cin >> t;
while(t--){
solve();
}
return 0;
}
//
//n=5
//99999
//10011001100110011001
//100110011001100-----
//99988
//10011001100110001000
//100110011001100-----


The source code is available in corresponding repo below. Star and watch for timely updates!

## wingkwong / atcoder

### Discussion   