Skip to content

Instantly share code, notes, and snippets.

@mypalsminecraft
Last active August 29, 2015 13:57
Show Gist options
  • Save mypalsminecraft/9498980 to your computer and use it in GitHub Desktop.
Save mypalsminecraft/9498980 to your computer and use it in GitHub Desktop.
System.IndexOutOfRangeException
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Store Credit - Small (C-Sharp)")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Store Credit - Small (C-Sharp)")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("790613f6-6e64-4ab3-ad7f-38f4536f05c8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Threading;
namespace scred {
class Program
{
static int n;
static void Main(string[] args)
{
String nS = Console.ReadLine();
n = Convert.ToInt32(nS);
for (int ni = 1; ni <= n; ni++)
{
String cS = Console.ReadLine();
int c = Convert.ToInt32(cS);
String iS = Console.ReadLine();
int i = Convert.ToInt32(iS);
String[] p = Console.ReadLine().Split(' ');
for (int a = 1; a <= p.Length-2; a++)
{
bool done = false;
for (int b = 1; b <= p.Length-2; a++)
{
if ((Convert.ToInt32(p[a]) + Convert.ToInt32(p[b])) == c)
{
Console.WriteLine("Case #" + ni + ": " + a + " " + b);
Thread.Sleep(1000);
done = true;
break;
}
else
{
done = false;
}
}
if (done) break;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment