From 79007834880f5f267f84cf6ab8c6e0ea5ca8ba10 Mon Sep 17 00:00:00 2001 From: ShazidMahsrafi Date: Tue, 25 Jun 2024 04:17:22 +0600 Subject: [PATCH] added alternate code to 1986D --- .../1986D (2).cpp | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Codes/1986 D - Mathematical Problem/1986D (2).cpp diff --git a/Codes/1986 D - Mathematical Problem/1986D (2).cpp b/Codes/1986 D - Mathematical Problem/1986D (2).cpp new file mode 100644 index 0000000..073358b --- /dev/null +++ b/Codes/1986 D - Mathematical Problem/1986D (2).cpp @@ -0,0 +1,63 @@ +#include +using namespace std; +#ifdef ONLINE_JUDGE +#define dbg(...) +#else +#include "Assets/debug.h" +#endif +#define int long long +#define ll long long +#define endl '\n' +#define all(x) x.begin(), x.end() +#define sz(x) (int)(x).size() +#define yes cout << "YES" << endl +#define no cout << "NO" << endl +#define rep(i,a,b) for(int i=a; i=b; --i) +#define pb push_back +#define ppb pop_back +#define in insert +#define FAST (ios_base::sync_with_stdio(false), cin.tie(nullptr)); +ll pow(ll x,ll y,ll m=1e9+7){ll ans=1;x%=m;while(y){if(y&1)ans=(ans*x)%m;x=(x*x)%m;y>>=1;}return ans;} + +void solve() +{ + int n; + string s; + cin>>n>>s; + if(n==2) + { + cout<v; + int sum=0; + rep(j,0,i) v.pb(s[j]-'0'); + v.pb(stoi(s.substr(i,2))); + rep(j,i+2,n) v.pb(s[j]-'0'); + sort(all(v)); + if(v[0]==0) mn=0; + for(auto x:v) + { + if(x!=1) sum+=x; + } + if(sum==0) sum=1; + mn = min(mn, sum); + } + cout<> TCS; + for (int TC = 1; TC <= TCS; ++TC) + { + // cout<<"Case "<