欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

Codeforces Round #660 (Div. 2) A. Captain Flint and Crew Recruitment

发布时间:2023/12/16 52 豆豆
生活随笔 收集整理的这篇文章主要介绍了 Codeforces Round #660 (Div. 2) A. Captain Flint and Crew Recruitment 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

题目链接

思路:

先算出来最小的三个近似质数,那么所组成的和最小就是31,小于31的都不能组成,另外因为不能重复,所以,36,40,44,都要特判一下,把14换成15就行了。

代码:

#include<bits/stdc++.h> #define int long long #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); const int N=1e5+5; const int M=2e4+5; const double eps=1e-8; const int mod=1e9+7; const int inf=0x7fffffff; const double pi=3.1415926; using namespace std; signed main() {int t;cin>>t;while(t--){int n,a,b,c,d;cin>>n;a=6;b=10;c=14;d=30;d=n-30;if(d==a||d==b||d==c){c=15;d-=1;cout<<"YES"<<endl;cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;}else if(d>0){cout<<"YES"<<endl;cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;}else{cout<<"NO"<<endl;}}return 0; }

总结

以上是生活随笔为你收集整理的Codeforces Round #660 (Div. 2) A. Captain Flint and Crew Recruitment的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。