Skip to content

Instantly share code, notes, and snippets.

@oyakodon
Created February 8, 2016 14:11
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/ef6553ebef1e4125013a to your computer and use it in GitHub Desktop.
Save oyakodon/ef6553ebef1e4125013a to your computer and use it in GitHub Desktop.
ABC033で実際に使ったプログラムたち。
using System;
namespace ABC033
{
public class A
{
public static void Main(string[] args)
{
var input = Console.ReadLine();
Console.WriteLine(checker(input) ? "SAME" : "DIFFERENT");
}
public static bool checker(string input)
{
char prev = input[0];
foreach (var c in input)
{
if (prev != c)
{
return false;
}
prev = c;
}
return true;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
namespace ABC033
{
class B
{
public static void Main(string[] args)
{
var num = int.Parse(Console.ReadLine());
var dic = new Dictionary<string, int>();
for(var i = 0; i < num; ++i)
{
var input = Console.ReadLine().Split(' ');
dic.Add(input[0], int.Parse(input[1]));
}
if (dic.Values.Max() > dic.Values.Sum() / 2)
{
Console.WriteLine(dic.First(item => item.Value.Equals( dic.Values.Max() )).Key);
} else
{
Console.WriteLine("atcoder");
}
}
}
}
using System;
namespace ABC033
{
class C
{
public static void Main(string[] args)
{
var input = Console.ReadLine().Split('+');
var ans = 0;
foreach(var item in input)
{
if (item.Contains("*"))
{
if (!item.Contains("0"))
{
// 乗算かつ0を含んでいない
++ans;
}
} else
{
// 足し算
if (item != "0")
++ans;
}
}
Console.WriteLine(ans);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment