现要采购一批器材,同时有三个厂商在卖,单位价格分别为 a,b,c, 比较这三家厂商的价格,返回 价格的差值=最高价格-最低价格。 知识点: golang中 ,关系运算符分别表示小于,大于
示例1
输入
2,3,1
输出
2
加载中...
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ public int compare (int x, int y, int z) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ int compare(int x, int y, int z) { // write code here } };
#coding:utf-8 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param x int整型 采购单价 # @param y int整型 采购单价 # @param z int整型 采购单价 # @return int整型 # class Solution: def compare(self , x , y , z ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ public int compare (int x, int y, int z) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ function compare( x , y , z ) { // write code here } module.exports = { compare : compare };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param x int整型 采购单价 # @param y int整型 采购单价 # @param z int整型 采购单价 # @return int整型 # class Solution: def compare(self , x: int, y: int, z: int) -> int: # write code here
package main import "fmt" /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ func compare( x int , y int , z int ) int { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ int compare(int x, int y, int z ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param x int整型 采购单价 # @param y int整型 采购单价 # @param z int整型 采购单价 # @return int整型 # class Solution def compare(x, y, z) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ def compare(x: Int,y: Int,z: Int): Int = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ fun compare(x: Int,y: Int,z: Int): Int { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ public int compare (int x, int y, int z) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ export function compare(x: number, y: number, z: number): number { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ func compare ( _ x: Int, _ y: Int, _ z: Int) -> Int { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 采购单价 * @param y int整型 采购单价 * @param z int整型 采购单价 * @return int整型 */ pub fn compare(&self, x: i32, y: i32, z: i32) -> i32 { // write code here } }
2,3,1
2