codewars??? Is my friend cheating?
生活随笔
收集整理的這篇文章主要介紹了
codewars??? Is my friend cheating?
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
https://www.codewars.com/kata/5547cc7dcad755e480000004/train/java
import java.util.*; public class RemovedNumbers{public static List<long[]> removNb(long n){List<long[]> arr = new ArrayList<long[]>();long sum = (1+n) * n /2;for(long i=n/2+1; i<=n; i++){for(long j=n/2+2; j<=n; j++){long product = i * j;long left = sum - i - j;if(i != j){if(product == left){arr.add(new long[]{i,j});arr.add(new long[]{j,i});//return arr;}if(product > left){break;}}}}return arr;} }Process was terminated. It took longer than 12000ms to complete
轉載于:https://my.oschina.net/u/553266/blog/805974
總結
以上是生活随笔為你收集整理的codewars??? Is my friend cheating?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 原生js实现canvas气泡冒泡效果
- 下一篇: 线程同步--条件变量