daily pastebin goal
80%
SHARE
TWEET

teste

a guest Jan 21st, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.  
  7. int n,m,k,ai,ho[100001],mu[100001];
  8.     while(cin>>n>>m>>k){
  9.         memset(mu,0,sizeof mu);
  10.         for(int i = 0; i < n; i++){
  11.             cin>>ho[i];
  12.         }
  13.         for(int i = 0; i < m; i++){
  14.             cin>>ai;
  15.             mu[ai%k]++;
  16.         }
  17.  
  18.         int ans = 0;
  19.         for(int i = 0; i < n; i++){
  20.             ans+=mu[(k-(ho[i]%k))%k];
  21.         }
  22.         cout<<ans<<endl;
  23.     }
  24.     return 0;
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top