제출 #56940

#제출 시각아이디문제언어결과실행 시간메모리
56940polyfishSažetak (COCI17_sazetak)C++14
64 / 160
1082 ms652 KiB
//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 timeMemoryGrader output
Fetching results...