Pabon_SEC

The Huge One

Mar 8th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int arr[15];
  6.  
  7. int main()
  8. {
  9.  
  10.     ios_base::sync_with_stdio(0);
  11.  
  12.     cin.tie(0);
  13.  
  14.     int test,i,j,k,len,n;
  15.  
  16.     string s;
  17.  
  18.     cin>>test;
  19.  
  20.     for(i=1;i<=test;i++)
  21.     {
  22.         cin>>s;
  23.  
  24.         len = s.length();
  25.  
  26.         cin>>n;
  27.  
  28.         int rem=0,tag=0;
  29.  
  30.         for(j=1;j<=n;j++)
  31.         {
  32.             cin>>arr[j];
  33.         }
  34.  
  35.         for(j=1;j<=n;j++)
  36.         {
  37.             for(k=0;k<len;k++)
  38.             {
  39.                 rem = ((rem*10)+s[k]-'0')%arr[j];
  40.             }
  41.  
  42.             if(rem)
  43.             {
  44.                 tag = 1;
  45.                 break;
  46.             }
  47.         }
  48.  
  49.         if(!tag)
  50.         {
  51.             cout<<s<<" - Wonderful.\n";
  52.         }
  53.         else
  54.         {
  55.             cout<<s<<" - Simple.\n";
  56.         }
  57.     }
  58.  
  59.     return 0;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment