Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int k,a,n;
- long long I=0;
- cin>>k >>n;
- int niza1[n],niza2[n];
- long long brojac[105];
- for(int i = 0; i <= 100; i++) {
- brojac[i] = 0;
- }
- for(int i=0;i<n;i++)
- {
- cin>>niza1[i];
- }
- for(int j=0;j<n;j++)
- {
- cin>>niza2[j];
- brojac[niza2[j]]++;
- }
- for(int i = 0; i < n; i++) {
- int fali = k - niza1[i];
- if(fali < 0) {
- fali = 0;
- }
- for(int j = fali; j <= 100; j++) {
- I += brojac[j];
- }
- }
- cout << I << endl;
- return 0;
- }
- /*
- 4 5
- 7 5 3 4 2
- 4 3 2 2 1
- 2, 3, 4, 5, 7
- 1, 2, 2, 3, 4
- 4 + 5 + 5 + 5 + 5 = 24
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement