//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
llo n;
llo it[11];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
llo k;
cin>>k;
for(llo i=0;i<k;i++){
cin>>it[i];
}
llo ans=0;
for(llo i=1;i<=n;i++){
llo st=0;
llo st2=0;
if(i==n){
st=1;
}
for(llo j=0;j<k;j++){
llo x=i%it[j];
if(x==0){
st=1;
}
else if(x==1){
st2=1;
}
}
if(st==1 and st2==1){
ans++;
}
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
178 ms |
204 KB |
Output is correct |
4 |
Correct |
153 ms |
204 KB |
Output is correct |
5 |
Execution timed out |
1090 ms |
204 KB |
Time limit exceeded |
6 |
Execution timed out |
1088 ms |
204 KB |
Time limit exceeded |
7 |
Execution timed out |
1095 ms |
204 KB |
Time limit exceeded |
8 |
Execution timed out |
1098 ms |
204 KB |
Time limit exceeded |
9 |
Execution timed out |
1088 ms |
204 KB |
Time limit exceeded |
10 |
Execution timed out |
1093 ms |
204 KB |
Time limit exceeded |