Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define TRACE(x) x
- #define WATCH(x) TRACE( cout << #x" = " << x << endl)
- #define PRINT(x) TRACE(printf(x))
- #define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl;)
- #define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
- #define rep(i, a, b) for(int i = (a); i < (b); ++i)
- #define trav(a, x) for(auto& a : x)
- #define all(x) (x).begin(), (x).end()
- #define sz(x) (int)(x).size()
- #define mp make_pair
- #define fi first
- #define se second
- using ll = long long;
- using pii = pair<int, int>;
- using pll = pair<ll, ll>;
- using vi = vector<int>;
- constexpr ll MOD = 1e9 + 7;
- inline ll pow_mod(ll a, ll b, ll mod = MOD)
- {
- ll result = 1ll, mult = (a % mod);
- while(b) {
- if(b & 1) result = (result * mult) % mod;
- mult = (mult * mult) % mod;
- b /= 2ll;
- }
- return result;
- }
- int main()
- {
- vector<string> tests = {"a_example", "b_read_on", "c_incunabula", "d_tough_choices", "e_so_many_books", "f_libraries_of_the_world" };
- ofstream out("testcase_analysis.csv");
- out << "test_name,distinct_books,total_libraries,available_days(D),average_signup_time,average_book_per_library" << endl;
- for(const auto& s : tests)
- {
- string in_name = s + ".txt";
- ifstream in(in_name.c_str());
- int b, l, d;
- in >> b >> l >> d;
- vector<int> book_weight(b);
- for(int& x : book_weight) in >> x;
- int total_books = 0;
- int total_signup = 0;
- rep(i,0,l)
- {
- int n, t, m;
- in >> n >> t >> m;
- total_books += n;
- total_signup += t;
- int lixo;
- rep(j, 0, n) in >> lixo;
- }
- in.close();
- out << s << "," << b << "," << l << "," << d << "," << 1.0 * total_signup / l << "," << 1.0 * total_books / l << endl;
- /*cout << "Para o arquivo " << s << " temos os seguintes dados" << endl;
- cout << "Total de Livros = " << b << endl;
- cout << "Total de biblotecas = " << l << endl;
- cout << "Media de livros por biblioteca = " << 1.0 * total_books / l << endl;
- */
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement