52 cards and 52 cards
There are 52 cards, so that they all face up, starting from 2nd cards, where the cards at the multiples of 2 turn to face down; then starting from 3rd cards, for cards at the multiples of 3, the front is turned to the front, and the front is turned to the front. Then, the third round starts from 4th cards, the cards at the multiples of 4 follow the same rules above, and so on until the number of cards to be turned is 1st. Count the numbers of cards facing up and their positions.
1 # include <iostream> 2 using namespace std; 3 int a [1001]; // 0 front up 4 void f (int n) 5 {6 if (n = 53) 7 return; 8 else 9 {10 for (int I = 1; I <= 52; I ++) 11 {12 if (I % n = 0) 13 {14 if (a [I] = 0) 15 a [I] = 1; 16 else a [I] = 0; 17} 18} 19 f (n + 1); 20} 21} 22 int main () 23 {24 f (2); 25 int tot = 0; 26 for (int I = 1; I <= 52; I ++) 27 {28 if (a [I] = 0) 29 {30 tot ++; 31 cout <I <"; 32} 33} 34 cout <endl; 35 cout <tot; 36 return 0; 37}