-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathB.cpp
43 lines (39 loc) · 952 Bytes
/
B.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
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
#define test(t) \
int t; \
cin >> t; \
while (t--)
#define f(i, a, b) for (int(i) = (a); (i) < (b); ++(i))
#define endl "\n"
#define deb(x) cout << #x << ": " << x << endl;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
void solve() {
ull a, b;
cin >> a >> b;
ull mini = ULLONG_MAX;
ull ans1, ans2;
for (int i = 1; i <= b; i++) {
ull temp;
cin >> temp;
if (a >= temp && (a % temp < mini)) {
mini = a % temp;
ans1 = i;
ans2 = a / temp;
}
}
if (mini == ULLONG_MAX)
cout << 1 << " " << 0 << endl;
else
cout << ans1 << " " << ans2;
}
int main() {
fast;
// test(t)
solve();
return 0;
}