Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6918 邓小龙 18排列骨头 C++ Wrong Answer 0 MS 260 KB 933 2025-03-28 13:36:49

Tests(0/1):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; /*思路:先预排30根骨头,然后开始数数,逢9则替换为萝卜, 30个位置数完,重头又开始数, 数数过程中,如果位置上的萝卜,那么则跳过,不数 按上述方法重复,直到萝卜的数量达到15,那么停止数数,然后输出结果 */ int a[31],cnt,num;//a为排列的骨头和胡萝卜,cnt用于数数,num用于统计胡萝卜数量 int main(){ while(num<15){ for(int i=1;i<=30;i++){ if(a[i]==0){ cnt++; if(cnt==10)cnt=1; if(cnt==9)a[i]=1,num++; } } } for(int i=1;i<=30;i++) cout<<a[i]<<" "; return 0; }


Run Info:

------Input------
0
------Answer-----
1 2 3 4 10 11 13 14 15 17 20 21 25 28 29
------Your output-----
0 0 0 0 1 1 1 1 1 0 0 1 0 0 0 1 0 1 1 0 0 1 1 1 0 1 1 0 0 1