Skip to content

Instantly share code, notes, and snippets.

@dck-jp
Created September 10, 2012 14:30
Show Gist options
  • Save dck-jp/3691179 to your computer and use it in GitHub Desktop.
Save dck-jp/3691179 to your computer and use it in GitHub Desktop.
oppaiAnalysis
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OppaiAnalysis
{
static class OppaiAnalysis
{
static public double Cup2Cm(string cup)
{
if (cup == "AAA") { return 5; }
else if (cup == "AA") { return 7.5; }
else if (cup == "ZZ") { return 75; }
else if (cup == "ZZZ") { return 77.5; }
return (Convert.ToInt32(cup.ToCharArray()[0]) - Convert.ToInt32('A'))*2.5 + 10;
}
static public string Cm2Cup(double cm)
{
if( cm <= 6.25) {return "AAA";}
else if( cm <= 8.75){ return "AA";}
else if ( cm >= 77.5) {return "ZZZ";}
else if ( cm >= 75) { return "ZZ";}
return (Convert.ToChar((int)(Math.Floor((cm - 10)/2.5) + 65))).ToString();
}
}
}
var realisticSize = OppaiAnalysis.Cup2Cm("C");
Console.WriteLine(realisticSize); // "15"
var worldRecord = OppaiAnalysis.Cm2Cup(102.5);
Console.WriteLine(worldRecord); // "ZZZ"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment