Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int k=0;
- int n=0;
- cin>>k;
- cin>>n;
- long long br=0;
- long long result=0;
- int niza1[n];
- int niza2[n];
- for(int i=0; i<n; i++){
- cin>>niza1[i];
- }
- for(int x=0; x<n; x++){
- cin>>niza2[x];
- }
- int brojac[101];
- int brojac1[101];
- for(int l=0; l<=100; l++){
- brojac[l]=0;
- brojac1[l]=0;
- }
- for(int l1=0; l1<n; l1++){
- int b=niza1[l1];
- brojac[b]++;
- int b1=niza2[l1];
- brojac1[b1]++;
- }
- for(int k2=0; k2<=100; k2++){
- if(brojac[k2]>0){
- int p=k-k2;
- if(p<0){
- p=0;
- }
- br=0;
- for(int l=p; l<=100; l++){
- br+=brojac1[l];
- }
- result+=brojac[k2]*br;
- }
- }
- cout<<result;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement