Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- #define ld long double
- #define pb push_back
- #define p_b pop_back
- using namespace std;
- int main(){
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- int c = 0;
- while(true){
- c++;
- int n, vol = 0, tot = 0;
- cin >> n;
- if(n == 0){
- break;
- }
- map<int, int> m;
- for(int i = 0; i < n; i++){
- int k, v;
- cin >> k >> v;
- m[v/k] += k;
- vol += v;
- tot += k;
- }
- cout << "Cidade# " << c << ":\n";
- for(auto i = m.begin(); i != m.end(); i++){
- cout << i->second << "-" << i->first << " ";
- }
- double av = 1.0*vol/tot;
- cout << "\nConsumo medio: " << fixed << setprecision(2) << av << " m3\n";
- cout << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement