Skip to content

Instantly share code, notes, and snippets.

@oyakodon
Created March 26, 2016 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oyakodon/b1044db8e7caabd678d2 to your computer and use it in GitHub Desktop.
Save oyakodon/b1044db8e7caabd678d2 to your computer and use it in GitHub Desktop.
ABC035で実際に使ったプログラムたち。 / C#
using System;
class Program
{
static void Main(string[] args)
{
var input = Console.ReadLine().Split();
var W = int.Parse(input[0]);
var H = int.Parse(input[1]);
if ( W % 16 != 0 || H % 9 != 0 )
{
Console.WriteLine("4:3");
}
else
{
Console.WriteLine("16:9");
}
}
}
using System;
class Program
{
static void Main(string[] args)
{
var S = Console.ReadLine();
var T = int.Parse(Console.ReadLine());
int i = 0, x = 0, y = 0, ques = 0;
do
{
switch ( S[i] )
{
case 'L':
x--;
break;
case 'R':
x++;
break;
case 'U':
y++;
break;
case 'D':
y--;
break;
case '?':
ques++;
break;
}
i++;
} while ( i < S.Length );
x = Math.Abs(x);
y = Math.Abs(y);
var dist = 0;
if ( T == 1 )
{
dist = x + ques + y;
}
else
{
dist = Math.Max(x + y - ques, Math.Abs(S.Length) % 2);
}
Console.WriteLine(dist);
}
}
using System;
class Program
{
static void Main(string[] args)
{
var input = Console.ReadLine().Split();
var arr = new int[int.Parse(input[0]) + 2];
for ( var i = 0; i < int.Parse(input[1]); ++i )
{
var act = Console.ReadLine().Split();
arr[int.Parse(act[0])]++;
arr[int.Parse(act[1]) + 1]--;
}
for ( var i = 1; i < arr.Length - 1; i++ )
{
arr[i] += arr[i - 1];
Console.Write(arr[i] % 2);
}
Console.WriteLine();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment