本文介绍了达芙妮阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

daphne数组被定义为包含至少一个奇数的数组,并以相同数量的偶数开始和结束。所以{4,8,6,3,2,9,8,11,8,13,12,12,6}是一个dephne数组,因为它以三个偶数开头,它包含至少
一个奇数数字。

数组{2,4,6,8,6}不是dephne数组,因为它不包含奇数。

数组(2 ,8,7,10,-4,6}不是dephne数组,因为它以两个偶数开始,但以三个偶数结束。

写一个名为dephne的函数,如果它返回1数组参数是一个daphne数组。用java编写程序,函数签名是,int isdephne(int [] a)

A daphne array is defined to be an array that contains at least one odd number and begins and ends with the same number of even numbers. So{4,8,6,3,2,9,8,11,8,13,12,12,6} is a dephne array because it begins with three even numbers and it contains at least one odd number.
The array {2,4,6,8,6} is not a dephne array because it doesn’t contain an odd number.
The array (2, 8, 7, 10,-4, 6} is not a dephne array because it begins with two even numbers but ends with three even numbers.
Write a function named is dephne that returns 1 if its array argument is a daphne array. Write a program in java, the function signature is ,int isdephne (int[] a)


i只是困惑需要有人点亮我的方式 

i just confused need someone to light my way 


谢谢 

thank you 

推荐答案

但是,您需要的逻辑非常相似,所以我提供以下内容来帮助您。我假设失败的匹配返回0(零)。

However, the logic you require will be very similar so I offer the following to help you. I assume a failed match returns a 0 (zero).

函数isdephne(arr){

  var numResult = 0;
function isdephne( arr) {
 var numResult = 0;


这篇关于达芙妮阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 23:34