当前位置:网站首页>D. Game With Array
D. Game With Array
2022-06-11 21:42:00 【whitewall_ nine】
// Problem: D. Game With Array
// Contest: Codeforces - Codeforces Round #643 (Div. 2)
// URL: https://codeforces.com/problemset/problem/1355/D
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// 2022-03-01 16:35:40
//
// Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i=(l);i<=(r);i++)
#define per(i,l,r) for(int i=(l);i>=(r);i--)
#define ll long long
#define pii pair<int, int>
#define mset(s,t) memset(s,t,sizeof(t))
#define mcpy(s,t) memcpy(s,t,sizeof(t))
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define mp make_pair
const ll mod = 1e9 + 7;
inline ll qmi (ll a, ll b) {
ll ans = 1;
while (b) {
if (b & 1) ans = ans * a%mod;
a = a * a %mod;
b >>= 1;
}
return ans;
}
inline int read () {
int x = 0, f = 0;
char ch = getchar();
while (!isdigit(ch)) f |= (ch=='-'),ch= getchar();
while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
return f?-x:x;
}
template<typename T> void print(T x) {
if (x < 0) putchar('-'), x = -x;
if (x >= 10) print(x/10);
putchar(x % 10 + '0');
}
inline ll sub (ll a, ll b) {
return ((a - b ) %mod + mod) %mod;
}
inline ll add (ll a, ll b) {
return (a + b) %mod;
}
inline ll inv (ll a) {
return qmi(a, mod - 2);
}
void solve() {
int n, s;
cin >> n >> s;
if (n == 1) {
if (s == 1) cout << "NO\n";
else {
cout << "YES\n";
cout << s << endl;
cout << 1 << endl;
}
}
else {
int k = s / n;
if (k == 1) {
puts("NO");
}
else {
puts("YES");
int r = s % n;
for (int i = 0; i < n - 1; i++)
cout << k << " ";
cout << k + r << endl;
cout << k - 1 << endl;
}
}
}
int main () {
int t;
t =1;
//cin >> t;
while (t --) solve();
return 0;
}
Look at the small one first , such as 1, Then distribute as evenly as possible , As long as there is a 1 Then you can't win . Or you can win
边栏推荐
- Software test plan
- 线性表的链式存储结构
- Refresh and upgrade | innovation, starting from cloud store
- LaTex实战笔记 3-宏包与控制命令
- 实现 TabLayout 下标与文字等长,选中字体大小改变
- Diary at 16:29:41 on June 9, 2022
- Customer information management software
- Iros 2021 | new idea of laser vision fusion? Lidar intensity diagram +vpr
- Codeforces Round #744 (Div. 3) 解题报告
- Release of version 5.6 of rainbow, add multiple installation methods, and optimize the topology operation experience
猜你喜欢

Leetcode-110-balanced binary tree

UML系列文章(29)体系结构建模---模式和框架

EndnoteX9簡介及基本教程使用說明

LabVIEW Arduino electronic weighing system (project Part-1)

LeetCode-98-验证二叉搜索树

领先企业推进智慧财务的同款效率工具,赶快了解一下?

Why is rpa+ low code a powerful tool to accelerate the digital transformation of finance?

RPA+低代码助推品牌电商启新创变、重启增长

Master of a famous school has been working hard for 5 years. AI has no paper. How can the tutor free range?

「大模型」之所短,「知识图谱」之所长
随机推荐
Experiment 10 Bezier curve generation - experiment improvement - control point generation of B-spline curve
LeetCode-98-验证二叉搜索树
Common file functions
Builder pattern
Codeforces Round #742 (Div. 2) F. One-Four Overload
Answer fans' questions | count the number and frequency of letters in the text
JS performs non empty judgment on various data types of the returned data.
Why is rpa+ low code a powerful tool to accelerate the digital transformation of finance?
Diary at 16:29:41 on June 9, 2022
2021牛客多校5 Double Strings
JUnit tests multithreaded code, and the sub thread does not run
Customer information management software
Expérience 10 génération de courbes bezier - amélioration expérimentale - génération de courbes B - spline par point de contrôle
Endnotex9 introduction and basic tutorial instructions
线性表的链式存储结构
实现 TabLayout 下标与文字等长,选中字体大小改变
ESP32C3 Arduino库使用方法
Codeforces Round #744 (Div. 3) 解题报告
如何使用事物码 SAT 查找某个 SAPGUI 屏幕字段对应的后台存储数据库表的名称
Release of version 5.6 of rainbow, add multiple installation methods, and optimize the topology operation experience