fork download
  1. #include <iostream>
  2. #include<vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. vector<int> cards(51,0);
  8. for(int i=1;i<=50;i++){
  9. for(int j=i;j<=50;j+=i){
  10. cards[j] = 1 - cards[j];
  11. }
  12. }
  13. int ans = 0;
  14. for(int i=0;i<=50;i++) {
  15. if(cards[i] == 1) ans++;
  16. }
  17. cout << ans << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5508KB
stdin
Standard input is empty
stdout
7