 # What's wrong in the code?

Code-:Submission #125827023 - Codeforces
Question-:Problem - 352A - Codeforces

Anyone?

I don’t see any code there. Just a bunch of `#define` statements. You might want to share your approach as well.

It is there…just scroll down The Code if there is a problem regarding viewing-:
int main(){
ll m;
cin >> m;
vLL v;
for (int i = 0; i < m; i++)
{
ll ele;
cin >> ele;
v.pb(ele);
}
ll count=0;
for (int i = 0; i < m; i++)
{

``````            if(v[i]==0)
count++;
}
if(count==0)
cout<<"-1";
else{
sort(v.begin(), v.end(),greater<int>());
ll sum;
do
{
ll i = 0;
ll sum = 0;
do
{
sum += v[i];
if (i != v.size() - 1)
sum = sum * 10;
i++;

} while (i != v.size());
if (v.size() == 1)
{
cout << "0";
break;
}
else{
ll j=0;
v.erase(v.begin()+j);
}
} while (sum % 90 != 0);
cout << sum;}
return 0;
``````

}

The approach is also needed. It’s difficult otherwise.

1 Like

Approach is wrong.You just finding the number made by all elements of array,

Try this approah:

check divisibility by 9 and 10. for 9 check if sum of digits is divisible by 9 or not and for 10 check is there any 0 in the array.
number will be divisible by 9 if and only if number of 5's are divisible by 9.
I think It will help
1 Like

clude
using namespace std;
int main() {
int x;
float y;
cin>>x>>y;
if(x % 5 == 0 && x<=y -0.5)
y=y-x-0.5;
if(x % 5 !== 0 && x<=y -0.5)
y=y;
else
y=y;
cout<<y;
return 0;
}
what is wrong in this code?