Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- //#define NMAX 1000
- struct Video
- {
- int ok;
- int size;
- };
- struct Endpoint {
- int DataCenterLatency;
- int NrCaches;
- int Caches[1000][2];
- int NrRequests;
- int Requests[1000][2];
- };
- int main() {
- FILE* f;
- f = fopen("C:\\Users\\Dragos\\Desktop\\qualification_round_2017.in\\me_at_the_zoo.in", "r");
- int R,C,X;
- int V,E;
- printf("test");
- fscanf(f,"%d %d %d %d %d", &V, &E, &R, &C, &X);
- printf("%d %d %d %d %d\n", V, E, R, C, X);
- struct Endpoint endpoint[1000];
- struct Video videoclip[1000];
- for(int i = 0; i < V; ++i)
- fscanf(f, "%d", &videoclip[i].size);
- for(int i = 0; i < V; ++i)
- printf("%d", videoclip[i].size);
- for(int i = 0; i < E; ++i)
- {
- fscanf(f, "%d", &endpoint[i].DataCenterLatency);
- fscanf(f, "%d", &endpoint[i].NrCaches);
- for(int j = 0; j < endpoint[i].NrCaches; ++j)
- fscanf(f,"%d %d", &endpoint[i].Caches[j][0], &endpoint[i].Caches[j][1]);
- }
- int req, idVid , endId;
- for(int i = 0; i < R; ++i)
- {
- fscanf(f, "%d %d %d", &req, &idVid, &endId);
- endpoint[endId].Requests[endpoint[endId].NrRequests][0] = idVid;
- endpoint[endId].Requests[endpoint[endId].NrRequests][1] = req;
- endpoint[endId].NrRequests++;
- }
- printf("test");
- /////////AFISARE///////////////
- for(int i = 0; i < E; ++i)
- {
- printf("%d ", endpoint[i].DataCenterLatency);
- printf("%d\n", endpoint[i].NrCaches);
- for(int j = 0; j < endpoint[i].NrCaches; ++j)
- printf("%d %d\n", endpoint[i].Caches[j][0], endpoint[i].Caches[j][1]);
- }
- for(int i = 0; i < R; ++i) {
- printf("%d %d %d\n",endpoint[i].Requests[endpoint[i].NrRequests][0],
- endpoint[i].Requests[endpoint[i].NrRequests][1],
- endpoint[i].NrRequests);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement