Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
122164 唐诗阳 18排列骨头 C++ Wrong Answer 1 MS 268 KB 1388 2025-06-14 16:44:27

Tests(0/1):


Code:

#include <iostream> #include <vector> using namespace std; vector<int> findBonePositions() { const int total = 30; const int bones = 15; const int step = 9; vector<int> sequence(total, 0); vector<int> finalPositions; for (int i = 0; i < bones; ++i) { finalPositions.push_back(i); } int currentSize = bones; int currentPos = 0; for (int round = 1; round <= total - bones; ++round) { currentPos = (currentPos - step) % currentSize; if (currentPos < 0) { currentPos += currentSize; } finalPositions.insert(finalPositions.begin() + currentPos, -1); // -1 represents carrot currentSize++; } for (int pos : finalPositions) { if (pos != -1) { sequence[pos] = 1; } } return sequence; } int main() { vector<int> bonePositions = findBonePositions(); cout << "Initial arrangement (0=carrot, 1=bone):" << endl; for (int i = 0; i < 30; ++i) { cout << bonePositions[i] << " "; if ((i + 1) % 10 == 0) cout << endl; } cout << endl; cout << "Bone positions (1-based): "; for (int i = 0; i < 30; ++i) { if (bonePositions[i] == 1) { cout << i + 1 << " "; } } cout << endl; return 0; }


Run Info:

------Input------
0
------Answer-----
1 2 3 4 10 11 13 14 15 17 20 21 25 28 29
------Your output-----
Initial arrangement (0=carrot, 1=bone): 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Bone positions (1-based): 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15