public class Solution {
public string OptimalDivision(int[] nums) {
if (nums.Length == )
{
return "";
}
else if (nums.Length == )
{
return nums[].ToString();
}
else if (nums.Length == )
{
return nums[] + "/" + nums[];
}
else
{
var first = nums[];
var dv = nums[];
StringBuilder sb = new StringBuilder(first + "/(");
for (int i = ; i < nums.Length; i++)
{
sb.Append(nums[i]);
sb.Append("/");
}
sb.Remove(sb.Length - , );
sb.Append(")"); return sb.ToString();
}
}
}

https://leetcode.com/problems/optimal-division/#/description

leetcode553的更多相关文章

  1. [Swift]LeetCode553. 最优除法 | Optimal Division

    Given a list of positive integers, the adjacent integers will perform the float division. For exampl ...

随机推荐

  1. 去除inline-block元素间间距的N种方法(转)

    一.现象描述 真正意义上的inline-block水平呈现的元素间,换行显示或空格分隔的情况下会有间距,很简单的个例子: <input /> <input type="su ...

  2. Resteasy集成Spring

    很简单,都用最新的版本就可以了.之前在网上找的教程都是用resteasy2.x和spring3集成,但是resteasy2.x和spring4是不行的,弄了很久.最后换成最新的resteasy3.x好 ...

  3. Failed to read schema document

    转自:http://eric-yan.iteye.com/blog/1908470 问题描述: web项目web.xml编译错误: schema_reference.4: Failed to read ...

  4. Dapper.Contrib 开发.net core程序,兼容多种数据库

    Dapper.Contrib 开发.net core程序,兼容多种数据库 https://www.cnblogs.com/wuhuacong/p/9952900.html 使用Dapper.Contr ...

  5. pat甲级 1154 Vertex Coloring (25 分)

    A proper vertex coloring is a labeling of the graph's vertices with colors such that no two vertices ...

  6. 《selenium2 python 自动化测试实战》(13)——上传文件

    看代码: # coding: utf-8 from selenium import webdriver from time import sleep driver = webdriver.Firefo ...

  7. 转 neighbour table overflow 问题解决

    接到保障,说某来机器服务没法访问,于是,准备连接到机器上去看个究竟. 尼玛居然连不上,连ping都ping不通,无奈只能求助机房. 机房人员检查, 发现报 neighbour table overfl ...

  8. 初始化Lights Out 100(ilo100)密码

    初始化Lights Out 100(ilo100)密码 /HP ProLiant General /HP Software /初始化Lights Out 100(ilo100)密码 2014年5月21 ...

  9. bzoj1087互不侵犯King(状压)

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1087 简单的状压dp.但是wa了好几发.注意long long. 注意0和0的连边.而且不能 ...

  10. (转)Android内存泄漏分析及调试

      http://blog.csdn.net/gemmem/article/details/13017999 此文承接我的另一篇文章:Android进程的内存管理分析  首先了解一下dalvik的Ga ...