Altered Algorithm

This commit is contained in:
e2hang
2025-09-01 19:49:15 +08:00
parent e162486df1
commit 9c30eb42e2
15 changed files with 954 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> a(n - 1, 0);
a.push_back(1);
int idx = 0;
int js = 0;
int p;
while(!a.empty()){
if(idx >= n) idx = 0;
if(a[idx] == 1) p = js;
a.erase(a.begin() + idx);
idx = idx + 2;
js++;
}
cout << js << " " << p << endl;
return 0;
}