单片机程序火箭发射,倒计时和推送,用C语言写的。
# include & ltvector & gt
# include & lt算法& gt
使用命名空间std
int is_right(int a[],int k)
{
int Jian _ ge = a[1]-a[0];
int count _ num = 0;
for(int I = 0;我& lt& lta href="/s?wd = k-1 & amp;TN = 44039180 _ CPR & amp;fenlei = mv 6 quakxtz n 0 izrqichckpjm 4 NH 00t 1 d9 nhndranlnankmhf 3 RH 0d 0 zwv 5 hcvrjm 3 RH 6 spfkwumw 85 hfynjn 4 NH 6 sgvpst 6 kdthsqpzwytjceqlgcpyw 9 uz 4 bmy-bii 4 wuvyetgn-TL wguv 3 enh 6 vnw 0 vrhclnjr 1 nmynj 6 VPS " target = " _ blank " class = " Baidu-highlightk-1 & lt;/a & gt;;i++)
{
if(a[i+1]-a[i]==jian_ge)
{
count _ num++;
}
}
return count _ num = = & lta href="/s?wd = k-1 & amp;TN = 44039180 _ CPR & amp;fenlei = mv 6 quakxtz n 0 izrqichckpjm 4 NH 00t 1 d9 nhndranlnankmhf 3 RH 0d 0 zwv 5 hcvrjm 3 RH 6 spfkwumw 85 hfynjn 4 NH 6 sgvpst 6 kdthsqpzwytjceqlgcpyw 9 uz 4 bmy-bii 4 wuvyetgn-TL wguv 3 enh 6 vnw 0 vrhclnjr 1 nmynj 6 VPS " target = " _ blank " class = " Baidu-highlightk-1 & lt;/a & gt;?真:假;
}
int main()
{
int I;
CIN & gt;& gt我;
向量& ltchar & gt结果;
向量& ltchar & gt*迭代它;
for(int j = 1;j & lt= I;j++)
{
int k;
CIN & gt;& gtk;
int a[k];
for(int m = 0;m & ltk;m++)
{
CIN & gt;& gta[m];
}
if(is_right(a,k)==1)
{
result . push _ back(' Y ');
}
其他
{
result . push _ back(' N ');
}
}
// reverse(result.begin()、result . end());
for(it = result . begin();它!=result.end()。it++)
{
cout & lt& lt* it & lt& ltendl
}
返回0;
}