From 1e36fff7c959a9de7be06c93bf4d31ade0527243 Mon Sep 17 00:00:00 2001 From: Shivam Bindal <83772489+Shivam10025@users.noreply.github.com> Date: Tue, 4 Oct 2022 10:45:52 +0530 Subject: [PATCH] Add files via upload --- .../1715_B_beutifull_array.cpp | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 800 Codeforces Solutions/1715_B_beutifull_array.cpp diff --git a/800 Codeforces Solutions/1715_B_beutifull_array.cpp b/800 Codeforces Solutions/1715_B_beutifull_array.cpp new file mode 100644 index 0000000..d8edcd7 --- /dev/null +++ b/800 Codeforces Solutions/1715_B_beutifull_array.cpp @@ -0,0 +1,41 @@ +#include +#define int long long +using namespace std; +int32_t main(){ + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int e; + cin>>e; + while (e--){ + int n , k, b , s; + cin>>n>>k>>b>>s; + int z=s-(b*k); + if(s/k==b){ + for(int i=0;i=0; i--){ + if(z>k-1){ + a[i]+=k-1; + z-=(k-1); + } + else{ + if(z!=0){ + a[i]+=z; + z=0; + } + } + } + for(int i=0;i