// solutie 100 pct Mihai Georgescu // prof. Chesca Ciprian // Liceul Tehnologic "Costin Nenitescu" Buzau #include #include #define pmax 101 #define smax 361 using namespace std; short hdd[pmax][2*smax]; // ns = numar sectoare // np = numar piste // nso = numar sectoare ocupate // xs = sector curent citit // xp = pista curenta citita // po = piste ocupate int main() { int v,c,np,ns,xp,xs,i,j,k,po,min,s,nso; ifstream f("defrag.in"); ofstream g("defrag.out"); // citesc configuratia HDD f>>v>>np>>ns; // citesc cate clustere sunt ocupate f>>c; // citesc clusterele ocupate for(i=1;i<=c;i++) { f>>xp>>xs; hdd[xp][xs]=1; // extindere matrice hdd[xp][xs+ns]=1; hdd[xp][0]++; } if (v==1) { // cate piste nu au clustere ocupate po=0; for(i=1;i<=np;i++) if (hdd[i][0]) po++; g<