Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <fstream>
- using namespace std;
- int main()
- {
- int n,m,w;
- ifstream plik;
- plik.open("plik.txt");
- vector<int> a(n);
- vector<int> b(m);
- if(plik.good())
- {
- plik >> n >> m >> w;
- for(int i=0; i<n; i++)
- {
- plik >> a[i];
- }
- for(int i=0; i<m; i++)
- {
- plik >> b[i];
- }
- }
- else
- {
- cout << "Nie udalo sie otworzyc pliku" << endl;
- return 0;
- }
- plik.close();
- int wy=0;
- for(int i=0; i<n; i++)
- {
- for(int j=0; j<m; j++)
- {
- if(a[i]+b[j]==w)
- {
- wy++;
- }
- }
- }
- cout << wy;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement