Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
a6
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { int accountleft=0; int accountright=0; int[] test = {1, 2, 5, 4, 4}; int f(int[] a) { int rightside = a.Length-1; int leftside = 0; int middle = a.Length/2; int left=a[0]; int right= a[rightside]; while(true) { if(leftside+1 == rightside && left != right ) { return 0; } else { if(left > right) { right+=a[rightside--]; accountright++; } else if (left < right) { left+=a[leftside++]; accountleft+=1; } else if(left == right) { if(accountleft==0) { accountleft++; } else if(accountright==0) { accountright++; } return 1; } else { return 0; } } } } int final = f(test); int accountlefts = accountleft; int accountrights = accountright; if(final==1) { String leftstring=""; String rightstring=""; while(accountlefts>0) { leftstring+="a["+accountlefts+"]+"; accountlefts--; } while(accountrights>0) { rightstring+="a["+accountrights+"]+"; accountrights--; } Console.WriteLine(accountleft+" Reason:"+leftstring); } else { } // Console.WriteLine(f(test)); Console.WriteLine(accountleft); Console.WriteLine(accountright); Console.WriteLine(test.Length); } } }
run
|
edit
|
history
|
help
0
gass
sdfgthyjukiujyhtgrf
1
FromBase64String
Conversioni double
Point in Circle
DateTime Subtract TotalDays
עעעע
First pr
simult 3x3