Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bits/stdc++.h>
- using namespace std;
- int num (string s , int p)
- {
- int n = 0;
- for(int i = 0; i < s.length(); i++)
- {
- n = n * 10 + s[i] - '0';
- n = n % p;
- }
- return n;
- }
- int main()
- {
- int tes, x , a;
- string s1;
- bool k = false;
- cin >> tes;
- while(tes--)
- {
- cin >> s1;
- cin >> x;
- int c = 0;
- for(int i = 0; i < x; i++)
- {
- cin >> a;
- if(num(s1 , a) == 0)
- {
- c++;
- }
- }
- if(c == x)
- cout<<s1<<" - Wonderful."<<endl;
- else
- cout<<s1<<" - Simple."<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement