Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int arr[15];
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- int test,i,j,k,len,n;
- string s;
- cin>>test;
- for(i=1;i<=test;i++)
- {
- cin>>s;
- len = s.length();
- cin>>n;
- int rem=0,tag=0;
- for(j=1;j<=n;j++)
- {
- cin>>arr[j];
- }
- for(j=1;j<=n;j++)
- {
- for(k=0;k<len;k++)
- {
- rem = ((rem*10)+s[k]-'0')%arr[j];
- }
- if(rem)
- {
- tag = 1;
- break;
- }
- }
- if(!tag)
- {
- cout<<s<<" - Wonderful.\n";
- }
- else
- {
- cout<<s<<" - Simple.\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment