diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-04-30 01:13:40 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-04-30 01:13:40 +0200 |
| commit | a0d7b8320a8996eee0ed957b79c3a882f8b47146 (patch) | |
| tree | 76242ae2b19bad00796ed6d0104da8a0e4a99abe /LisaWorkbook.cpp | |
| download | competitive-programming-a0d7b8320a8996eee0ed957b79c3a882f8b47146.tar.xz competitive-programming-a0d7b8320a8996eee0ed957b79c3a882f8b47146.zip | |
Added all current problems
Diffstat (limited to 'LisaWorkbook.cpp')
| -rw-r--r-- | LisaWorkbook.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/LisaWorkbook.cpp b/LisaWorkbook.cpp new file mode 100644 index 0000000..6d8532c --- /dev/null +++ b/LisaWorkbook.cpp @@ -0,0 +1,25 @@ +#include <bits/stdc++.h> + +using namespace std; + +int main() +{ + int n, k; + cin >> n >> k; + int pg = 1, res = 0; + for (int i = 0; i < n; i++) { + int np; + cin >> np; + for (int j = 1; j <= np ; j++) { + if (j == pg) { + res++; + } + if (j % k == 0 && j < np) { + pg++; + } + } + pg++; + } + cout << res << endl; + return 0; +} |
