forked from kothariji/competitive-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path(ATCODER)beginner .cpp
51 lines (42 loc) · 1.29 KB
/
(ATCODER)beginner .cpp
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
40
41
42
43
44
45
46
47
48
49
50
51
// Problem 1 . Atcoder beginner contest 185
// Problem Statement
// Takahashi has decided to hold some number of programming contests.Holding one contest requires
// one 100-point problem, one 200-point problem, one 300-point problem, and one 400-point problem.
// When he has A1,A2,A3,and A4 drafts of 100-,200-, 300-, and 400-point problems, respectively, at most how many contests can he hold?
// The same draft can be used only once.
// Constraints
// 1≤Ai≤100
// (1≤i≤4)
// All values in input are integers.
// Input
// Input is given from Standard Input in the following format:
// A1 A2 A3 A4
// Output
// Print an integer representing the maximum number of contests that can be held.
// Sample Input 1
// 5 3 7 11
// Sample Output 1
// 3
// By using three drafts for each slot, he can hold three contests. He has just three drafts for
// 200
// -point problems, so he cannot hold four.
// Sample Input 2
// 100 100 1 100
// Sample Output 2
// 1
// A contest cannot be held even if there is just one missing slot.
///////////////////////////////////////////////////////////////////////////////
My solution
#include <iostream>
using namespace std;
int main()
{
long int arr[5];
for (int i = 0; i < 4; i++)
{
cin >> arr[i];
}
sort(arr, arr + 4);
cout << arr[0];
return 0;
}