Submission #25865

#TimeUsernameProblemLanguageResultExecution timeMemory
25865gs14004Brunhilda’s Birthday (BOI13_brunhilda)C++14
40 / 100
1000 ms2408 KiB
#include <bits/stdc++.h> using namespace std; typedef long long lint; typedef pair<int, int> pi; const int mod = 1e9 + 7; int n, q, a[100005]; int main(){ scanf("%d %d",&n,&q); for(int i=1; i<=n; i++) scanf("%d",&a[i]); while(q--){ int x; scanf("%d",&x); int cnt = 0; while(x > 0){ int maxv = 0; for(int j=1; j<=n; j++) maxv = max(maxv, x % a[j]); if(maxv == 0){ puts("oo"); cnt = -1; break; } else x -= maxv; cnt++; } if(cnt >= 0) printf("%d\n", cnt); } }

Compilation message (stderr)

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:10:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&q);
                      ^
brunhilda.cpp:11:43: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1; i<=n; i++) scanf("%d",&a[i]);
                                           ^
brunhilda.cpp:14:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...