fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int N,S;
  6. cin >> N >> S;
  7. int ans =0;
  8. for(int i =0; i < N; i++) {
  9. int a;
  10. cin >> a;
  11. ans +=S%a;
  12. S /=a;}
  13. cout << ans+S << "\n";
  14. return 0;}
Success #stdin #stdout 0s 3348KB
stdin
5 228
5 2 5 2 5
stdout
8