# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56940 | polyfish | Sažetak (COCI17_sazetak) | C++14 | 1082 ms | 652 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//I love armpit fetish
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"
const int MAX_M = 12;
int n, m, k[MAX_M];
void enter() {
cin >> n >> m;
for (int i=1; i<=m; ++i)
cin >> k[i];
k[++m] = n;
}
int solve() {
int res = 0;
for (int i=1; i<=n; ++i) {
bool ok1 = false, ok2 = false;
for (int j=1; j<=m; ++j) {
ok1 = ok1 || (i%k[j]==0);
ok2 = ok2 || (i%k[j]==1);
if (ok1 && ok2)
break;
}
res += (ok1 && ok2);
}
return res;
}
int main() {
//#define OFFLINE_JUDGE doraemon
#ifdef OFFLINE_JUDGE
freopen(FILE_NAME".inp", "r", stdin);
freopen(FILE_NAME".out", "w", stdout);
#endif
ios::sync_with_stdio(0); cin.tie(0);
enter();
cout << solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |