Skip to content

Instantly share code, notes, and snippets.

View sakapon's full-sized avatar
💭
May the Codeforces be with you.

Keihō Sakapon sakapon

💭
May the Codeforces be with you.
View GitHub Profile
@sakapon
sakapon / Q002.cs
Last active June 7, 2021 04:07
競プロ典型 90 問 / Q002
using System;
class Q002
{
static void Main()
{
var n = int.Parse(Console.ReadLine());
for (int x = 0; x < 1 << n; x++)
{
@sakapon
sakapon / Q014.cs
Created June 1, 2021 02:02
競プロ典型 90 問 / Q014
using System;
using System.Linq;
class Q014
{
static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
static void Main()
{
var n = int.Parse(Console.ReadLine());
var a = ReadL();
@sakapon
sakapon / Q020.cs
Created June 1, 2021 01:33
競プロ典型 90 問 / Q020
using System;
using System.Linq;
class Q020
{
static void Main() => Console.WriteLine(Solve() ? "Yes" : "No");
static bool Solve()
{
var a = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
return a[0] < Enumerable.Repeat(a[2], (int)a[1]).Aggregate((x, y) => x * y);
@sakapon
sakapon / Q004.cs
Created June 1, 2021 01:18
競プロ典型 90 問 / Q004
using System;
class Q004
{
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
static (int, int) Read2() { var a = Read(); return (a[0], a[1]); }
static void Main()
{
var (h, w) = Read2();
var a = Array.ConvertAll(new bool[h], _ => Read());
@sakapon
sakapon / Q022.cs
Created June 1, 2021 01:08
競プロ典型 90 問 / Q022
using System;
using System.Linq;
class Q022
{
static void Main()
{
var a = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
var g = a.Aggregate(Gcd);
Console.WriteLine(a.Sum(x => x / g - 1));
@sakapon
sakapon / Q008.cs
Created May 31, 2021 09:22
競プロ典型 90 問 / Q008
using System;
class Q008
{
const string AtCoder = "atcoder";
const long M = 1000000007;
static void Main()
{
var n = int.Parse(Console.ReadLine());
var s = Console.ReadLine();
@sakapon
sakapon / Q027.cs
Last active June 1, 2021 02:12
競プロ典型 90 問 / Q027
using System;
using System.Collections.Generic;
class Q027
{
static void Main()
{
var n = int.Parse(Console.ReadLine());
var set = new HashSet<string>();
@sakapon
sakapon / Vector0Test.cs
Last active September 2, 2020 01:28
OperatorsSample/Vector0Test.KeyValuePair_Deconstruct
[TestMethod]
public void KeyValuePair_Deconstruct()
{
var d = Enumerable.Range(1, 100).ToDictionary(i => i, i => i / 2.0);
foreach (var (i, value) in d)
Console.WriteLine($"{i} {value}");
}
@sakapon
sakapon / EquatableObject.cs
Last active August 31, 2020 08:35
OperatorsSample/VectorEq class
using System;
using System.Reflection;
namespace OperatorsLib.Classes
{
public abstract class EquatableObject
{
// ValueType と同様に、すべてのフィールドで等価性を評価します。
public override bool Equals(object obj)
{
@sakapon
sakapon / Vector2.cs
Last active August 31, 2020 05:46
OperatorsSample/Vector2 struct
namespace OperatorsLib.Structs
{
public struct Vector2
{
public double X { get; }
public double Y { get; }
public Vector2(double x, double y) => (X, Y) = (x, y);
public void Deconstruct(out double x, out double y) => (x, y) = (X, Y);