제출 #37658

#제출 시각아이디문제언어결과실행 시간메모리
37658szawinisSažetak (COCI17_sazetak)C++14
0 / 160
0 ms2992 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e6+1; int n, m, ans; bool mark[N]; int main() { scanf("%d %d", &n, &m); for(int i = 0, k; i < m; i++) { scanf("%d", k); for(int j = k; j <= n; j += k) mark[j] = true; } mark[0] = true; for(int i = 1; i <= n; i++) ans += mark[i] && mark[i-1]; printf("%d", ans); }

컴파일 시 표준 에러 (stderr) 메시지

sazetak.cpp: In function 'int main()':
sazetak.cpp:10:16: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'int' [-Wformat=]
   scanf("%d", k);
                ^
sazetak.cpp:8:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
                        ^
sazetak.cpp:10:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", k);
                 ^
sazetak.cpp:10:17: warning: 'k' may be used uninitialized in this function [-Wmaybe-uninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...