Solve of UVA 11344: The Huge One
#include<bits/stdc++.h>
using namespace std;
int vag(string s,int n)
{
int r=0,l,i,sum;
l=s.size();
if(l==1 && s[0]=='0')
return r;
else
{
for(i=0;i<l;i++)
{
sum=r*10+(s[i]-'0');
r=sum%n;
}
return r;
}
}
int main()
{
int n,i,j,tst,k,l,arr[1000],sz;
string x;
cin>>tst;
while(tst--)
{
cin>>x;
cin>>sz;
k=0;
for(i=0;i<sz;i++)
{
cin>>arr[i];
k+=vag(x,arr[i]);
}
if(k==0)
{
cout<<x<<" - Wonderful."<<endl;
}
else
{
cout<<x<<" - Simple."<<endl;
}
}
return 0;
}
No comments:
Post a Comment