-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibrary.cpp
More file actions
39 lines (30 loc) · 790 Bytes
/
Library.cpp
File metadata and controls
39 lines (30 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int N; //set N == 1 //debug useful
int S; //set S == 10 //debug useful
int day; //set day == 120 //debug useful
int total = 0; //then,it must be 10*5 //debug useful
int bsize = 0;
cin >> N; //Total books
int B[N]; //array with length [N]
for(int i=1;i <= N;i++){
cin >> S;
cin >> day;
if((day - 100) > 0){
bsize++;
B[bsize] = S; //B[1] = 10 //debug useful
total = 5*(day - 100)+total; //total = 100+0//debug useful
}else{
continue;
}
}
sort(B+1,B + 1 + bsize);
for(int i=1;i <= bsize;i++){
cout << B[i] << " ";
}
cout << endl << total;
return 0;
}