Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- #include<algorithm>
- using namespace std;
- struct Computer {
- string presa;
- int potenza;
- };
- int main ( void ) {
- int numeroComputer, numeroPrese;
- vector <int> potenzeL10;
- vector <int> potenzeL16;
- cin >> numeroComputer >> numeroPrese;
- vector<Computer> computers ( numeroComputer );
- for ( int i = 0; i < numeroComputer; i++ )
- cin >> computers[i].potenza;
- for ( int i = 0; i < numeroComputer; i++ )
- cin >> computers[i].presa;
- for ( int i = 0; i < numeroComputer; i++ ) {
- if ( computers[i].presa == "L10" )
- potenzeL10.push_back ( computers[ i ].potenza );
- if ( computers[i].presa == "L16" )
- potenzeL16.push_back ( computers[ i ].potenza );
- }
- sort ( potenzeL10.begin(), potenzeL10.end() );
- sort ( potenzeL16.begin(), potenzeL16.end() );
- int numeroPreseL10 = 0;
- int numeroPreseL16 = 0;
- int numeroPreseBipasso = 0;
- for ( int i = 0; i < numeroPrese; i++ ) {
- string presa;
- cin >> presa;
- if ( presa == "L10" )
- numeroPreseL10++;
- if ( presa == "L16" )
- numeroPreseL16++;
- if ( presa == "bipasso" )
- numeroPreseBipasso++;
- }
- cout << "Prese L10: " << numeroPreseL10 << endl;
- cout << "Prese L16: " << numeroPreseL16 << endl;
- cout << "Prese bipasso: " << numeroPreseBipasso << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement