超级大水题;

只要用到一个小学用过的结论就可;能被9整除的数它的各位数相加能被9整除:

代码:

 #include<iostream>
#define maxn 1005
using namespace std;
int n,c0,c5,x;
int main()
{
cin>>n;
while(n--)
{
cin>>x;
if(x==)c0++;
else c5++;
}
if(c0==){cout<<"-1";return ;}
c5=c5-c5%;
if(c5==)cout<<"";
else
{
while(c5--)cout<<"";
while(c0--)cout<<"";
}
return ;
}
05-08 15:41