Created
February 8, 2016 14:11
-
-
Save oyakodon/ef6553ebef1e4125013a to your computer and use it in GitHub Desktop.
ABC033で実際に使ったプログラムたち。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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