Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. //#define NMAX 1000
  5.  
  6. struct Video
  7. {
  8. int ok;
  9. int size;
  10. };
  11.  
  12. struct Endpoint {
  13. int DataCenterLatency;
  14. int NrCaches;
  15. int Caches[1000][2];
  16. int NrRequests;
  17. int Requests[1000][2];
  18. };
  19.  
  20. int main() {
  21.  
  22. FILE* f;
  23. f = fopen("C:\\Users\\Dragos\\Desktop\\qualification_round_2017.in\\me_at_the_zoo.in", "r");
  24.  
  25. int R,C,X;
  26. int V,E;
  27.  
  28. printf("test");
  29.  
  30. fscanf(f,"%d %d %d %d %d", &V, &E, &R, &C, &X);
  31. printf("%d %d %d %d %d\n", V, E, R, C, X);
  32.  
  33.  
  34. struct Endpoint endpoint[1000];
  35. struct Video videoclip[1000];
  36.  
  37.  
  38. for(int i = 0; i < V; ++i)
  39. fscanf(f, "%d", &videoclip[i].size);
  40.  
  41.  
  42.  
  43. for(int i = 0; i < V; ++i)
  44. printf("%d", videoclip[i].size);
  45.  
  46.  
  47. for(int i = 0; i < E; ++i)
  48. {
  49. fscanf(f, "%d", &endpoint[i].DataCenterLatency);
  50. fscanf(f, "%d", &endpoint[i].NrCaches);
  51.  
  52. for(int j = 0; j < endpoint[i].NrCaches; ++j)
  53. fscanf(f,"%d %d", &endpoint[i].Caches[j][0], &endpoint[i].Caches[j][1]);
  54. }
  55. int req, idVid , endId;
  56. for(int i = 0; i < R; ++i)
  57. {
  58.  
  59. fscanf(f, "%d %d %d", &req, &idVid, &endId);
  60.  
  61. endpoint[endId].Requests[endpoint[endId].NrRequests][0] = idVid;
  62. endpoint[endId].Requests[endpoint[endId].NrRequests][1] = req;
  63. endpoint[endId].NrRequests++;
  64. }
  65. printf("test");
  66. /////////AFISARE///////////////
  67.  
  68.  
  69.  
  70. for(int i = 0; i < E; ++i)
  71. {
  72. printf("%d ", endpoint[i].DataCenterLatency);
  73. printf("%d\n", endpoint[i].NrCaches);
  74.  
  75. for(int j = 0; j < endpoint[i].NrCaches; ++j)
  76. printf("%d %d\n", endpoint[i].Caches[j][0], endpoint[i].Caches[j][1]);
  77. }
  78.  
  79. for(int i = 0; i < R; ++i) {
  80.  
  81. printf("%d %d %d\n",endpoint[i].Requests[endpoint[i].NrRequests][0],
  82. endpoint[i].Requests[endpoint[i].NrRequests][1],
  83. endpoint[i].NrRequests);
  84.  
  85. }
  86.  
  87.  
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement