buggy_code
stringlengths 11
625k
| fixed_code
stringlengths 17
625k
| bug_type
stringlengths 2
4.45k
| language
int64 0
8
| token_count
int64 5
200k
| change_count
int64 0
100
|
|---|---|---|---|---|---|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
#if !DEBUG
using System.IO;
#endif
public class Program {
public static void Main() {
#region SetAutoFlushIsFalse
#if !DEBUG
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
#endif
#endregion
var n = ReadLib.ReadAsInt();
var s = Console.ReadLine();
var k = ReadLib.ReadAsInt();
var targetChar = s[k];
var o = new string(s.Select(c => c == targetChar ? c : '*').ToArray());
Console.WriteLine(o);
#region Flush
#if !DEBUG
Console.Out.Flush();
sw.Close();
#endif
#endregion
}
}
internal class Calculation {
internal static long Calc(long x) {
if (x <= 6) {
return 1;
} else if (6 < x && x <= 11) {
return 2;
}
var score = (x / 11) * 2;
var mod = x % 11;
if (mod == 0) {
return score;
} else if (1 <= mod && mod <= 6) {
return score + 1;
} else {
return score + 2;
}
}
}
static class Quick {
internal static void Calculate(int[] ts) { QuickSort(ts, 0, ts.Count() - 1); }
private static void QuickSort(int[] ts, int p, int r) {
if (p < r) {
var q = Partition(ts, p, r);
QuickSort(ts, p, q - 1);
QuickSort(ts, q + 1, r);
}
}
public static int Partition(int[] sArr, int p, int r) {
var x = sArr[r];
var i = p - 1;
for (int j = p; j < r; j++) {
if (sArr[j] <= x) {
i++;
sArr.Swap(i, j);
}
}
sArr.Swap(i + 1, r);
return i + 1;
}
}
static class ReadLib {
public static long ReadAsLong() { return long.Parse(Console.ReadLine()); }
public static int ReadAsInt() { return int.Parse(Console.ReadLine()); }
public static int[] ReadAsIntArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => int.Parse(s) + step)
.ToArray();
}
public static long[] ReadAsLongArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => long.Parse(s) + step)
.ToArray();
}
public static ulong[] ReadAsULongArray() {
return Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray();
}
public static string[] ReadAsStringArray() {
return Console.ReadLine().Split(' ');
}
public static int[] ReadNTimesAsInt(int n, int step = 0) {
return Enumerable.Range(1, n)
.Select(s => int.Parse(Console.ReadLine()) + step)
.ToArray();
}
public static int[][] ReadNTimesAsIntArray(int n, int step = 0) {
return Enumerable.Range(1, n).Select(s => ReadAsIntArray(step)).ToArray();
}
public static string[] ReadNTimesAsString(int n) {
return Enumerable.Range(1, n).Select(s => Console.ReadLine()).ToArray();
}
}
static class WriteLib {
public static void Write<T>(IEnumerable<T> ts) {
ts.ToList().ForEach(s => Console.WriteLine(s));
}
}
static class MyMath {
/// <summary>階乗</summary>
public static long Factorial(int n) {
if (n == 0) {
return 1;
}
return Permutation(n, 0);
}
public static long Permutation(int n, int k) {
return Enumerable.Range(0, n - k)
.Select(i => n - i)
.Aggregate(1, (b, i) => b * i);
}
#region FullPower
/// <summary>総乗、π</summary>
public static long FullPower(IEnumerable<long> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
public static long FullPower(IEnumerable<int> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
#endregion
/// <summary>最大公約数</summary>
public static long Gcd(long item1, long item2) {
var a = Math.Max(item1, item2);
var b = Math.Min(item1, item2);
while (true) {
long mod;
Math.DivRem(a, b, out mod);
if (mod == 0) {
break;
}
a = b;
b = mod;
}
return b;
}
/// <summary>約分。最大公約数で割ったものを返す。</summary>
public static Tuple<long, long> DeviedByGcd(long item1, long item2) {
var gcd = Gcd(item1, item2);
return new Tuple<long, long>(item1 / gcd, item2 / gcd);
}
public static long Lcm(int item1, int item2) {
return Math.BigMul(item1, item2) / Gcd(item1, item2);
}
public static ModCombination ModCombination(int maxN, int mod = 1000000007) {
return new ModCombination(maxN, mod);
}
/// <summary>a^n mod</summary>
public static int ModPow(int a, int n, int mod = 1000000007) {
var res = 1;
while (n > 0) {
if ((n & 1) == 1) {
res = (int)(Math.BigMul(res % mod, a) % mod); // resにaをかける
}
a = (int)(Math.Pow(a % mod, 2) % mod); // 次のaはa^2
n >>= 1;
}
return res;
}
}
static class MyMethod {
/// <summary>数え上げて、key, 出現回数に変換</summary>
public static Dictionary<T, int> CountUp<T>(IEnumerable<T> str) {
return str.GroupBy(c => c)
.Select(g => new KeyValuePair<T, int>(g.Key, g.Count()))
.ToDictionary(e => e.Key, e => e.Value);
}
}
/// <summary>無向グラフ</summary>
class UndirectedGraph {
public Dictionary<int, List<int>> Graph { get; }
/// <param name="graphArr">point1 to point2</param>
/// <param name="n">グラフの全要素数</param>
public UndirectedGraph(int[][] graphArr, int n) {
Graph = new Dictionary<int, List<int>>();
for (int i = 1; i <= n; i++) {
Graph.Add(i, new List<int>());
}
foreach (var arr in graphArr) {
Graph[arr[0]].Add(arr[1]);
Graph[arr[1]].Add(arr[0]);
}
}
}
/// <summary>DeepCopyするクラス</summary>
class DeepCopier {
BinaryFormatter b = new BinaryFormatter();
public T DeepCopy<T>(T obj) {
T result;
using (var mem = new MemoryStream()) {
b.Serialize(mem,
obj); // binaryFormatterによりobjをmemにserial化して書き出す
mem.Position = 0; // memのpotisionを先頭に戻す
result = (T)b.Deserialize(mem); // memの内容を読み取る。
}
return result;
}
}
static class MergeSort {
public static long[] Sort(long[] arr) { return Sort(arr, 0, arr.Count()); }
// rightは+1されていることに注意
private static long[] Merge(long[] sArr, int left, int mid, int right) {
var n1 = mid - left;
var n2 = right - mid;
var lArr = new long[n1 + 1];
var rArr = new long[n2 + 1];
for (int i = 0; i < n1; i++) {
lArr[i] = sArr[left + i];
}
lArr[n1] = int.MaxValue;
for (int i = 0; i < n2; i++) {
rArr[i] = sArr[mid + i];
}
rArr[n2] = int.MaxValue;
int l = 0, r = 0;
for (int k = left; k < right; k++) {
if (lArr[l] <= rArr[r]) {
sArr[k] = lArr[l];
l++;
} else {
sArr[k] = rArr[r];
r++;
}
}
return sArr; // 要素数はright - left
}
private static long[] Sort(long[] sArr, int left, int right) {
if (left + 1 < right) {
var mid = (left + right) / 2;
sArr = Sort(sArr, left, mid);
sArr = Sort(sArr, mid, right);
sArr = Merge(sArr, left, mid, right);
}
return sArr;
}
}
/// <summary>あまりを計算するためのintのラッパー</summary>
struct ModInt {
int Value { get; }
int Mod { get; }
public override string ToString() { return Value.ToString(); }
public static explicit operator ModInt(long value) {
return new ModInt(value);
}
public ModInt(long value, int mod = 1000000007) {
this.Value = (int)(value % mod);
this.Mod = mod;
}
public static explicit operator int(ModInt modInt) { return modInt.Value; }
private static void CheckNotEqualMod(ModInt item1, ModInt item2) {
if (item1.Mod != item2.Mod) {
throw new Exception("mod not equal");
}
}
public static ModInt operator +(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = item1.Value + item2.Value;
return new ModInt(value, item1.Mod);
}
public static ModInt operator *(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = Math.BigMul(item1.Value, item2.Value);
return new ModInt(value, item1.Mod);
}
public static ModInt operator -(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = item1.Value - item2.Value;
if (value < 0) {
value += item1.Mod;
}
return new ModInt(value, item1.Mod);
}
public static ModInt operator +(ModInt item1, int item2) {
return item1 + new ModInt(item2, item1.Mod);
}
public static ModInt operator *(ModInt item1, int item2) {
return item1 * new ModInt(item2, item1.Mod);
}
public static ModInt operator -(ModInt item1, int item2) {
return item1 - new ModInt(item2, item1.Mod);
}
public override int GetHashCode() { return this.Value; }
public override bool Equals(object obj) {
if (obj == null || this.GetType() != obj.GetType()) {
return false;
}
var modIntObj = (ModInt)obj;
return modIntObj.Value == this.Value;
}
public static bool operator ==(ModInt item1, ModInt item2) {
return item1.Value == item2.Value;
}
public static bool operator !=(ModInt item1, ModInt item2) {
return !(item1 == item2);
}
public static bool operator ==(ModInt item1, int item2) {
return item1.Value == item2;
}
public static bool operator !=(ModInt item1, int item2) {
return !(item1.Value == item2);
}
public static bool operator >=(ModInt item1, ModInt item2) {
return item1.Value >= item2.Value;
}
public static bool operator <=(ModInt item1, ModInt item2) {
return item1.Value <= item2.Value;
}
public static bool operator >=(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator <=(ModInt item1, int item2) {
return item1.Value <= item2;
}
public static bool operator>(ModInt item1, ModInt item2) {
return item1.Value > item2.Value;
}
public static bool operator<(ModInt item1, ModInt item2) {
return item1.Value < item2.Value;
}
public static bool operator>(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator<(ModInt item1, int item2) {
return item1.Value <= item2;
}
}
/// <summary>組み合わせ</summary>
class ModCombination {
private int mod;
private int[] fac;
private int[] finv;
private int[] inv;
public ModCombination(int max, int mod = 1000000007) {
this.mod = mod;
fac = new int[max]; // modが法のn!の列
inv = new int[max]; // indexの逆元の列
finv = new int[max]; // modを法とした、invの累積の累積
fac[0] = 1;
fac[1] = 1;
finv[0] = 1;
finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < max; i++) {
fac[i] = (int)(Math.BigMul(fac[i - 1], i) % mod); // factorを求める
var s = Math.BigMul(inv[mod % i], mod / i) % mod;
inv[i] = (int)(mod - s);
// iに対する逆元を求める
finv[i] = (int)(Math.BigMul(finv[i - 1], inv[i]) % mod);
}
}
/// <summary>nCk</summary>
public int Calculation(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return (int)(Math.BigMul(fac[n],
(int)(Math.BigMul(finv[k], finv[n - k]) % mod)) %
mod);
}
}
/// <summary>拡張メソッドs</summary>
static class Extention {
/// <summary>iとjを入れ替える</summary>
public static void Swap<T>(this T[] arr, int i, int j) {
var buf = arr[i];
arr[i] = arr[j];
arr[j] = buf;
}
/// <summary>
/// partition。末尾sArr[r]を基準として、左に基準より小さい数、右に基準より大きい数が存在するように配列を並び替える。
/// </summary>
/// <param name="sArr"></param>
/// <param name="p">partitionの先頭の添字</param>
/// <param name="r">partitionの末尾の添字</param>
/// <returns>partitionの基準が存在する添字</returns>
public static int Partition(this int[] sArr, int p, int r) {
var x = sArr[r];
var i = p - 1;
for (int j = p; j < r; j++) {
if (sArr[j] <= x) {
i++;
sArr.Swap(i, j);
}
}
sArr.Swap(i + 1, r);
return i + 1;
}
/// <summary>深いコピーをする</summary>
public static T DeepCopy<T>(this T obj) {
T result;
var b = new BinaryFormatter();
using (var mem = new MemoryStream()) {
b.Serialize(mem,
obj); // binaryFormatterによりobjをmemにserial化して書き出す
mem.Position = 0; // memのpotisionを先頭に戻す
result = (T)b.Deserialize(mem); // memの内容を読み取る。
}
return result;
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
#if !DEBUG
using System.IO;
#endif
public class Program {
public static void Main() {
#region SetAutoFlushIsFalse
#if !DEBUG
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
#endif
#endregion
var n = ReadLib.ReadAsInt();
var s = Console.ReadLine();
var k = ReadLib.ReadAsInt();
var targetChar = s[k - 1];
var o = new string(s.Select(c => c == targetChar ? c : '*').ToArray());
Console.WriteLine(o);
#region Flush
#if !DEBUG
Console.Out.Flush();
sw.Close();
#endif
#endregion
}
}
internal class Calculation {
internal static long Calc(long x) {
if (x <= 6) {
return 1;
} else if (6 < x && x <= 11) {
return 2;
}
var score = (x / 11) * 2;
var mod = x % 11;
if (mod == 0) {
return score;
} else if (1 <= mod && mod <= 6) {
return score + 1;
} else {
return score + 2;
}
}
}
static class Quick {
internal static void Calculate(int[] ts) { QuickSort(ts, 0, ts.Count() - 1); }
private static void QuickSort(int[] ts, int p, int r) {
if (p < r) {
var q = Partition(ts, p, r);
QuickSort(ts, p, q - 1);
QuickSort(ts, q + 1, r);
}
}
public static int Partition(int[] sArr, int p, int r) {
var x = sArr[r];
var i = p - 1;
for (int j = p; j < r; j++) {
if (sArr[j] <= x) {
i++;
sArr.Swap(i, j);
}
}
sArr.Swap(i + 1, r);
return i + 1;
}
}
static class ReadLib {
public static long ReadAsLong() { return long.Parse(Console.ReadLine()); }
public static int ReadAsInt() { return int.Parse(Console.ReadLine()); }
public static int[] ReadAsIntArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => int.Parse(s) + step)
.ToArray();
}
public static long[] ReadAsLongArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => long.Parse(s) + step)
.ToArray();
}
public static ulong[] ReadAsULongArray() {
return Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray();
}
public static string[] ReadAsStringArray() {
return Console.ReadLine().Split(' ');
}
public static int[] ReadNTimesAsInt(int n, int step = 0) {
return Enumerable.Range(1, n)
.Select(s => int.Parse(Console.ReadLine()) + step)
.ToArray();
}
public static int[][] ReadNTimesAsIntArray(int n, int step = 0) {
return Enumerable.Range(1, n).Select(s => ReadAsIntArray(step)).ToArray();
}
public static string[] ReadNTimesAsString(int n) {
return Enumerable.Range(1, n).Select(s => Console.ReadLine()).ToArray();
}
}
static class WriteLib {
public static void Write<T>(IEnumerable<T> ts) {
ts.ToList().ForEach(s => Console.WriteLine(s));
}
}
static class MyMath {
/// <summary>階乗</summary>
public static long Factorial(int n) {
if (n == 0) {
return 1;
}
return Permutation(n, 0);
}
public static long Permutation(int n, int k) {
return Enumerable.Range(0, n - k)
.Select(i => n - i)
.Aggregate(1, (b, i) => b * i);
}
#region FullPower
/// <summary>総乗、π</summary>
public static long FullPower(IEnumerable<long> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
public static long FullPower(IEnumerable<int> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
#endregion
/// <summary>最大公約数</summary>
public static long Gcd(long item1, long item2) {
var a = Math.Max(item1, item2);
var b = Math.Min(item1, item2);
while (true) {
long mod;
Math.DivRem(a, b, out mod);
if (mod == 0) {
break;
}
a = b;
b = mod;
}
return b;
}
/// <summary>約分。最大公約数で割ったものを返す。</summary>
public static Tuple<long, long> DeviedByGcd(long item1, long item2) {
var gcd = Gcd(item1, item2);
return new Tuple<long, long>(item1 / gcd, item2 / gcd);
}
public static long Lcm(int item1, int item2) {
return Math.BigMul(item1, item2) / Gcd(item1, item2);
}
public static ModCombination ModCombination(int maxN, int mod = 1000000007) {
return new ModCombination(maxN, mod);
}
/// <summary>a^n mod</summary>
public static int ModPow(int a, int n, int mod = 1000000007) {
var res = 1;
while (n > 0) {
if ((n & 1) == 1) {
res = (int)(Math.BigMul(res % mod, a) % mod); // resにaをかける
}
a = (int)(Math.Pow(a % mod, 2) % mod); // 次のaはa^2
n >>= 1;
}
return res;
}
}
static class MyMethod {
/// <summary>数え上げて、key, 出現回数に変換</summary>
public static Dictionary<T, int> CountUp<T>(IEnumerable<T> str) {
return str.GroupBy(c => c)
.Select(g => new KeyValuePair<T, int>(g.Key, g.Count()))
.ToDictionary(e => e.Key, e => e.Value);
}
}
/// <summary>無向グラフ</summary>
class UndirectedGraph {
public Dictionary<int, List<int>> Graph { get; }
/// <param name="graphArr">point1 to point2</param>
/// <param name="n">グラフの全要素数</param>
public UndirectedGraph(int[][] graphArr, int n) {
Graph = new Dictionary<int, List<int>>();
for (int i = 1; i <= n; i++) {
Graph.Add(i, new List<int>());
}
foreach (var arr in graphArr) {
Graph[arr[0]].Add(arr[1]);
Graph[arr[1]].Add(arr[0]);
}
}
}
/// <summary>DeepCopyするクラス</summary>
class DeepCopier {
BinaryFormatter b = new BinaryFormatter();
public T DeepCopy<T>(T obj) {
T result;
using (var mem = new MemoryStream()) {
b.Serialize(mem,
obj); // binaryFormatterによりobjをmemにserial化して書き出す
mem.Position = 0; // memのpotisionを先頭に戻す
result = (T)b.Deserialize(mem); // memの内容を読み取る。
}
return result;
}
}
static class MergeSort {
public static long[] Sort(long[] arr) { return Sort(arr, 0, arr.Count()); }
// rightは+1されていることに注意
private static long[] Merge(long[] sArr, int left, int mid, int right) {
var n1 = mid - left;
var n2 = right - mid;
var lArr = new long[n1 + 1];
var rArr = new long[n2 + 1];
for (int i = 0; i < n1; i++) {
lArr[i] = sArr[left + i];
}
lArr[n1] = int.MaxValue;
for (int i = 0; i < n2; i++) {
rArr[i] = sArr[mid + i];
}
rArr[n2] = int.MaxValue;
int l = 0, r = 0;
for (int k = left; k < right; k++) {
if (lArr[l] <= rArr[r]) {
sArr[k] = lArr[l];
l++;
} else {
sArr[k] = rArr[r];
r++;
}
}
return sArr; // 要素数はright - left
}
private static long[] Sort(long[] sArr, int left, int right) {
if (left + 1 < right) {
var mid = (left + right) / 2;
sArr = Sort(sArr, left, mid);
sArr = Sort(sArr, mid, right);
sArr = Merge(sArr, left, mid, right);
}
return sArr;
}
}
/// <summary>あまりを計算するためのintのラッパー</summary>
struct ModInt {
int Value { get; }
int Mod { get; }
public override string ToString() { return Value.ToString(); }
public static explicit operator ModInt(long value) {
return new ModInt(value);
}
public ModInt(long value, int mod = 1000000007) {
this.Value = (int)(value % mod);
this.Mod = mod;
}
public static explicit operator int(ModInt modInt) { return modInt.Value; }
private static void CheckNotEqualMod(ModInt item1, ModInt item2) {
if (item1.Mod != item2.Mod) {
throw new Exception("mod not equal");
}
}
public static ModInt operator +(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = item1.Value + item2.Value;
return new ModInt(value, item1.Mod);
}
public static ModInt operator *(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = Math.BigMul(item1.Value, item2.Value);
return new ModInt(value, item1.Mod);
}
public static ModInt operator -(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = item1.Value - item2.Value;
if (value < 0) {
value += item1.Mod;
}
return new ModInt(value, item1.Mod);
}
public static ModInt operator +(ModInt item1, int item2) {
return item1 + new ModInt(item2, item1.Mod);
}
public static ModInt operator *(ModInt item1, int item2) {
return item1 * new ModInt(item2, item1.Mod);
}
public static ModInt operator -(ModInt item1, int item2) {
return item1 - new ModInt(item2, item1.Mod);
}
public override int GetHashCode() { return this.Value; }
public override bool Equals(object obj) {
if (obj == null || this.GetType() != obj.GetType()) {
return false;
}
var modIntObj = (ModInt)obj;
return modIntObj.Value == this.Value;
}
public static bool operator ==(ModInt item1, ModInt item2) {
return item1.Value == item2.Value;
}
public static bool operator !=(ModInt item1, ModInt item2) {
return !(item1 == item2);
}
public static bool operator ==(ModInt item1, int item2) {
return item1.Value == item2;
}
public static bool operator !=(ModInt item1, int item2) {
return !(item1.Value == item2);
}
public static bool operator >=(ModInt item1, ModInt item2) {
return item1.Value >= item2.Value;
}
public static bool operator <=(ModInt item1, ModInt item2) {
return item1.Value <= item2.Value;
}
public static bool operator >=(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator <=(ModInt item1, int item2) {
return item1.Value <= item2;
}
public static bool operator>(ModInt item1, ModInt item2) {
return item1.Value > item2.Value;
}
public static bool operator<(ModInt item1, ModInt item2) {
return item1.Value < item2.Value;
}
public static bool operator>(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator<(ModInt item1, int item2) {
return item1.Value <= item2;
}
}
/// <summary>組み合わせ</summary>
class ModCombination {
private int mod;
private int[] fac;
private int[] finv;
private int[] inv;
public ModCombination(int max, int mod = 1000000007) {
this.mod = mod;
fac = new int[max]; // modが法のn!の列
inv = new int[max]; // indexの逆元の列
finv = new int[max]; // modを法とした、invの累積の累積
fac[0] = 1;
fac[1] = 1;
finv[0] = 1;
finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < max; i++) {
fac[i] = (int)(Math.BigMul(fac[i - 1], i) % mod); // factorを求める
var s = Math.BigMul(inv[mod % i], mod / i) % mod;
inv[i] = (int)(mod - s);
// iに対する逆元を求める
finv[i] = (int)(Math.BigMul(finv[i - 1], inv[i]) % mod);
}
}
/// <summary>nCk</summary>
public int Calculation(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return (int)(Math.BigMul(fac[n],
(int)(Math.BigMul(finv[k], finv[n - k]) % mod)) %
mod);
}
}
/// <summary>拡張メソッドs</summary>
static class Extention {
/// <summary>iとjを入れ替える</summary>
public static void Swap<T>(this T[] arr, int i, int j) {
var buf = arr[i];
arr[i] = arr[j];
arr[j] = buf;
}
/// <summary>
/// partition。末尾sArr[r]を基準として、左に基準より小さい数、右に基準より大きい数が存在するように配列を並び替える。
/// </summary>
/// <param name="sArr"></param>
/// <param name="p">partitionの先頭の添字</param>
/// <param name="r">partitionの末尾の添字</param>
/// <returns>partitionの基準が存在する添字</returns>
public static int Partition(this int[] sArr, int p, int r) {
var x = sArr[r];
var i = p - 1;
for (int j = p; j < r; j++) {
if (sArr[j] <= x) {
i++;
sArr.Swap(i, j);
}
}
sArr.Swap(i + 1, r);
return i + 1;
}
/// <summary>深いコピーをする</summary>
public static T DeepCopy<T>(this T obj) {
T result;
var b = new BinaryFormatter();
using (var mem = new MemoryStream()) {
b.Serialize(mem,
obj); // binaryFormatterによりobjをmemにserial化して書き出す
mem.Position = 0; // memのpotisionを先頭に戻す
result = (T)b.Deserialize(mem); // memの内容を読み取る。
}
return result;
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 3,054
| 2
|
using System;
namespace Project {
class Mains {
static void Main() {
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
int K = int.Parse(Console.ReadLine());
char n = S[K];
char[] ca = S.ToCharArray();
for (int i = 0; i < ca.Length; i++) {
if (ca[i] != n) {
ca[i] = '*';
}
}
Console.Write(new String(ca));
}
}
}
|
using System;
namespace Project {
class Mains {
static void Main() {
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
int K = int.Parse(Console.ReadLine());
char n = S[K - 1];
char[] ca = S.ToCharArray();
for (int i = 0; i < ca.Length; i++) {
if (ca[i] != n) {
ca[i] = '*';
}
}
Console.Write(new String(ca));
}
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 123
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoderCS {
class Program {
static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
int K = int.Parse(Console.ReadLine());
for (int i = 0; i < N; i++) {
if (S[i] == S[K])
;
else {
S = S.Replace(S[i], '*');
}
}
Console.WriteLine(S);
Console.ReadLine();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoderCS {
class Program {
static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
int K = int.Parse(Console.ReadLine());
for (int i = 0; i < N; i++) {
if (S[i] == S[K - 1])
;
else {
S = S.Replace(S[i], '*');
}
}
Console.WriteLine(S);
Console.ReadLine();
}
}
}
|
[["+", 12, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 12, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 144
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp6 {
class Program {
static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
char[] S = Console.ReadLine().ToArray();
int K = int.Parse(Console.ReadLine());
for (int i = 0; i < S.Length; i++) {
if (S[i] != S[K]) {
S[i] = '*';
}
Console.Write(S[i]);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp6 {
class Program {
static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
char[] S = Console.ReadLine().ToArray();
int K = int.Parse(Console.ReadLine());
for (int i = 0; i < S.Length; i++) {
if (S[i] != S[K - 1]) {
S[i] = '*';
}
Console.Write(S[i]);
}
}
}
}
|
[["+", 12, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 12, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 140
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Program {
static void Main(string[] args) {
var N = int.Parse(Console.ReadLine());
var S = Console.ReadLine();
var K = int.Parse(Console.ReadLine());
var target = S[K];
var result = new char[N];
for (int i = 0; i < N; i++) {
if (S[i] == target)
result[i] = target;
else
result[i] = '*';
}
Console.WriteLine(new String(result));
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Program {
static void Main(string[] args) {
var N = int.Parse(Console.ReadLine());
var S = Console.ReadLine();
var K = int.Parse(Console.ReadLine());
var target = S[K - 1];
var result = new char[N];
for (int i = 0; i < N; i++) {
if (S[i] == target)
result[i] = target;
else
result[i] = '*';
}
Console.WriteLine(new String(result));
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 138
| 2
|
using System;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
int input1 = int.Parse(Console.ReadLine());
var input2 = Console.ReadLine();
int input3 = int.Parse(Console.ReadLine());
var moji = input2.Substring(input3, 1);
var tmp = "";
var output = "";
for (int i = 0; i < input1; i++) {
tmp = input2.Substring(i, 1);
if (tmp.Equals(moji)) {
output = output + tmp;
} else {
output = output + "*";
}
}
Console.WriteLine(output);
}
}
|
using System;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
int input1 = int.Parse(Console.ReadLine());
var input2 = Console.ReadLine();
int input3 = int.Parse(Console.ReadLine());
var moji = input2.Substring(input3 - 1, 1);
var tmp = "";
var output = "";
for (int i = 0; i < input1; i++) {
tmp = input2.Substring(i, 1);
if (tmp.Equals(moji)) {
output = output + tmp;
} else {
output = output + "*";
}
}
Console.WriteLine(output);
}
}
|
[["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
| 8
| 148
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace T1PBC2019B {
class MainClass {
static int[] s;
static int[] n;
public static void Main(string[] args) {
s = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
string str = Console.ReadLine();
n = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
char c = str[n[0]];
string ans = "";
for (int i = 0; i < s[0]; i++) {
if (str[i] == c) {
ans += c;
} else {
ans += '*';
}
}
Console.WriteLine(ans);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace T1PBC2019B {
class MainClass {
static int[] s;
static int[] n;
public static void Main(string[] args) {
s = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
string str = Console.ReadLine();
n = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
char c = str[n[0] - 1];
string ans = "";
for (int i = 0; i < s[0]; i++) {
if (str[i] == c) {
ans += c;
} else {
ans += '*';
}
}
Console.WriteLine(ans);
}
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 173
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
class myon {
public static void Main(string[] args) { var myon = new myon(); }
public myon() {
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
int K = int.Parse(Console.ReadLine());
char k = S[K];
char[] output = new char[N];
for (int i = 0; i < N; i++) {
if (S[i] != k) {
Console.Write("*");
// output[i] = '*';
} else {
Console.Write(S[i].ToString());
output[i] = S[i];
}
}
// Console.WriteLine(S);
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
class myon {
public static void Main(string[] args) { var myon = new myon(); }
public myon() {
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
int K = int.Parse(Console.ReadLine());
char k = S[K - 1];
char[] output = new char[N];
for (int i = 0; i < N; i++) {
if (S[i] != k) {
Console.Write("*");
// output[i] = '*';
} else {
Console.Write(S[i].ToString());
output[i] = S[i];
}
}
// Console.WriteLine(S);
}
}
|
[["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 171
| 2
|
using System;
using System.Linq;
namespace TBCB {
class Program {
static void Main(string[] args) {
var N = int.Parse(Console.ReadLine());
var S = Console.ReadLine().ToArray();
var K = int.Parse(Console.ReadLine());
for (var i = 0; i < N; i++) {
if (S[K] != S[i]) {
S[i] = '*';
}
}
Console.WriteLine(S);
}
}
}
|
using System;
using System.Linq;
namespace TBCB {
class Program {
static void Main(string[] args) {
var N = int.Parse(Console.ReadLine());
var S = Console.ReadLine().ToArray();
var K = int.Parse(Console.ReadLine());
for (var i = 0; i < N; i++) {
if (S[K - 1] != S[i]) {
S[i] = '*';
}
}
Console.WriteLine(S);
}
}
}
|
[["+", 31, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 31, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 114
| 2
|
using System;
public class Program {
public static void Main() {
//°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸Kobato
//Love°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸
int a, c;
string b;
a = int.Parse(Console.ReadLine());
b = Console.ReadLine();
c = int.Parse(Console.ReadLine());
string res = "";
for (int i = 0; i < b.Length; i++) {
if (b[i] == b[c]) {
res += b[i];
} else {
res += '*';
}
}
Console.WriteLine(res);
}
}
|
using System;
public class Program {
public static void Main() {
//°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸Kobato
//Love°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸
int a, c;
string b;
a = int.Parse(Console.ReadLine());
b = Console.ReadLine();
c = int.Parse(Console.ReadLine());
string res = "";
for (int i = 0; i < b.Length; i++) {
if (b[i] == b[c - 1]) {
res += b[i];
} else {
res += '*';
}
}
Console.WriteLine(res);
}
}
|
[["+", 12, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 12, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 121
| 2
|
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
namespace AtCoder124 {
class Program {
public static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
int K = int.Parse(Console.ReadLine());
char s = S[K - 1];
char[] res = new char[N];
for (int i = 0; i < N; i++) {
res[i] = (S[i] == s) ? '*' : S[i];
}
string resS = new string(res);
Console.WriteLine(resS);
}
}
}
|
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
namespace AtCoder124 {
class Program {
public static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
int K = int.Parse(Console.ReadLine());
char s = S[K - 1];
char[] res = new char[N];
for (int i = 0; i < N; i++) {
res[i] = (S[i] != s) ? '*' : S[i];
}
string resS = new string(res);
Console.WriteLine(resS);
}
}
}
|
[["-", 0, 11, 12, 41, 15, 23, 0, 16, 17, 60], ["+", 0, 11, 12, 41, 15, 23, 0, 16, 17, 79]]
| 8
| 153
| 2
|
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
class Program {
static void Main(string[] args) {
// 入力
// var s = Console.ReadLine();
var n = long.Parse(Console.ReadLine());
char[] s = Console.ReadLine().ToCharArray();
var ans = long.MaxValue;
long[] b = new long[n];
long[] w = new long[n];
if (s[0] == '.')
w[0] = 1;
if (s[0] == '#')
b[0] = 1;
for (int i = 1; i < n; i++) {
if (s[i] == '.')
w[i] = w[i - 1] + 1;
else
w[i] = w[i - 1];
if (s[i] == '#')
b[i] = b[i - 1] + 1;
else
b[i] = b[i - 1];
}
ans = Math.Min(ans, w[n - 1]);
ans = Math.Min(ans, b[n - 1]);
for (int i = 1; i < n - 1; i++) {
var a = (b[n - i - 1]);
var c = (w[n - 1] - w[n - i - 1]);
ans = Math.Min(ans, (b[n - i - 1]) + (w[n - 1] - w[n - i - 1]));
}
// 出力
Console.WriteLine(ans);
}
}
|
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
class Program {
static void Main(string[] args) {
// 入力
// var s = Console.ReadLine();
var n = long.Parse(Console.ReadLine());
char[] s = Console.ReadLine().ToCharArray();
var ans = long.MaxValue;
long[] b = new long[n];
long[] w = new long[n];
if (s[0] == '.')
w[0] = 1;
if (s[0] == '#')
b[0] = 1;
for (int i = 1; i < n; i++) {
if (s[i] == '.')
w[i] = w[i - 1] + 1;
else
w[i] = w[i - 1];
if (s[i] == '#')
b[i] = b[i - 1] + 1;
else
b[i] = b[i - 1];
}
ans = Math.Min(ans, w[n - 1]);
ans = Math.Min(ans, b[n - 1]);
for (int i = 0; i < n; i++) {
var a = (b[n - i - 1]);
var c = (w[n - 1] - w[n - i - 1]);
ans = Math.Min(ans, (b[n - i - 1]) + (w[n - 1] - w[n - i - 1]));
}
// 出力
Console.WriteLine(ans);
}
}
|
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203]]
| 8
| 359
| 4
|
using System;
//黒白を累積和で保存する
namespace C {
class Program {
static void Main(string[] args) {
int n = int.Parse(Console.ReadLine());
string s = Console.ReadLine();
int b = 0, w = 0;
int[] A = new int[n];
int[] C = new int[n + 1]; // Cumulative sum
for (int i = 0; i < n; i++) {
if (s[i] == '.')
w++;
if (s[i] == '#') {
b++;
A[i] = 1;
}
}
C[0] = A[0];
for (int i = 1; i < n; i++) {
C[i] = A[i] + C[i - 1];
}
int min = 1001001001;
for (int i = 0; i < n; i++) {
int sum = 0;
//基準より左にある黒の数
sum += C[i];
//右にある白の数
sum += b - (i + 1 - C[i]);
if (sum >= 0)
min = (int)Math.Min(min, sum);
}
min = (int)Math.Min(min, (int)Math.Min(w, b));
Console.WriteLine(min);
}
}
}
// namespace C
//{
// class Program
// {
// static void Main(string[] args)
// {
// int n = int.Parse(Console.ReadLine());
// string s = Console.ReadLine();
// int w = 0;
// int wlast = -1;
// int b = 0;
// int bfirst = -1;
// int ans = 100100100;
// for (int i = 0; i < n; i++)
// {
// if (s[i] == '.')
// {
// w++;
// wlast = i;
// }
// if (s[i] == '#')
// {
// b++;
// if (bfirst == -1) bfirst = i;
// }
// }
// //全部白にする
// ans = (int)Math.Min(ans, b);
// //全部黒
// ans = (int)Math.Min(ans, w);
// //左詰め白
// if (w > 0)
// {
// int cnt = 0;
// for (int i = 0; i <= wlast; i++)
// {
// if (s[i] == '#') cnt++;
// }
// ans = (int)Math.Min(ans, cnt);
// }
// //右詰め黒
// if (b > 0)
// {
// int cnt = 0;
// for (int i = bfirst; i <n; i++)
// {
// if (s[i] == '.') cnt++;
// }
// ans = (int)Math.Min(ans, cnt);
// }
// Console.WriteLine(ans);
// }
// }
//}
// namespace C
//{
// class Program
// {
// static void Main(string[] args)
// {
// int n = int.Parse(Console.ReadLine());
// string s = Console.ReadLine();
// int w = 0;
// int b = 0;
// for(int i = 0; i < n; i++)
// {
// if (s[i] == '.') w++;
// if (s[i] == '#') b++;
// }
// int ans = 0;
// if (w >= b)
// {
// ans = b;
// int cnt = n-1;
// while (s[cnt] == '#')
// {
// ans--;
// cnt--;
// }
// }else if (w < b)
// {
// ans = w;
// int cnt = 0;
// while (s[cnt] == '.')
// {
// ans--;
// cnt++;
// }
// }
// Console.WriteLine(ans);
// }
// }
//}
|
using System;
//黒白を累積和で保存する
namespace C {
class Program {
static void Main(string[] args) {
int n = int.Parse(Console.ReadLine());
string s = Console.ReadLine();
int b = 0, w = 0;
int[] A = new int[n];
int[] C = new int[n]; // Cumulative sum
for (int i = 0; i < n; i++) {
if (s[i] == '.')
w++;
if (s[i] == '#') {
b++;
A[i] = 1;
}
}
C[0] = A[0];
for (int i = 1; i < n; i++) {
C[i] = A[i] + C[i - 1];
}
int min = 1001001001;
for (int i = 0; i < n; i++) {
int sum = 0;
//基準より左にある黒の数
sum += C[i];
//右にある白の数
sum += w - (i + 1 - C[i]);
if (sum >= 0)
min = (int)Math.Min(min, sum);
}
min = (int)Math.Min(min, (int)Math.Min(w, b));
Console.WriteLine(min);
}
}
}
// namespace C
//{
// class Program
// {
// static void Main(string[] args)
// {
// int n = int.Parse(Console.ReadLine());
// string s = Console.ReadLine();
// int w = 0;
// int wlast = -1;
// int b = 0;
// int bfirst = -1;
// int ans = 100100100;
// for (int i = 0; i < n; i++)
// {
// if (s[i] == '.')
// {
// w++;
// wlast = i;
// }
// if (s[i] == '#')
// {
// b++;
// if (bfirst == -1) bfirst = i;
// }
// }
// //全部白にする
// ans = (int)Math.Min(ans, b);
// //全部黒
// ans = (int)Math.Min(ans, w);
// //左詰め白
// if (w > 0)
// {
// int cnt = 0;
// for (int i = 0; i <= wlast; i++)
// {
// if (s[i] == '#') cnt++;
// }
// ans = (int)Math.Min(ans, cnt);
// }
// //右詰め黒
// if (b > 0)
// {
// int cnt = 0;
// for (int i = bfirst; i <n; i++)
// {
// if (s[i] == '.') cnt++;
// }
// ans = (int)Math.Min(ans, cnt);
// }
// Console.WriteLine(ans);
// }
// }
//}
// namespace C
//{
// class Program
// {
// static void Main(string[] args)
// {
// int n = int.Parse(Console.ReadLine());
// string s = Console.ReadLine();
// int w = 0;
// int b = 0;
// for(int i = 0; i < n; i++)
// {
// if (s[i] == '.') w++;
// if (s[i] == '#') b++;
// }
// int ans = 0;
// if (w >= b)
// {
// ans = b;
// int cnt = n-1;
// while (s[cnt] == '#')
// {
// ans--;
// cnt--;
// }
// }else if (w < b)
// {
// ans = w;
// int cnt = 0;
// while (s[cnt] == '.')
// {
// ans--;
// cnt++;
// }
// }
// Console.WriteLine(ans);
// }
// }
//}
|
[["-", 0, 227, 39, 224, 225, 226, 0, 16, 17, 72], ["-", 0, 227, 39, 224, 225, 226, 0, 16, 12, 203], ["-", 8, 196, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 31, 22]]
| 8
| 370
| 4
|
using System;
using System.Linq;
namespace C___Stones {
class Program {
static void Main(string[] args) {
var N = int.Parse(Console.ReadLine());
var S = Console.ReadLine();
var S_rev = string.Join("", S.Reverse());
int[] w_arr = new int[N + 1], b_arr = new int[N + 1];
int cost = 0, min = int.MaxValue;
for (int i = 0; i <= N; i++) {
if (i == 0) {
w_arr[i] = 0;
b_arr[i] = 0;
continue;
}
w_arr[i] = S[i - 1] == '#' ? ++w_arr[i - 1] : w_arr[i - 1];
b_arr[i] = S_rev[i - 1] == '.' ? ++b_arr[i - 1] : b_arr[i - 1];
}
for (int i = 0; i <= N; i++) {
cost = w_arr[i] + b_arr[N - i];
min = Math.Min(min, cost);
}
Console.WriteLine(min);
}
}
}
|
using System;
using System.Linq;
namespace C___Stones {
class Program {
static void Main(string[] args) {
var N = int.Parse(Console.ReadLine());
var S = Console.ReadLine();
var S_rev = string.Join("", S.Reverse());
int[] w_arr = new int[N + 1], b_arr = new int[N + 1];
int cost = 0, min = int.MaxValue;
for (int i = 0; i <= N; i++) {
if (i == 0) {
w_arr[i] = 0;
b_arr[i] = 0;
continue;
}
w_arr[i] = S[i - 1] == '#' ? w_arr[i - 1] + 1 : w_arr[i - 1];
b_arr[i] = S_rev[i - 1] == '.' ? b_arr[i - 1] + 1 : b_arr[i - 1];
}
for (int i = 0; i <= N; i++) {
cost = w_arr[i] + b_arr[N - i];
min = Math.Min(min, cost);
}
Console.WriteLine(min);
}
}
}
|
[["-", 0, 1, 0, 11, 12, 41, 64, 241, 0, 29], ["+", 0, 1, 0, 11, 12, 41, 64, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 41, 64, 16, 12, 203]]
| 8
| 251
| 6
|
using System;
namespace AtCoder {
class Program {
static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
char[] c = Console.ReadLine().ToCharArray();
if (N == 1) {
Console.WriteLine("0");
return;
}
int[] white = new int[N];
if (c[0] == '.')
white[0] = 1;
else
white[0] = 0;
for (int i = 1; i < N; i++) {
if (c[i] == '.')
white[i] = white[i - 1] + 1;
else
white[i] = white[i - 1];
}
int allw = white[N - 1];
int ans = int.MaxValue;
for (int i = 0; i < N; i++) {
int temp = i + 1 + allw - white[i] * 2;
if (ans > temp)
ans = temp;
}
Console.WriteLine(ans.ToString());
}
}
}
|
using System;
namespace AtCoder {
class Program {
static void Main(string[] args) {
int N = int.Parse(Console.ReadLine());
char[] c = Console.ReadLine().ToCharArray();
if (N == 1) {
Console.WriteLine("0");
return;
}
int[] white = new int[N];
if (c[0] == '.')
white[0] = 1;
else
white[0] = 0;
for (int i = 1; i < N; i++) {
if (c[i] == '.')
white[i] = white[i - 1] + 1;
else
white[i] = white[i - 1];
}
int allw = white[N - 1];
int ans = allw;
for (int i = 0; i < N; i++) {
int temp = i + 1 + allw - white[i] * 2;
if (ans > temp)
ans = temp;
}
Console.WriteLine(ans.ToString());
}
}
}
|
[["-", 0, 198, 0, 200, 0, 212, 0, 214, 205, 199], ["-", 0, 198, 0, 200, 0, 212, 0, 214, 0, 131], ["-", 0, 198, 0, 200, 0, 212, 0, 214, 141, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 22]]
| 8
| 231
| 4
|
using System;
using System.Linq;
namespace T1PBC {
class Program {
static void Main(string[] args) {
int input = int.Parse(Console.ReadLine());
string s = Console.ReadLine();
int Rwhite = s.Count(x => x == '.');
int RBlack = s.Count(x => x == '#');
int LBlack = 0;
int result = Rwhite + RBlack;
for (int i = 0; i < input; i++) {
if (s[i] == '.') {
Rwhite--;
} else {
LBlack++;
}
if ((LBlack + Rwhite) < result) {
result = LBlack + Rwhite;
}
}
Console.WriteLine(result);
}
}
}
|
using System;
using System.Linq;
namespace T1PBC {
class Program {
static void Main(string[] args) {
int input = int.Parse(Console.ReadLine());
string s = Console.ReadLine();
int Rwhite = s.Count(x => x == '.');
int RBlack = s.Count(x => x == '#');
int LBlack = 0;
int result = Rwhite + LBlack;
for (int i = 0; i < input; i++) {
if (s[i] == '.') {
Rwhite--;
} else {
LBlack++;
}
if ((LBlack + Rwhite) < result) {
result = LBlack + Rwhite;
}
}
Console.WriteLine(result);
}
}
}
|
[["-", 0, 198, 0, 200, 0, 212, 0, 16, 12, 22], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 22]]
| 8
| 157
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder {
class Program {
static void Main(string[] args) {
int n = int.Parse(Console.ReadLine());
string s = Console.ReadLine();
int[] white = new int[n];
int[] black = new int[n];
white[n - 1] = s[n - 1] == '.' ? 1 : 0;
black[0] = s[0] == '#' ? 1 : 0;
for (int i = 1; i < s.Length; i++) {
black[i] = black[i - 1] + (s[i] == '#' ? 1 : 0);
}
for (int i = n - 2; i >= 0; i++) {
white[i] = white[i + 1] + (s[i] == '.' ? 1 : 0);
}
int min = Math.Min(black[n - 1], white[0]);
for (int i = 0; i < n; i++) {
int next = white[i] + black[i - 1];
min = Math.Min(next, min);
}
Console.WriteLine(min);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder {
class Program {
static void Main(string[] args) {
int n = int.Parse(Console.ReadLine());
string s = Console.ReadLine();
int[] white = new int[n];
int[] black = new int[n];
white[n - 1] = s[n - 1] == '.' ? 1 : 0;
black[0] = s[0] == '#' ? 1 : 0;
for (int i = 1; i < s.Length; i++) {
black[i] = black[i - 1] + (s[i] == '#' ? 1 : 0);
}
for (int i = n - 2; i >= 0; i--) {
white[i] = white[i + 1] + (s[i] == '.' ? 1 : 0);
}
int min = Math.Min(black[n - 1], white[0]);
for (int i = 1; i < n; i++) {
int next = white[i] + black[i - 1];
min = Math.Min(next, min);
}
Console.WriteLine(min);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 26, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 7, 26, 223, 0, 68], ["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
| 8
| 290
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
// using System.Text;
// using System.Threading.Tasks;
class Program {
static void Main(string[] args) {
//黒から白に変わるポイントを消すための対処法は次の二通り。
//最初に黒から白に変わるポイント以降を全部黒にする
//最後に黒から白に変わるポイント以前を全部白にする
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
if (S == "#" || S == ".") {
Console.WriteLine(0);
return;
}
//それより左に何個黒があるかを知る配列。
int[] arr1 = new int[N + 1];
//それより左に何個白があるかを知る配列
int[] arr2 = new int[N + 1];
int siroNum = 0;
int kuroNum = 0;
for (int i = 0; i < N; i++) {
char c = S[i];
if (c == '#')
kuroNum++;
else if (c == '.')
siroNum++;
arr1[i + 1] = kuroNum;
arr2[i + 1] = siroNum;
}
int ans = int.MaxValue;
for (int i = 0; i < N; i++) {
//境界前を全部白にして境界後を全部黒にすると仮定するとどれだけ
int n1 = arr1[i];
int n2 = arr2[N - 1] - arr2[i];
ans = Math.Min(ans, n1 + n2);
}
Console.WriteLine(ans);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
// using System.Text;
// using System.Threading.Tasks;
class Program {
static void Main(string[] args) {
//黒から白に変わるポイントを消すための対処法は次の二通り。
//最初に黒から白に変わるポイント以降を全部黒にする
//最後に黒から白に変わるポイント以前を全部白にする
int N = int.Parse(Console.ReadLine());
string S = Console.ReadLine();
if (S == "#" || S == ".") {
Console.WriteLine(0);
return;
}
//それより左に何個黒があるかを知る配列。
int[] arr1 = new int[N + 1];
//それより左に何個白があるかを知る配列
int[] arr2 = new int[N + 1];
int siroNum = 0;
int kuroNum = 0;
for (int i = 0; i < N; i++) {
char c = S[i];
if (c == '#')
kuroNum++;
else if (c == '.')
siroNum++;
arr1[i + 1] = kuroNum;
arr2[i + 1] = siroNum;
}
int ans = int.MaxValue;
for (int i = 0; i < N + 1; i++) {
//境界前を全部白にして境界後を全部黒にすると仮定するとどれだけ
int n1 = arr1[i];
int n2 = arr2[N] - arr2[i];
ans = Math.Min(ans, n1 + n2);
}
Console.WriteLine(ans);
}
}
|
[["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203], ["-", 31, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["-", 31, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 253
| 4
|
using System;
using System.Linq;
using System.Collections.Generic;
using E = System.Linq.Enumerable;
public class Program {
public static void Main() {
var n = int.Parse(Console.ReadLine());
var s = Console.ReadLine().Trim().Select(x => x == '.' ? 0 : 1).ToArray();
var sum = new int [s.Length + 1][];
sum[0] = new int[2];
for (int i = 1; i < sum.Length; i++) {
sum[i] = new int[sum[i - 1].Length];
for (int j = 0; j < sum[i].Length; j++) {
sum[i][j] = sum[i - 1][j];
}
sum[i][s[i - 1]]++;
}
var minimum = int.MaxValue;
for (int i = 1; i < sum.Length; i++) {
var w = sum.Last()[0] - sum[i][0];
var b = sum[i][1]; // - sum.First()[1];
minimum = Math.Min(minimum, w + b);
}
Console.WriteLine(minimum);
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
using E = System.Linq.Enumerable;
public class Program {
public static void Main() {
var n = int.Parse(Console.ReadLine());
var s = Console.ReadLine().Trim().Select(x => x == '.' ? 0 : 1).ToArray();
var sum = new int [s.Length + 1][];
sum[0] = new int[2];
for (int i = 1; i < sum.Length; i++) {
sum[i] = new int[sum[i - 1].Length];
for (int j = 0; j < sum[i].Length; j++) {
sum[i][j] = sum[i - 1][j];
}
sum[i][s[i - 1]]++;
}
var minimum = int.MaxValue;
for (int i = 0; i < sum.Length; i++) {
var w = sum.Last()[0] - sum[i][0];
var b = sum[i][1]; // - sum.First()[1];
minimum = Math.Min(minimum, w + b);
}
Console.WriteLine(minimum);
}
}
|
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
| 8
| 275
| 2
|
using System;
using System.IO;
using System.Linq;
class Program {
static void Solve() {
// . -> white, # -> black
var N = ReadInt();
var S = Read();
var whites = new int[N];
if (S[0] == '.')
whites[0]++;
for (var i = 1; i < N; i++) {
whites[i] = whites[i - 1];
if (S[i] == '.')
whites[i]++;
}
var ans = N;
for (var border = 0; border < N; border++) // end of whites
{
var diff =
(border - whites[border] + 1) + (whites[N - 1] - whites[border]);
if (diff < ans)
ans = diff;
}
Console.WriteLine(ans);
}
static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
Solve();
Console.Out.Flush();
}
public static string Read() { return Console.ReadLine(); }
public static int ReadInt() { return int.Parse(Read()); }
public static long ReadLong() { return long.Parse(Read()); }
public static double ReadDouble() { return double.Parse(Read()); }
public static string[] Reads() { return Console.ReadLine().Split(' '); }
public static int[] ReadInts() {
return Reads().Select(_ => int.Parse(_)).ToArray();
}
public static long[] ReadLongs() {
return Reads().Select(_ => long.Parse(_)).ToArray();
}
public static double[] ReadDoubles() {
return Reads().Select(_ => double.Parse(_)).ToArray();
}
}
|
using System;
using System.IO;
using System.Linq;
class Program {
static void Solve() {
// . -> white, # -> black
var N = ReadInt();
var S = Read();
var whites = new int[N];
if (S[0] == '.')
whites[0]++;
for (var i = 1; i < N; i++) {
whites[i] = whites[i - 1];
if (S[i] == '.')
whites[i]++;
}
var ans = whites[N - 1];
for (var border = 0; border < N; border++) // end of whites
{
var diff =
(border - whites[border] + 1) + (whites[N - 1] - whites[border]);
if (diff < ans)
ans = diff;
}
Console.WriteLine(ans);
}
static void Main(string[] args) {
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
Solve();
Console.Out.Flush();
}
public static string Read() { return Console.ReadLine(); }
public static int ReadInt() { return int.Parse(Read()); }
public static long ReadLong() { return long.Parse(Read()); }
public static double ReadDouble() { return double.Parse(Read()); }
public static string[] Reads() { return Console.ReadLine().Split(' '); }
public static int[] ReadInts() {
return Reads().Select(_ => int.Parse(_)).ToArray();
}
public static long[] ReadLongs() {
return Reads().Select(_ => long.Parse(_)).ToArray();
}
public static double[] ReadDoubles() {
return Reads().Select(_ => double.Parse(_)).ToArray();
}
}
|
[["+", 0, 198, 0, 200, 0, 212, 0, 204, 205, 22], ["+", 0, 200, 0, 212, 0, 204, 206, 207, 0, 70], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203], ["+", 0, 200, 0, 212, 0, 204, 206, 207, 0, 73]]
| 8
| 411
| 5
|
using System;
using System.Linq;
namespace Sample {
class Sample {
static void Main(string[] args) {
string[] str = Console.ReadLine().Split(' ');
int A = int.Parse(str[0]);
int B = int.Parse(str[1]);
int ans = 0;
for (int i = 1; i <= 2; i++) {
if (A <= B) {
ans += A;
A = A - 1;
} else {
ans += B;
B = B - 1;
}
}
Console.WriteLine(ans);
}
}
}
|
using System;
using System.Linq;
namespace Sample {
class Sample {
static void Main(string[] args) {
string[] str = Console.ReadLine().Split(' ');
int A = int.Parse(str[0]);
int B = int.Parse(str[1]);
int ans = 0;
for (int i = 1; i <= 2; i++) {
if (A >= B) {
ans += A;
A = A - 1;
} else {
ans += B;
B = B - 1;
}
}
Console.WriteLine(ans);
}
}
}
|
[["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 20]]
| 8
| 130
| 2
|
using System;
using static System.Console;
using System.Linq;
namespace Main {
class Program {
static void Main(string[] args) {
int[] tmp = ReadLine().Split(' ').Select(int.Parse).ToArray();
Array.Sort(tmp);
WriteLine(tmp[0] == tmp[1] ? tmp[0] * tmp[1] : tmp[1] + tmp[1] - 1);
}
}
}
|
using System;
using static System.Console;
using System.Linq;
namespace Main {
class Program {
static void Main(string[] args) {
int[] tmp = ReadLine().Split(' ').Select(int.Parse).ToArray();
Array.Sort(tmp);
WriteLine(tmp[0] == tmp[1] ? tmp[0] + tmp[1] : tmp[1] + tmp[1] - 1);
}
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 64, 16, 17, 48], ["+", 3, 4, 0, 28, 0, 41, 64, 16, 17, 72]]
| 8
| 102
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder {
class Program {
static void Main() {
Solve();
Console.ReadKey();
}
static void Solve() {
var s = GetIntArray().OrderBy(p => p).ToArray();
var ans = 0;
ans += s[0];
s[0]--;
ans += s.Max();
Console.Write(ans);
}
static public string GetStr() { return Console.ReadLine(); }
static public int GetInt() { return int.Parse(Console.ReadLine()); }
static public long GetLong() { return long.Parse(Console.ReadLine()); }
static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
static public int[] GetIntArray() {
return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
}
static public long[] GetLongArray() {
return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
}
static public List<double> GetDoubleList() {
return Console.ReadLine().Split(' ').Select(double.Parse).ToList();
}
static public void WriteObjects<T>(IEnumerable<T> values) {
foreach (var o in values) {
Console.Write(o + " ");
}
}
static bool eq<T, U>() => typeof(T).Equals(typeof(U));
static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
: eq<T, long>() ? ct<T, long>(long.Parse(s))
: eq<T, double>() ? ct<T, double>(double.Parse(s))
: eq<T, char>() ? ct<T, char>(s[0])
: ct<T, string>(s);
static void Multi<T>(out T a) => a = cv<T>(GetStr());
static void Multi<T, U>(out T a, out U b) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
}
static void Multi<T, U, V>(out T a, out U b, out V c) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
c = cv<V>(ar[2]);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder {
class Program {
static void Main() {
Solve();
Console.ReadKey();
}
static void Solve() {
var s = GetIntArray().OrderByDescending(p => p).ToArray();
var ans = 0;
ans += s[0];
s[0]--;
ans += s.Max();
Console.Write(ans);
}
static public string GetStr() { return Console.ReadLine(); }
static public int GetInt() { return int.Parse(Console.ReadLine()); }
static public long GetLong() { return long.Parse(Console.ReadLine()); }
static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
static public int[] GetIntArray() {
return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
}
static public long[] GetLongArray() {
return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
}
static public List<double> GetDoubleList() {
return Console.ReadLine().Split(' ').Select(double.Parse).ToList();
}
static public void WriteObjects<T>(IEnumerable<T> values) {
foreach (var o in values) {
Console.Write(o + " ");
}
}
static bool eq<T, U>() => typeof(T).Equals(typeof(U));
static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
: eq<T, long>() ? ct<T, long>(long.Parse(s))
: eq<T, double>() ? ct<T, double>(double.Parse(s))
: eq<T, char>() ? ct<T, char>(s[0])
: ct<T, string>(s);
static void Multi<T>(out T a) => a = cv<T>(GetStr());
static void Multi<T, U>(out T a, out U b) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
}
static void Multi<T, U, V>(out T a, out U b, out V c) {
var ar = GetStrArray();
a = cv<T>(ar[0]);
b = cv<U>(ar[1]);
c = cv<V>(ar[2]);
}
}
}
|
[["-", 0, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 0, 213, 63, 214, 205, 213, 63, 214, 141, 22]]
| 8
| 645
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC124A {
class Program {
static void Main(string[] args) {
{
var word = Console.ReadLine().Split();
int a = int.Parse(word[0]);
int b = int.Parse(word[1]);
int max = 0;
for (int i = 0; i < 1; i++) {
if (a < b) {
max += b;
b--;
} else if (b <= a) {
max += a;
a--;
}
}
Console.WriteLine(max);
Console.ReadKey();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC124A {
class Program {
static void Main(string[] args) {
{
var word = Console.ReadLine().Split();
int a = int.Parse(word[0]);
int b = int.Parse(word[1]);
int max = 0;
for (int i = 0; i < 2; i++) {
if (a < b) {
max += b;
b--;
continue;
}
if (b <= a) {
max += a;
a--;
continue;
}
}
Console.WriteLine(max);
Console.ReadKey();
}
}
}
}
|
[["-", 8, 196, 0, 196, 0, 7, 15, 16, 12, 203], ["+", 8, 196, 0, 196, 0, 7, 15, 16, 12, 203], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 35], ["-", 0, 196, 0, 7, 8, 196, 0, 57, 0, 95], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35]]
| 8
| 152
| 7
|
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split(' ');
int a = int.Parse(input[0]);
int b = int.Parse(input[1]);
int ans = 0;
for (int i = 0; i < 2; i++) {
if (a > b) {
ans += a;
a--;
} else {
ans += b;
b--;
}
}
Console.WriteLine(ans);
}
}
|
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program {
static void Main(string[] args) {
string[] input = Console.ReadLine().Split(' ');
int a = int.Parse(input[0]);
int b = int.Parse(input[1]);
int ans = 0;
for (int i = 0; i < 2; i++) {
if (a > b) {
ans += a;
a--;
} else {
ans += b;
b--;
}
}
Console.WriteLine(ans);
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 252, 0, 253], ["+", 0, 213, 3, 4, 0, 28, 0, 252, 0, 253]]
| 8
| 149
| 2
|
using System;
class Program {
static void Main(string[] args) {
string[] str =
Console.ReadLine().Split(' '); // 2つ以上のスペース区切り入力の取得
int A = int.Parse(str[0]); //数値で受け取りたい場合は変換する
int B = int.Parse(str[1]);
int C = 0;
for (int i = 0; i < 2; i++) {
if (A < B) {
C = C + B;
B--;
} else {
C = C + A;
C--;
}
}
Console.WriteLine(C);
}
}
|
using System;
class Program {
static void Main(string[] args) {
string[] str =
Console.ReadLine().Split(' '); // 2つ以上のスペース区切り入力の取得
int A = int.Parse(str[0]); //数値で受け取りたい場合は変換する
int B = int.Parse(str[1]);
int C = 0;
for (int i = 0; i < 2; i++) {
if (A < B) {
C = C + B;
B--;
} else {
C = C + A;
A--;
}
}
Console.WriteLine(C);
}
}
|
[["-", 0, 57, 75, 196, 0, 1, 0, 223, 0, 22], ["+", 0, 57, 75, 196, 0, 1, 0, 223, 0, 22]]
| 8
| 121
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder2 {
class Program {
static void Main(string[] args) {
// スペース区切りの整数の入力
string[] x = Console.ReadLine().Split(' ');
int a = int.Parse(x[0]);
int b = int.Parse(x[1]);
int sum = 0;
for (int i = 0; i <= 1; ++i) {
if (a <= b) {
sum += b;
b -= 1;
} else {
sum += a;
a -= 1;
}
Console.WriteLine(sum);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder2 {
class Program {
static void Main(string[] args) {
// スペース区切りの整数の入力
string[] x = Console.ReadLine().Split(' ');
int a = int.Parse(x[0]);
int b = int.Parse(x[1]);
int sum = 0;
for (int i = 0; i <= 1; ++i) {
if (a <= b) {
sum += b;
b -= 1;
} else {
sum += a;
a -= 1;
}
}
Console.WriteLine(sum);
}
}
}
|
[["+", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46], ["-", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46]]
| 8
| 146
| 2
|
using System;
namespace ABC124 {
class Program {
static void Main(string[] args) {
var input = Console.ReadLine().Split(' ');
var a = int.Parse(input[0]);
var b = int.Parse(input[1]);
var res = (a == b) ? (a + b) : ((a > b) ? (a * 2 - 1) : (b * 2 - 1));
Console.WriteLine("result=" + res.ToString());
}
}
}
|
using System;
namespace ABC124 {
class Program {
static void Main(string[] args) {
var input = Console.ReadLine().Split(' ');
var a = int.Parse(input[0]);
var b = int.Parse(input[1]);
var res = (a == b) ? (a + b) : ((a > b) ? (a * 2 - 1) : (b * 2 - 1));
Console.WriteLine(res.ToString());
}
}
}
|
[["-", 3, 4, 0, 28, 0, 16, 31, 5, 0, 62], ["-", 3, 4, 0, 28, 0, 16, 31, 5, 0, 222], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72]]
| 8
| 118
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program {
const int MOD = 1000000007;
const int INF = 1 << 30;
static void Main(string[] args) { Solve(); }
static void Solve() {
Scan sc = new Scan();
write wr = new write();
var x = sc.intarr;
int ans = 0;
Array.Sort(x);
ans += x[0];
x[0]--;
Array.Sort(x);
wr.wri(ans + x[0]);
}
}
class Scan {
public string str => Console.ReadLine();
public string[] strarr => str.Split(' ');
public long[] longarr => strarr.Select(long.Parse).ToArray();
public int[] intarr => strarr.Select(int.Parse).ToArray();
public char[] chararr => str.ToArray();
}
class write {
public void wri<Type>(Type x) { Console.WriteLine(x); }
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program {
const int MOD = 1000000007;
const int INF = 1 << 30;
static void Main(string[] args) { Solve(); }
static void Solve() {
Scan sc = new Scan();
write wr = new write();
var x = sc.intarr;
int ans = 0;
Array.Sort(x);
ans += x[1];
x[1]--;
Array.Sort(x);
wr.wri(ans + x[1]);
}
}
class Scan {
public string str => Console.ReadLine();
public string[] strarr => str.Split(' ');
public long[] longarr => strarr.Select(long.Parse).ToArray();
public int[] intarr => strarr.Select(int.Parse).ToArray();
public char[] chararr => str.ToArray();
}
class write {
public void wri<Type>(Type x) { Console.WriteLine(x); }
}
|
[["-", 0, 11, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 11, 12, 204, 206, 207, 0, 28, 0, 203], ["-", 0, 223, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 223, 0, 204, 206, 207, 0, 28, 0, 203], ["-", 0, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 16, 12, 204, 206, 207, 0, 28, 0, 203]]
| 8
| 236
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ABC124_D {
class Program {
static void Main(string[] args) {
var NK = Console.ReadLine().Split().Select(int.Parse).ToArray();
var N = NK[0];
var K = NK[1];
var S = Console.ReadLine();
var list = new List<int>();
var val = '1';
var cnt = 0;
for (int i = 0; i < N; i++) {
if (S[i] == val)
cnt++;
else {
list.Add(cnt);
val = val == '1' ? '0' : '1';
cnt = 1;
}
}
if (cnt > 0)
list.Add(cnt);
if (list.Count % 2 == 0)
list.Add(0);
var cumSum = new int[list.Count + 1];
for (int i = 0; i < list.Count; i++) {
cumSum[i + 1] = cumSum[1] + list[i];
}
var ans = 1;
for (int i = 0; i < list.Count; i += 2) {
var l = i;
var r = Math.Min(i + 2 * 1 + 1, list.Count);
ans = Math.Max(ans, cumSum[r] - cumSum[l]);
}
Console.WriteLine(ans);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ABC124_D {
class Program {
static void Main(string[] args) {
var NK = Console.ReadLine().Split().Select(int.Parse).ToArray();
var N = NK[0];
var K = NK[1];
var S = Console.ReadLine();
var list = new List<int>();
var val = '1';
var cnt = 0;
for (int i = 0; i < N; i++) {
if (S[i] == val)
cnt++;
else {
list.Add(cnt);
val = val == '1' ? '0' : '1';
cnt = 1;
}
}
if (cnt > 0)
list.Add(cnt);
if (list.Count % 2 == 0)
list.Add(0);
var cumSum = new int[list.Count + 1];
for (int i = 0; i < list.Count; i++) {
cumSum[i + 1] = cumSum[i] + list[i];
}
var ans = 0;
for (int i = 0; i < list.Count; i += 2) {
var l = i;
var r = Math.Min(i + 2 * K + 1, list.Count);
ans = Math.Max(ans, cumSum[r] - cumSum[l]);
}
Console.WriteLine(ans);
}
}
}
|
[["-", 12, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["+", 12, 16, 31, 204, 206, 207, 0, 28, 0, 22], ["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["-", 0, 28, 0, 16, 31, 16, 12, 16, 12, 203], ["+", 0, 28, 0, 16, 31, 16, 12, 16, 12, 22]]
| 8
| 317
| 6
|
using System;
using System.Linq;
using System.Collections.Generic;
class Program {
/**
* 0と1の連続する数を配列に格納する
* 1010111の場合
* 0- 0 0
* 1-1 1 3 => 10103
* 0を1に変えていけばよいからK=1の場合
* 0を変えた直後の1の数を数えるので2*1+1回分の1をかぞえる
* 1010111 => 1110111であれば最初の111で3個
* 1010111 => 1011111であれば3~7(3+2*1+1-1)を数える
*
*
*/
static void Main(string[] args) {
var inputs = Console.ReadLine().Split(' ');
int N = int.Parse(inputs[0]);
int K = int.Parse(inputs[1]);
var S = Console.ReadLine();
var nums = new List<int>();
int val = 1;
int count = 0;
for (int i = 0; i < N; i++) {
if (S[i] == ('0' + val)) {
count++;
} else {
val = 1 - val;
nums.Add(count);
count = 1;
}
}
if (count != 0)
nums.Add(count);
// 0の後ろにある1の数を含めたいので奇数にする
if (nums.Count % 2 == 0)
nums.Add(0);
var acumSum = new int[nums.Count + 1];
for (int i = 0; i < nums.Count; i++) {
acumSum[i + 1] = acumSum[i] + nums[i];
}
int maxK = 2 * K + 1;
int max = 0;
for (int i = 0; i < nums.Count; i++) {
int left = i;
int right = Math.Min(i + maxK, nums.Count);
max = Math.Max(max, acumSum[right] - acumSum[left]);
}
Console.WriteLine(max);
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
class Program {
/**
* 0と1の連続する数を配列に格納する
* 1010111の場合
* 0- 0 0
* 1-1 1 3 => 10103
* 0を1に変えていけばよいからK=1の場合
* 0を変えた直後の1の数を数えるので2*1+1回分の1をかぞえる
* 1010111 => 1110111であれば最初の111で3個
* 1010111 => 1011111であれば3~7(3+2*1+1-1)を数える
*
*
*/
static void Main(string[] args) {
var inputs = Console.ReadLine().Split(' ');
int N = int.Parse(inputs[0]);
int K = int.Parse(inputs[1]);
var S = Console.ReadLine();
var nums = new List<int>();
int val = 1;
int count = 0;
for (int i = 0; i < N; i++) {
if (S[i] == ('0' + val)) {
count++;
} else {
val = 1 - val;
nums.Add(count);
count = 1;
}
}
if (count != 0)
nums.Add(count);
// 0の後ろにある1の数を含めたいので奇数にする
if (nums.Count % 2 == 0)
nums.Add(0);
var acumSum = new int[nums.Count + 1];
for (int i = 0; i < nums.Count; i++) {
acumSum[i + 1] = acumSum[i] + nums[i];
}
int maxK = 2 * K + 1;
int max = 0;
for (int i = 0; i < nums.Count; i += 2) {
int left = i;
int right = Math.Min(i + maxK, nums.Count);
max = Math.Max(max, acumSum[right] - acumSum[left]);
}
Console.WriteLine(max);
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 26, 223, 0, 29], ["+", 8, 196, 0, 7, 26, 11, 0, 202, 0, 107], ["+", 0, 195, 8, 196, 0, 7, 26, 11, 12, 203]]
| 8
| 317
| 3
|
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using System;
public class Hello {
public static void Main() {
string[] line = Console.ReadLine().Trim().Split(' ');
var n = int.Parse(line[0]);
var k = int.Parse(line[1]);
var s = Console.ReadLine().Trim();
if (n == 1) {
Console.WriteLine(1);
goto exit;
}
var a = s.ToCharArray();
var b = new List<int>();
if (a[0] == '0')
b.Add(0);
var t = a[0];
var count = 1;
for (int i = 1; i < n; i++) {
if (a[i] == t)
count++;
else {
b.Add(count);
count = 1;
}
t = a[i];
}
b.Add(count);
var x = 2 * k + 2;
for (int i = 0; i < x; i++)
b.Add(0);
var bc = b.Count();
var c = new int[bc + 1];
for (int i = 1; i < bc + 1; i++)
c[i] = c[i - 1] + b[i - 1];
var ans = 0;
for (int i = 0; i <= c.Length - x - 1; i += 2) {
var tt = c[i + x] - c[i];
ans = Max(ans, tt);
}
Console.WriteLine(ans);
exit:;
}
}
|
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using System;
public class Hello {
public static void Main() {
string[] line = Console.ReadLine().Trim().Split(' ');
var n = int.Parse(line[0]);
var k = int.Parse(line[1]);
var s = Console.ReadLine().Trim();
if (n == 1) {
Console.WriteLine(1);
goto exit;
}
var a = s.ToCharArray();
var b = new List<int>();
if (a[0] == '0')
b.Add(0);
var t = a[0];
var count = 1;
for (int i = 1; i < n; i++) {
if (a[i] == t)
count++;
else {
b.Add(count);
count = 1;
}
t = a[i];
}
b.Add(count);
var x = 2 * k + 1;
for (int i = 0; i < x + 1; i++)
b.Add(0);
var bc = b.Count();
var c = new int[bc + 1];
for (int i = 1; i < bc + 1; i++)
c[i] = c[i - 1] + b[i - 1];
var ans = 0;
for (int i = 0; i <= c.Length - x - 1; i += 2) {
var tt = c[i + x] - c[i];
ans = Max(ans, tt);
}
Console.WriteLine(ans);
exit:;
}
}
|
[["-", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203]]
| 8
| 367
| 4
|
using System;
using System.Globalization;
using System.IO.Pipes;
using System.Runtime.InteropServices;
namespace ConsoleApp2 {
class Program {
static void Main(string[] args) {
int[] s = new int[5] { 0, 0, 0, 0, 0 };
int k;
for (k = 0; k < 5; k++) {
s[k] = int.Parse(Console.ReadLine());
}
int i, j, l;
string ans = "Yey!";
l = int.Parse(Console.ReadLine());
for (i = 0; i < 5; i++) {
for (j = 0; j < 5; j++) {
if (i < j) {
if (Math.Abs(s[i] - s[j]) > l) {
ans = ":(";
}
}
}
}
Console.WriteLine(ans);
}
}
}
|
using System;
using System.Globalization;
using System.IO.Pipes;
using System.Runtime.InteropServices;
namespace ConsoleApp2 {
class Program {
static void Main(string[] args) {
int[] s = new int[5] { 0, 0, 0, 0, 0 };
int k;
for (k = 0; k < 5; k++) {
s[k] = int.Parse(Console.ReadLine());
}
int i, j, l;
string ans = "Yay!";
l = int.Parse(Console.ReadLine());
for (i = 0; i < 5; i++) {
for (j = 0; j < 5; j++) {
if (i < j) {
if (Math.Abs(s[i] - s[j]) > l) {
ans = ":(";
}
}
}
}
Console.WriteLine(ans);
}
}
}
|
[["-", 0, 198, 0, 200, 0, 212, 0, 5, 0, 222], ["+", 0, 198, 0, 200, 0, 212, 0, 5, 0, 222]]
| 8
| 196
| 2
|
using System;
namespace ConsoleApp18 {
class Program {
static void Main(string[] args) {
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int c = int.Parse(Console.ReadLine());
int d = int.Parse(Console.ReadLine());
int e = int.Parse(Console.ReadLine());
int k = int.Parse(Console.ReadLine());
if (k <= e - a) {
Console.WriteLine(":(");
} else {
Console.WriteLine("Yay!");
}
}
}
}
|
using System;
namespace ConsoleApp18 {
class Program {
static void Main(string[] args) {
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int c = int.Parse(Console.ReadLine());
int d = int.Parse(Console.ReadLine());
int e = int.Parse(Console.ReadLine());
int k = int.Parse(Console.ReadLine());
if (k < e - a) {
Console.WriteLine(":(");
} else {
Console.WriteLine("Yay!");
}
}
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18]]
| 8
| 137
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace atcoder03a {
class Program {
static void Main(string[] args) {
int[] a = new int[5];
for (int b = 0; b < 5; ++b) {
a[b] = int.Parse(Console.ReadLine());
}
int k = int.Parse(Console.ReadLine());
for (int i = 0; i < 3; ++i) {
for (int ii = 0; ii < 4; ++ii) {
if (a[ii] - a[i] > k) {
Console.WriteLine(":(");
return;
}
}
}
Console.WriteLine("Yay!");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace atcoder03a {
class Program {
static void Main(string[] args) {
int[] a = new int[5];
for (int b = 0; b < 5; ++b) {
a[b] = int.Parse(Console.ReadLine());
}
int k = int.Parse(Console.ReadLine());
for (int i = 0; i < 5; ++i) {
for (int ii = 0; ii < 5; ++ii) {
if (a[ii] - a[i] > k) {
Console.WriteLine(":(");
return;
}
}
}
Console.WriteLine("Yay!");
}
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 203]]
| 8
| 171
| 4
|
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
namespace Equeue {
class Equeue {
static Node[] Nodes;
static void Main(string[] args) {
long nil = 10000000;
// var N = long.Parse(Console.ReadLine());
var a = long.Parse(Console.ReadLine());
var b = long.Parse(Console.ReadLine());
var c = long.Parse(Console.ReadLine());
var d = long.Parse(Console.ReadLine());
var e = long.Parse(Console.ReadLine());
var k = long.Parse(Console.ReadLine());
if (k > e - a) {
Console.WriteLine("Yay!");
} else {
Console.WriteLine(":(");
}
}
static List<T[]> AllPermutation<T>(params T[] array)
where T : IComparable {
var a = new List<T>(array).ToArray();
var res = new List<T[]>();
res.Add(new List<T>(a).ToArray());
var n = a.Length;
var next = true;
while (next) {
next = false;
// 1
int i;
for (i = n - 2; i >= 0; i--) {
if (a[i].CompareTo(a[i + 1]) < 0)
break;
}
// 2
if (i < 0)
break;
// 3
var j = n;
do {
j--;
} while (a[i].CompareTo(a[j]) > 0);
if (a[i].CompareTo(a[j]) < 0) {
// 4
var tmp = a[i];
a[i] = a[j];
a[j] = tmp;
Array.Reverse(a, i + 1, n - i - 1);
res.Add(new List<T>(a).ToArray());
next = true;
}
}
return res;
}
static bool WFS(long st) {
var q = new Queue<Node>();
var tmp = Nodes[st];
tmp.loc = 100;
q.Enqueue(tmp);
while (q.Count > 0) {
tmp = q.Dequeue();
foreach (KeyValuePair<long, long> item in tmp.adj) {
var child = Nodes[item.Key];
// Console.WriteLine(item.Key+" "+child.loc+" "+item.Value);
if (child.loc != -1 && (child.loc != (item.Value + tmp.loc))) {
return false;
} else if (child.loc == -1) {
child.loc = item.Value + tmp.loc;
q.Enqueue(Nodes[item.Key]);
// Console.WriteLine(item.Key+" "+child.loc+" "+item.Value);
}
}
}
return true;
}
}
public class Node {
public long loc = -1;
public Dictionary<long, long> adj = new Dictionary<long, long>();
}
public class PriorityQueue<T> : IEnumerable<T> {
private readonly List<T> _data = new List<T>();
private readonly IComparer<T> _comparer;
private readonly bool _isDescending;
public PriorityQueue(IComparer<T> comparer, bool isDescending = true) {
_comparer = comparer;
_isDescending = isDescending;
}
public PriorityQueue(Comparison<T> comparison, bool isDescending = true)
: this(Comparer<T>.Create(comparison), isDescending) {}
public PriorityQueue(bool isDescending = true)
: this(Comparer<T>.Default, isDescending) {}
public void Enqueue(T item) {
_data.Add(item);
var childIndex = _data.Count - 1;
while (childIndex > 0) {
var parentIndex = (childIndex - 1) / 2;
if (Compare(_data[childIndex], _data[parentIndex]) >= 0)
break;
Swap(childIndex, parentIndex);
childIndex = parentIndex;
}
}
public T Dequeue() {
var lastIndex = _data.Count - 1;
var firstItem = _data[0];
_data[0] = _data[lastIndex];
_data.RemoveAt(lastIndex--);
var parentIndex = 0;
while (true) {
var childIndex = parentIndex * 2 + 1;
if (childIndex > lastIndex)
break;
var rightChild = childIndex + 1;
if (rightChild <= lastIndex &&
Compare(_data[rightChild], _data[childIndex]) < 0)
childIndex = rightChild;
if (Compare(_data[parentIndex], _data[childIndex]) <= 0)
break;
Swap(parentIndex, childIndex);
parentIndex = childIndex;
}
return firstItem;
}
public T Peek() { return _data[0]; }
private void Swap(int a, int b) {
var tmp = _data[a];
_data[a] = _data[b];
_data[b] = tmp;
}
private int Compare(T a, T b) {
return _isDescending ? _comparer.Compare(b, a) : _comparer.Compare(a, b);
}
public int Count => _data.Count;
public IEnumerator<T> GetEnumerator() { return _data.GetEnumerator(); }
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}
|
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
namespace Equeue {
class Equeue {
static Node[] Nodes;
static void Main(string[] args) {
long nil = 10000000;
// var N = long.Parse(Console.ReadLine());
var a = long.Parse(Console.ReadLine());
var b = long.Parse(Console.ReadLine());
var c = long.Parse(Console.ReadLine());
var d = long.Parse(Console.ReadLine());
var e = long.Parse(Console.ReadLine());
var k = long.Parse(Console.ReadLine());
if (k >= e - a) {
Console.WriteLine("Yay!");
} else {
Console.WriteLine(":(");
}
}
static List<T[]> AllPermutation<T>(params T[] array)
where T : IComparable {
var a = new List<T>(array).ToArray();
var res = new List<T[]>();
res.Add(new List<T>(a).ToArray());
var n = a.Length;
var next = true;
while (next) {
next = false;
// 1
int i;
for (i = n - 2; i >= 0; i--) {
if (a[i].CompareTo(a[i + 1]) < 0)
break;
}
// 2
if (i < 0)
break;
// 3
var j = n;
do {
j--;
} while (a[i].CompareTo(a[j]) > 0);
if (a[i].CompareTo(a[j]) < 0) {
// 4
var tmp = a[i];
a[i] = a[j];
a[j] = tmp;
Array.Reverse(a, i + 1, n - i - 1);
res.Add(new List<T>(a).ToArray());
next = true;
}
}
return res;
}
static bool WFS(long st) {
var q = new Queue<Node>();
var tmp = Nodes[st];
tmp.loc = 100;
q.Enqueue(tmp);
while (q.Count > 0) {
tmp = q.Dequeue();
foreach (KeyValuePair<long, long> item in tmp.adj) {
var child = Nodes[item.Key];
// Console.WriteLine(item.Key+" "+child.loc+" "+item.Value);
if (child.loc != -1 && (child.loc != (item.Value + tmp.loc))) {
return false;
} else if (child.loc == -1) {
child.loc = item.Value + tmp.loc;
q.Enqueue(Nodes[item.Key]);
// Console.WriteLine(item.Key+" "+child.loc+" "+item.Value);
}
}
}
return true;
}
}
public class Node {
public long loc = -1;
public Dictionary<long, long> adj = new Dictionary<long, long>();
}
public class PriorityQueue<T> : IEnumerable<T> {
private readonly List<T> _data = new List<T>();
private readonly IComparer<T> _comparer;
private readonly bool _isDescending;
public PriorityQueue(IComparer<T> comparer, bool isDescending = true) {
_comparer = comparer;
_isDescending = isDescending;
}
public PriorityQueue(Comparison<T> comparison, bool isDescending = true)
: this(Comparer<T>.Create(comparison), isDescending) {}
public PriorityQueue(bool isDescending = true)
: this(Comparer<T>.Default, isDescending) {}
public void Enqueue(T item) {
_data.Add(item);
var childIndex = _data.Count - 1;
while (childIndex > 0) {
var parentIndex = (childIndex - 1) / 2;
if (Compare(_data[childIndex], _data[parentIndex]) >= 0)
break;
Swap(childIndex, parentIndex);
childIndex = parentIndex;
}
}
public T Dequeue() {
var lastIndex = _data.Count - 1;
var firstItem = _data[0];
_data[0] = _data[lastIndex];
_data.RemoveAt(lastIndex--);
var parentIndex = 0;
while (true) {
var childIndex = parentIndex * 2 + 1;
if (childIndex > lastIndex)
break;
var rightChild = childIndex + 1;
if (rightChild <= lastIndex &&
Compare(_data[rightChild], _data[childIndex]) < 0)
childIndex = rightChild;
if (Compare(_data[parentIndex], _data[childIndex]) <= 0)
break;
Swap(parentIndex, childIndex);
parentIndex = childIndex;
}
return firstItem;
}
public T Peek() { return _data[0]; }
private void Swap(int a, int b) {
var tmp = _data[a];
_data[a] = _data[b];
_data[b] = tmp;
}
private int Compare(T a, T b) {
return _isDescending ? _comparer.Compare(b, a) : _comparer.Compare(a, b);
}
public int Count => _data.Count;
public IEnumerator<T> GetEnumerator() { return _data.GetEnumerator(); }
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20]]
| 8
| 1,066
| 2
|
using System;
using System.Linq;
class Program {
static void Main() {
var xs = Console.In.ReadToEnd().Split().Select(n => int.Parse(n)).ToArray();
int k = xs[xs.Length - 1];
int min = xs[0];
int max = xs[xs.Length - 2];
Console.WriteLine(max - min <= k ? "Yay!" : ":(");
}
}
|
using System;
using System.Linq;
class Program {
static void Main() {
var xs = Console.In.ReadToEnd()
.TrimEnd()
.Split()
.Select(n => int.Parse(n))
.ToArray();
int k = xs[xs.Length - 1];
int min = xs[0];
int max = xs[xs.Length - 2];
Console.WriteLine(max - min <= k ? "Yay!" : ":(");
}
}
|
[["+", 205, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 205, 213, 63, 214, 205, 213, 3, 4, 0, 24], ["+", 205, 213, 63, 214, 205, 213, 3, 4, 0, 25], ["+", 205, 213, 63, 214, 205, 213, 63, 214, 0, 131]]
| 8
| 101
| 4
|
using System;
namespace ABC123A {
class Program {
static void Main(string[] args) {
int a, b, c, d, e, k;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
c = int.Parse(Console.ReadLine());
d = int.Parse(Console.ReadLine());
e = int.Parse(Console.ReadLine());
k = int.Parse(Console.ReadLine());
if (e - a < k)
Console.WriteLine("Yay!");
else
Console.WriteLine(":(");
Console.ReadKey();
}
}
}
|
using System;
namespace ABC123A {
class Program {
static void Main(string[] args) {
int a, b, c, d, e, k;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
c = int.Parse(Console.ReadLine());
d = int.Parse(Console.ReadLine());
e = int.Parse(Console.ReadLine());
k = int.Parse(Console.ReadLine());
if (e - a <= k)
Console.WriteLine("Yay!");
else
Console.WriteLine(":(");
Console.ReadKey();
}
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
| 8
| 146
| 2
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;
namespace AtCoderWorkspace {
public class Solver {
public void Solve() {
var cin = new Scanner();
var a = cin.ArrayInt(5);
var k = cin.nextInt();
if (Math.Abs(a[0] - a[4]) >= k) {
Console.WriteLine(":(");
return;
}
Console.WriteLine("Yay!");
}
}
class Scanner {
string[] s;
int i;
char[] cs = new char[] { ' ' };
public Scanner() {
s = new string[0];
i = 0;
}
public string next() {
if (i < s.Length)
return s[i++];
string st = Console.ReadLine();
while (st == "")
st = Console.ReadLine();
s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
if (s.Length == 0)
return next();
i = 0;
return s[i++];
}
public int nextInt() { return int.Parse(next()); }
public int[] ArrayInt(int N, int add = 0) {
int[] Array = new int[N];
for (int i = 0; i < N; i++) {
Array[i] = nextInt() + add;
}
return Array;
}
public int[] DPArrayInt(int N, int ex) {
int[] Array = new int[N + ex];
for (int i = 0; i < N; i++) {
Array[i] = nextInt();
}
return Array;
}
public long nextLong() { return long.Parse(next()); }
public long[] ArrayLong(int N, long add = 0) {
long[] Array = new long[N];
for (int i = 0; i < N; i++) {
Array[i] = nextLong() + add;
}
return Array;
}
public long[] DPArrayLong(int N, int ex) {
long[] Array = new long[N + ex];
for (int i = 0; i < N; i++) {
Array[i] = nextLong();
}
return Array;
}
public double nextDouble() { return double.Parse(next()); }
public double[] ArrayDouble(int N, double add = 0) {
double[] Array = new double[N];
for (int i = 0; i < N; i++) {
Array[i] = nextDouble() + add;
}
return Array;
}
}
class Program {
static void Main(string[] s) => new Solver().Solve();
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;
namespace AtCoderWorkspace {
public class Solver {
public void Solve() {
var cin = new Scanner();
var a = cin.ArrayInt(5);
var k = cin.nextInt();
if (Math.Abs(a[0] - a[4]) > k) {
Console.WriteLine(":(");
return;
}
Console.WriteLine("Yay!");
}
}
class Scanner {
string[] s;
int i;
char[] cs = new char[] { ' ' };
public Scanner() {
s = new string[0];
i = 0;
}
public string next() {
if (i < s.Length)
return s[i++];
string st = Console.ReadLine();
while (st == "")
st = Console.ReadLine();
s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
if (s.Length == 0)
return next();
i = 0;
return s[i++];
}
public int nextInt() { return int.Parse(next()); }
public int[] ArrayInt(int N, int add = 0) {
int[] Array = new int[N];
for (int i = 0; i < N; i++) {
Array[i] = nextInt() + add;
}
return Array;
}
public int[] DPArrayInt(int N, int ex) {
int[] Array = new int[N + ex];
for (int i = 0; i < N; i++) {
Array[i] = nextInt();
}
return Array;
}
public long nextLong() { return long.Parse(next()); }
public long[] ArrayLong(int N, long add = 0) {
long[] Array = new long[N];
for (int i = 0; i < N; i++) {
Array[i] = nextLong() + add;
}
return Array;
}
public long[] DPArrayLong(int N, int ex) {
long[] Array = new long[N + ex];
for (int i = 0; i < N; i++) {
Array[i] = nextLong();
}
return Array;
}
public double nextDouble() { return double.Parse(next()); }
public double[] ArrayDouble(int N, double add = 0) {
double[] Array = new double[N];
for (int i = 0; i < N; i++) {
Array[i] = nextDouble() + add;
}
return Array;
}
}
class Program {
static void Main(string[] s) => new Solver().Solve();
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 47]]
| 8
| 599
| 2
|
using System;
using System.Linq;
namespace A {
class Program {
static void Main(string[] args) {
// Console.WriteLine("Hello World!");
int[] abcdek = new int[6];
for (int i = 0; i < 6; i++) {
abcdek[i] = int.Parse(Console.ReadLine());
}
Console.WriteLine(abcdek[4] - abcdek[0] > abcdek[5] ? "Yay!" : ":(");
}
}
}
|
using System;
using System.Linq;
namespace A {
class Program {
static void Main(string[] args) {
// Console.WriteLine("Hello World!");
int[] abcdek = new int[6];
for (int i = 0; i < 6; i++) {
abcdek[i] = int.Parse(Console.ReadLine());
}
Console.WriteLine(abcdek[4] - abcdek[0] <= abcdek[5] ? "Yay!" : ":(");
}
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 47], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19]]
| 8
| 99
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
public static void Main() {
List<int> list = new List<int>();
for (int i = 0; i < 6; i++) {
list.Add(int.Parse(Console.ReadLine()));
}
Console.WriteLine(list[4] - list[0] <= list[5] ? ":(" : "Yay!");
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
public static void Main() {
List<int> list = new List<int>();
for (int i = 0; i < 6; i++) {
list.Add(int.Parse(Console.ReadLine()));
}
Console.WriteLine(list[4] - list[0] <= list[5] ? "Yay!" : ":(");
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["-", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222]]
| 8
| 101
| 4
|
using System;
namespace ABC123_a {
class Program {
static void Main(string[] args)
{
int[] array = new int[6];
for (int i = 0; i < array.Length; i++) {
array[i] = int.Parse(Console.ReadLine());
}
if ((array[4] - array[0]) < array[5]) {
Console.WriteLine("Yay!");
} else {
Console.WriteLine(":(");
}
}
}
}
|
using System;
namespace ABC123_a {
class Program {
static void Main(string[] args)
{
int[] array = new int[6];
for (int i = 0; i < array.Length; i++) {
array[i] = int.Parse(Console.ReadLine());
}
if ((array[4] - array[0]) <= array[5]) {
Console.WriteLine("Yay!");
} else {
Console.WriteLine(":(");
}
}
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
| 8
| 109
| 2
|
using System;
class plogram {
static void Main() {
var line = new int[6];
for (var i = 0; i < 6; i++) {
line[i] = int.Parse(Console.ReadLine());
}
string str = "Yay!";
for (var i = 0; i < 4; i++) {
for (var j = 0; j < 4; j++) {
if (Math.Abs(line[i] - line[j]) > line[5]) {
str = ":(";
}
}
}
Console.WriteLine(str);
}
}
|
using System;
class plogram {
static void Main() {
var line = new int[6];
for (var i = 0; i < 6; i++) {
line[i] = int.Parse(Console.ReadLine());
}
string str = "Yay!";
for (var i = 0; i < 5; i++) {
for (var j = 0; j < 5; j++) {
if (Math.Abs(line[i] - line[j]) > line[5]) {
str = ":(";
}
}
}
Console.WriteLine(str);
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 203]]
| 8
| 131
| 4
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using static System.Console;
namespace ABC123A {
static class Program {
static void Main(string[] args) {
var l = ReadLineOne<int>(5);
var k = ReadLine().TryParse<int>();
string a = l.All(x => l.All(y => Math.Abs(y - x) < k)) ? "Yay!" : ":(";
WriteLine(a);
}
private static string Check(List<int> l, int k) {
for (int i = 1; i < l.Count; i++) {
for (int j = i + 1; j < l.Count; j++) {
if (l[j] - l[i] > k)
return ":(";
}
}
return "Yay!";
}
public static T TryParse<T>(this String input) {
try {
var converter = TypeDescriptor.GetConverter(typeof(T));
if (converter != null) {
return (T)converter.ConvertFromString(input);
} else {
throw new InvalidCastException("");
}
} catch {
throw new InvalidCastException(typeof(T) + " is not supported.");
}
}
public static List<T> SplitTryParseToList<T>(this String input) {
return input.Split().Select(n => n.TryParse<T>()).ToList();
}
public static List<T> ListSwap<T>(this List<T> list, Int32 index1,
Int32 index2) {
var t = list[index1];
list[index1] = list[index2];
list[index2] = t;
return list;
}
public static List<Tuple<T, int>>
DuplicateCount<T>(this IEnumerable<T> list) {
return list.GroupBy(i => i)
.Where(g => g.Any())
.Select(g => Tuple.Create(g.Key, g.Count()))
.ToList();
}
public static List<Tuple<T, int>>
DuplicateSort<T>(this IEnumerable<Tuple<T, int>> list) {
return list.OrderByDescending((x) => x.Item2).ToList();
}
public static List<T> ReadLineOne<T>(int n) {
var list = new List<T>();
foreach (var i in Enumerable.Range(1, n)) {
list.Add(Console.ReadLine().TryParse<T>());
}
return list;
}
public static void PrintAll<T>(this IEnumerable<T> list) {
foreach (var i in list) {
Console.Write($"{i} ");
}
Console.WriteLine();
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using static System.Console;
namespace ABC123A {
static class Program {
static void Main(string[] args) {
var l = ReadLineOne<int>(5);
var k = ReadLine().TryParse<int>();
string a = l.All(x => l.All(y => Math.Abs(y - x) <= k)) ? "Yay!" : ":(";
WriteLine(a);
}
private static string Check(List<int> l, int k) {
for (int i = 1; i < l.Count; i++) {
for (int j = i + 1; j < l.Count; j++) {
if (l[j] - l[i] > k)
return ":(";
}
}
return "Yay!";
}
public static T TryParse<T>(this String input) {
try {
var converter = TypeDescriptor.GetConverter(typeof(T));
if (converter != null) {
return (T)converter.ConvertFromString(input);
} else {
throw new InvalidCastException("");
}
} catch {
throw new InvalidCastException(typeof(T) + " is not supported.");
}
}
public static List<T> SplitTryParseToList<T>(this String input) {
return input.Split().Select(n => n.TryParse<T>()).ToList();
}
public static List<T> ListSwap<T>(this List<T> list, Int32 index1,
Int32 index2) {
var t = list[index1];
list[index1] = list[index2];
list[index2] = t;
return list;
}
public static List<Tuple<T, int>>
DuplicateCount<T>(this IEnumerable<T> list) {
return list.GroupBy(i => i)
.Where(g => g.Any())
.Select(g => Tuple.Create(g.Key, g.Count()))
.ToList();
}
public static List<Tuple<T, int>>
DuplicateSort<T>(this IEnumerable<Tuple<T, int>> list) {
return list.OrderByDescending((x) => x.Item2).ToList();
}
public static List<T> ReadLineOne<T>(int n) {
var list = new List<T>();
foreach (var i in Enumerable.Range(1, n)) {
list.Add(Console.ReadLine().TryParse<T>());
}
return list;
}
public static void PrintAll<T>(this IEnumerable<T> list) {
foreach (var i in list) {
Console.Write($"{i} ");
}
Console.WriteLine();
}
}
}
|
[["-", 3, 4, 0, 28, 0, 218, 8, 16, 17, 18], ["+", 3, 4, 0, 28, 0, 218, 8, 16, 17, 19]]
| 8
| 594
| 2
|
using System;
class Program {
static void Main(string[] args) {
var A = int.Parse(Console.ReadLine());
var B = int.Parse(Console.ReadLine());
var C = int.Parse(Console.ReadLine());
var D = int.Parse(Console.ReadLine());
var E = int.Parse(Console.ReadLine());
var K = int.Parse(Console.ReadLine());
if (E - A < K) {
Console.WriteLine("Yay!");
return;
}
Console.WriteLine(":(");
}
}
|
using System;
class Program {
static void Main(string[] args) {
var A = int.Parse(Console.ReadLine());
var B = int.Parse(Console.ReadLine());
var C = int.Parse(Console.ReadLine());
var D = int.Parse(Console.ReadLine());
var E = int.Parse(Console.ReadLine());
var K = int.Parse(Console.ReadLine());
if (E - A <= K) {
Console.WriteLine("Yay!");
return;
}
Console.WriteLine(":(");
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
| 8
| 132
| 2
|
using System;
class abc123a {
static void Main() {
var p = new int[5];
for (int i = 0; i < 5; i++) {
p[i] = int.Parse(Console.ReadLine());
}
var k = int.Parse(Console.ReadLine());
for (int i = 0; i < 5; i++) {
for (int j = i + 1; j < 5; j++) {
var l = p[j] - p[i];
if (l > k) {
Console.WriteLine("Yay!");
return;
}
}
}
Console.WriteLine(":(");
return;
}
}
|
using System;
class abc123a {
static void Main() {
var p = new int[5];
for (int i = 0; i < 5; i++) {
p[i] = int.Parse(Console.ReadLine());
}
var k = int.Parse(Console.ReadLine());
for (int i = 0; i < 5; i++) {
for (int j = i + 1; j < 5; j++) {
var l = p[j] - p[i];
if (l > k) {
Console.WriteLine(":(");
return;
}
}
}
Console.WriteLine("Yay!");
return;
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 146
| 4
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int c = int.Parse(Console.ReadLine());
int d = int.Parse(Console.ReadLine());
int e = int.Parse(Console.ReadLine());
int k = int.Parse(Console.ReadLine());
Console.WriteLine(e - a < k ? "Yay!" : ":(");
}
}
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int c = int.Parse(Console.ReadLine());
int d = int.Parse(Console.ReadLine());
int e = int.Parse(Console.ReadLine());
int k = int.Parse(Console.ReadLine());
Console.WriteLine(e - a <= k ? "Yay!" : ":(");
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 18], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19]]
| 8
| 126
| 2
|
using System;
using System.Linq;
namespace atcoder {
class Program {
static void Main(string[] args) {
int[] abcde = Enumerable.Range(1, 5)
.Select(_ => Console.ReadLine())
.Select(x => int.Parse(x))
.ToArray();
int k = int.Parse(Console.ReadLine());
for (int i = 0; i < 4; i++) {
for (int j = i + 1; j < 4; j++) {
int p = abcde[i];
int q = abcde[j];
if ((q - p) > k) {
Console.WriteLine(":(");
return;
}
}
}
Console.WriteLine("Yay!");
}
}
}
|
using System;
using System.Linq;
namespace atcoder {
class Program {
static void Main(string[] args) {
int[] abcde = Enumerable.Range(1, 5)
.Select(_ => Console.ReadLine())
.Select(x => int.Parse(x))
.ToArray();
int k = int.Parse(Console.ReadLine());
for (int i = 0; i < 4; i++) {
for (int j = i + 1; j < 5; j++) {
int p = abcde[i];
int q = abcde[j];
if ((q - p) > k) {
Console.WriteLine(":(");
return;
}
}
}
Console.WriteLine("Yay!");
}
}
}
|
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 203]]
| 8
| 164
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder_3 {
class Program {
static void Main(string[] args) {
int[] n = new int[6];
for (int i = 0; i < 6; i++) {
n[i] = int.Parse(Console.ReadLine());
}
int g;
string hantei = "Yay!";
for (int j = 0; j <= 3; j++) {
for (int k = j + 1; k <= 4; k++) {
g = n[k] - n[j];
if (g >= n[5]) {
hantei = ":(";
}
}
if (hantei == ":(") {
break;
}
}
Console.WriteLine(hantei);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder_3 {
class Program {
static void Main(string[] args) {
int[] n = new int[6];
for (int i = 0; i < 6; i++) {
n[i] = int.Parse(Console.ReadLine());
}
int g;
string hantei = "Yay!";
for (int j = 0; j <= 3; j++) {
for (int k = j + 1; k <= 4; k++) {
g = n[k] - n[j];
if (g > n[5]) {
hantei = ":(";
}
}
if (hantei == ":(")
break;
}
Console.WriteLine(hantei);
}
}
}
|
[["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 47], ["-", 0, 7, 8, 196, 0, 57, 64, 196, 0, 45], ["-", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46]]
| 8
| 181
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ATCode_Five_Antennas {
class Program {
static void Main(string[] args) {
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int c = int.Parse(Console.ReadLine());
int d = int.Parse(Console.ReadLine());
int e = int.Parse(Console.ReadLine());
int k = int.Parse(Console.ReadLine());
if (e - a <= k) {
Console.WriteLine(":(");
} else {
Console.WriteLine("Yay!");
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ATCode_Five_Antennas {
class Program {
static void Main(string[] args) {
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int c = int.Parse(Console.ReadLine());
int d = int.Parse(Console.ReadLine());
int e = int.Parse(Console.ReadLine());
int k = int.Parse(Console.ReadLine());
if (e - a <= k) {
Console.WriteLine("Yay!");
} else {
Console.WriteLine(":(");
}
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 161
| 4
|
using System;
using static System.Console;
class program {
static void Main(string[] args) {
program p = new program();
p.Run();
}
void Run() {
int a = int.Parse(ReadLine());
ReadLine();
ReadLine();
ReadLine();
int e = int.Parse(ReadLine());
int k = int.Parse(ReadLine());
if (Math.Abs(e - a) <= k) {
WriteLine("Yey!");
} else {
WriteLine(":(");
}
}
}
|
using System;
using static System.Console;
class program {
static void Main(string[] args) {
program p = new program();
p.Run();
}
void Run() {
int a = int.Parse(ReadLine());
ReadLine();
ReadLine();
ReadLine();
int e = int.Parse(ReadLine());
int k = int.Parse(ReadLine());
if (Math.Abs(e - a) <= k) {
WriteLine("Yay!");
} else {
WriteLine(":(");
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 124
| 2
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
string[] str = new string[5];
for (var i = 0; i < 5; i++)
str[i] = Console.ReadLine();
int K = int.Parse(Console.ReadLine());
var ary = str.Select(int.Parse);
int x = ary.Max() - ary.Min();
if (K > x) {
Console.WriteLine("Yay!");
} else {
Console.WriteLine(":(");
}
}
}
|
using System;
using System.Linq;
class Program {
static void Main(string[] args) {
string[] str = new string[5];
for (var i = 0; i < 5; i++)
str[i] = Console.ReadLine();
int K = int.Parse(Console.ReadLine());
var ary = str.Select(int.Parse);
int x = ary.Max() - ary.Min();
if (K >= x) {
Console.WriteLine("Yay!");
} else {
Console.WriteLine(":(");
}
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20]]
| 8
| 129
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp4 {
class Program {
static void Main(string[] args) {
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int c = int.Parse(Console.ReadLine());
int d = int.Parse(Console.ReadLine());
int e = int.Parse(Console.ReadLine());
int k = int.Parse(Console.ReadLine());
if (e - a <= k) {
Console.WriteLine("Yey!");
} else {
Console.WriteLine(":(");
}
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp4 {
class Program {
static void Main(string[] args) {
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int c = int.Parse(Console.ReadLine());
int d = int.Parse(Console.ReadLine());
int e = int.Parse(Console.ReadLine());
int k = int.Parse(Console.ReadLine());
if (e - a <= k) {
Console.WriteLine("Yay!");
} else {
Console.WriteLine(":(");
}
Console.ReadKey();
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 167
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
using E = System.Linq.Enumerable;
public class Program {
public static void Main() {
var antennas = new int[5];
for (int i = 0; i < antennas.Length; i++) {
antennas[i] = int.Parse(Console.ReadLine());
}
var k = int.Parse(Console.ReadLine());
Console.WriteLine(antennas[4] - antennas[0] < k ? "Yay!" : ":(");
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
using E = System.Linq.Enumerable;
public class Program {
public static void Main() {
var antennas = new int[5];
for (int i = 0; i < antennas.Length; i++) {
antennas[i] = int.Parse(Console.ReadLine());
}
var k = int.Parse(Console.ReadLine());
Console.WriteLine(antennas[4] - antennas[0] <= k ? "Yay!" : ":(");
}
}
|
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 18], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19]]
| 8
| 119
| 2
|
using System;
class Program {
static void Main(string[] args) {
int[] a = new int[6];
for (int i = 0; i < 6; i++) {
a[i] = int.Parse(Console.ReadLine());
}
bool isYay = true;
for (int i = 0; i < 4; i++)
for (int j = i + 1; j < 4; j++) {
if ((a[j] - a[i]) > a[5]) {
isYay = false;
}
}
Console.WriteLine(isYay ? "Yay!" : ":(");
}
}
|
using System;
class Program {
static void Main(string[] args) {
int[] a = new int[6];
for (int i = 0; i < 6; i++) {
a[i] = int.Parse(Console.ReadLine());
}
bool isYay = true;
for (int i = 0; i < 5; i++)
for (int j = i + 1; j < 5; j++) {
if ((a[j] - a[i]) > a[5]) {
isYay = false;
}
}
Console.WriteLine(isYay ? "Yay!" : ":(");
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["-", 8, 196, 0, 7, 8, 7, 15, 16, 12, 203], ["+", 8, 196, 0, 7, 8, 7, 15, 16, 12, 203]]
| 8
| 138
| 4
|
using System;
public class Hello {
public static void Main() {
var a = new int[5];
for (int i = 0; i < 5; i++)
a[i] = int.Parse(Console.ReadLine().Trim());
Console.WriteLine(a[4] - a[0] > a[5] ? ":(" : "Yay!");
}
}
|
using System;
public class Hello {
public static void Main() {
var a = new int[6];
for (int i = 0; i < 6; i++)
a[i] = int.Parse(Console.ReadLine().Trim());
Console.WriteLine(a[4] - a[0] > a[5] ? ":(" : "Yay!");
}
}
|
[["-", 0, 212, 0, 227, 39, 224, 225, 226, 0, 203], ["+", 0, 212, 0, 227, 39, 224, 225, 226, 0, 203], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203]]
| 8
| 87
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Program {
static void Main(string[] args) {
var array = new int[5];
for (int i = 0; i < 5; i++) {
array[i] = int.Parse(Console.ReadLine());
}
var limit = int.Parse(Console.ReadLine());
var flag = true;
for (int i = 0; i < 4; i++) {
for (int y = 4; y > i; y--) {
if (array[y] - array[i] >= limit) {
flag = false;
}
}
}
if (flag) {
Console.WriteLine("Yay!");
} else {
Console.WriteLine(":(");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public class Program {
static void Main(string[] args) {
var array = new int[5];
for (int i = 0; i < 5; i++) {
array[i] = int.Parse(Console.ReadLine());
}
var limit = int.Parse(Console.ReadLine());
var flag = true;
for (int i = 0; i < 4; i++) {
for (int y = 4; y > i; y--) {
if (array[y] - array[i] > limit) {
flag = false;
}
}
}
if (flag) {
Console.WriteLine("Yay!");
} else {
Console.WriteLine(":(");
}
}
}
|
[["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 47]]
| 8
| 170
| 2
|
using System;
using System.Linq;
namespace A_Five_Antennas {
class Program {
static void Main(string[] args) {
var antennas = new int[5];
antennas[0] = int.Parse(Console.ReadLine());
antennas[1] = int.Parse(Console.ReadLine());
antennas[2] = int.Parse(Console.ReadLine());
antennas[3] = int.Parse(Console.ReadLine());
antennas[4] = int.Parse(Console.ReadLine());
var k = int.Parse(Console.ReadLine());
if (antennas[4] - antennas[0] <= k) {
Console.WriteLine(":(");
} else {
Console.WriteLine("Yay!");
}
}
}
}
|
using System;
using System.Linq;
namespace A_Five_Antennas {
class Program {
static void Main(string[] args) {
var antennas = new int[5];
antennas[0] = int.Parse(Console.ReadLine());
antennas[1] = int.Parse(Console.ReadLine());
antennas[2] = int.Parse(Console.ReadLine());
antennas[3] = int.Parse(Console.ReadLine());
antennas[4] = int.Parse(Console.ReadLine());
var k = int.Parse(Console.ReadLine());
if (antennas[4] - antennas[0] <= k) {
Console.WriteLine("Yay!");
} else {
Console.WriteLine(":(");
}
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 167
| 4
|
using System;
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleTest {
class Program {
static void Main(string[] args) {
int[] a = new int[5];
a[0] = int.Parse(Console.ReadLine());
a[1] = int.Parse(Console.ReadLine().Split('\n')[0]);
a[2] = int.Parse(Console.ReadLine().Split('\n')[0]);
a[3] = int.Parse(Console.ReadLine().Split('\n')[0]);
a[4] = int.Parse(Console.ReadLine().Split('\n')[0]);
int k = int.Parse(Console.ReadLine().Split('\n')[0]);
for (int i = 0; i < a.Length; i++) {
for (int j = i + 1; j < a.Length; j++) {
if (a[j] - a[i] > k) {
System.Console.WriteLine(":(");
return;
}
}
}
System.Console.WriteLine("Yay");
}
}
}
|
using System;
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleTest {
class Program {
static void Main(string[] args) {
int[] a = new int[5];
a[0] = int.Parse(Console.ReadLine());
a[1] = int.Parse(Console.ReadLine().Split('\n')[0]);
a[2] = int.Parse(Console.ReadLine().Split('\n')[0]);
a[3] = int.Parse(Console.ReadLine().Split('\n')[0]);
a[4] = int.Parse(Console.ReadLine().Split('\n')[0]);
int k = int.Parse(Console.ReadLine().Split('\n')[0]);
for (int i = 0; i < a.Length; i++) {
for (int j = i + 1; j < a.Length; j++) {
if (a[j] - a[i] > k) {
System.Console.WriteLine(":(");
return;
}
}
}
System.Console.WriteLine("Yay!");
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 270
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace atcoder {
class Program {
static void Main(string[] args) {
var a = int.Parse(Console.ReadLine());
var b = int.Parse(Console.ReadLine());
var c = int.Parse(Console.ReadLine());
var d = int.Parse(Console.ReadLine());
var e = int.Parse(Console.ReadLine());
var k = int.Parse(Console.ReadLine());
var s = e - a;
if (s > k) {
Console.WriteLine(":(");
} else {
Console.WriteLine("Yey!");
}
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace atcoder {
class Program {
static void Main(string[] args) {
var a = int.Parse(Console.ReadLine());
var b = int.Parse(Console.ReadLine());
var c = int.Parse(Console.ReadLine());
var d = int.Parse(Console.ReadLine());
var e = int.Parse(Console.ReadLine());
var k = int.Parse(Console.ReadLine());
var s = e - a;
if (s > k) {
Console.WriteLine(":(");
} else {
Console.WriteLine("Yay!");
}
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 154
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
class Amondai {
static void Main() {
var line = new List<int>();
for (int i = 0; i < 6; ++i) {
line.Add(Int32.Parse(Console.ReadLine()));
}
var canable = true;
for (int i = 0; i < 4; ++i) {
for (int j = i + 1; j < 3; ++j) {
if (line[5] < line[j] - line[i])
canable = false;
}
}
Console.WriteLine(canable ? "Yay!" : ":(");
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
class Amondai {
static void Main() {
var line = new List<int>();
for (int i = 0; i < 6; ++i) {
line.Add(Int32.Parse(Console.ReadLine()));
}
var canable = true;
for (int i = 0; i < 4; ++i) {
for (int j = i + 1; j < 5; ++j) {
if (line[5] < Math.Abs(line[j] - line[i]))
canable = false;
}
}
Console.WriteLine(canable ? "Yay!" : ":(");
}
}
|
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 57, 15, 16, 12, 213, 63, 214, 205, 22], ["+", 0, 57, 15, 16, 12, 213, 63, 214, 0, 131], ["+", 0, 57, 15, 16, 12, 213, 63, 214, 141, 22], ["+", 0, 57, 15, 16, 12, 213, 3, 4, 0, 24], ["+", 0, 57, 15, 16, 12, 213, 3, 4, 0, 25]]
| 8
| 144
| 7
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp {
class Program {
static int N = 0;
static void Main(string[] args) {
var a = new int[5];
for (int i = 0; i < 5; i++) {
a[i] = int.Parse(Console.ReadLine());
}
var k = int.Parse(Console.ReadLine());
var can = true;
for (int i = 0; i < 5; i++) {
for (int j = i + 1; j < 5; j++) {
if (Math.Abs(a[i] - a[j]) >= k) {
can = false;
break;
}
}
if (can == false) {
break;
}
}
Console.WriteLine(can ? "Yay!" : ":(");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp {
class Program {
static int N = 0;
static void Main(string[] args) {
var a = new int[5];
for (int i = 0; i < 5; i++) {
a[i] = int.Parse(Console.ReadLine());
}
var k = int.Parse(Console.ReadLine());
var can = true;
for (int i = 0; i < 5; i++) {
for (int j = i + 1; j < 5; j++) {
if (Math.Abs(a[i] - a[j]) > k) {
can = false;
break;
}
}
if (can == false) {
break;
}
}
Console.WriteLine(can ? "Yay!" : ":(");
}
}
}
|
[["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 47]]
| 8
| 186
| 2
|
using System;
using System.Collections.Generic;
namespace B {
class Program {
static void Main(string[] args) {
var L = new List<int>();
int min = 999;
for (int i = 0; i < 5; i++) {
int x = int.Parse(Console.ReadLine());
if ((x % 10 != 0) && (x % 10 < min % 10))
min = x;
L.Add(x);
}
int ans = 0;
bool Once = true;
for (int i = 0; i < 5; i++) {
if (Once && (L[i] == min)) {
Once = false;
ans += L[i];
} else
ans += Up(L[i]);
}
Console.WriteLine(ans);
}
static public int Up(int x) {
while (x % 10 != 0) {
x++;
}
return x;
}
}
}
|
using System;
using System.Collections.Generic;
namespace B {
class Program {
static void Main(string[] args) {
var L = new List<int>();
int min = 999;
for (int i = 0; i < 5; i++) {
int x = int.Parse(Console.ReadLine());
if ((x % 10 != 0) && (x % 10 <= min % 10))
min = x;
L.Add(x);
}
int ans = 0;
bool Once = true;
for (int i = 0; i < 5; i++) {
if (Once && (L[i] == min)) {
Once = false;
ans += L[i];
} else
ans += Up(L[i]);
}
Console.WriteLine(ans);
}
static public int Up(int x) {
while (x % 10 != 0) {
x++;
}
return x;
}
}
}
|
[["-", 0, 57, 15, 16, 12, 23, 0, 16, 17, 18], ["+", 0, 57, 15, 16, 12, 23, 0, 16, 17, 19]]
| 8
| 202
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace cs {
public class Program {
public static void Main(string[] args) {
int min = 11;
int sum = 0;
int input = 0;
int t = 0;
for (int i = 0; i < 5; i++) {
input = int.Parse(Console.ReadLine());
if ((t = input % 10) != 0) {
min = Math.Min(min, t);
sum += (input / 10) * 10;
sum += 10;
} else {
sum += input;
}
}
if (min != 11)
sum -= 10;
sum += min;
Console.WriteLine(sum);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace cs {
public class Program {
public static void Main(string[] args) {
int min = 11;
int sum = 0;
int input = 0;
int t = 0;
for (int i = 0; i < 5; i++) {
input = int.Parse(Console.ReadLine());
if ((t = input % 10) != 0) {
min = Math.Min(min, t);
sum += (input / 10) * 10;
sum += 10;
} else {
sum += input;
}
}
if (min != 11) {
sum -= 10;
sum += min;
}
Console.WriteLine(sum);
}
}
}
|
[["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
| 8
| 152
| 2
|
using System;
using System.Linq;
namespace B___Five_Dishes {
class Program {
static void Main(string[] args) {
var ABCDE = new int [5].Select(_ => int.Parse(Console.ReadLine())).ToList();
var roundSum = ABCDE.Select(x => Math.Ceiling((double)x / 10) * 10).Sum();
var min = ABCDE.Select(x => x % 10).All(x => x == 0)
? 0
: ABCDE.Select(x => x % 10).Where(x => x != 0).Min();
Console.WriteLine(roundSum + min - 10);
}
}
}
|
using System;
using System.Linq;
namespace B___Five_Dishes {
class Program {
static void Main(string[] args) {
var ABCDE = new int [5].Select(_ => int.Parse(Console.ReadLine())).ToList();
var roundSum = ABCDE.Select(x => Math.Ceiling((double)x / 10) * 10).Sum();
var ajust = ABCDE.Select(x => x % 10).All(x => x == 0)
? 0
: ABCDE.Select(x => x % 10).Where(x => x != 0).Min() - 10;
Console.WriteLine(roundSum + ajust);
}
}
}
|
[["-", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 0, 200, 0, 212, 0, 41, 75, 16, 17, 33], ["+", 0, 200, 0, 212, 0, 41, 75, 16, 12, 203], ["-", 3, 4, 0, 28, 0, 16, 31, 16, 12, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
| 8
| 144
| 8
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace ConsoleApp2 {
public class Program {
public static void Main(string[] args) {
int A = int.Parse(Console.ReadLine());
int B = int.Parse(Console.ReadLine());
int C = int.Parse(Console.ReadLine());
int D = int.Parse(Console.ReadLine());
int E = int.Parse(Console.ReadLine());
int[] data = new int[5] { A, B, C, D, E };
int ans = 0;
int min = 0;
foreach (int item in data) {
int r = item % 10;
if (r == 0) {
ans += item;
} else {
ans += (item / 10) * 10 + 10;
if (r < min || min == 0)
min = r;
}
}
Console.WriteLine(ans - (10 - min));
}
private static int[] Read(string input) {
string[] inputs = input.Split(' ');
int num = inputs.Length;
int[] ints = new int[num];
for (int i = 0; i < num; i++) {
ints[i] = int.Parse(inputs[i]);
}
return ints;
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace ConsoleApp2 {
public class Program {
public static void Main(string[] args) {
int A = int.Parse(Console.ReadLine());
int B = int.Parse(Console.ReadLine());
int C = int.Parse(Console.ReadLine());
int D = int.Parse(Console.ReadLine());
int E = int.Parse(Console.ReadLine());
int[] data = new int[5] { A, B, C, D, E };
int ans = 0;
int min = 10;
foreach (int item in data) {
int r = item % 10;
if (r == 0) {
ans += item;
} else {
ans += (item / 10) * 10 + 10;
if (r < min || min == 0)
min = r;
}
}
Console.WriteLine(ans - (10 - min));
}
private static int[] Read(string input) {
string[] inputs = input.Split(' ');
int num = inputs.Length;
int[] ints = new int[num];
for (int i = 0; i < num; i++) {
ints[i] = int.Parse(inputs[i]);
}
return ints;
}
}
}
|
[["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203]]
| 8
| 286
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC123B {
class Program {
static void Main(string[] args) {
// 整数の入力
int n = 5;
int[] cookingTime = new int[n];
int[] nextOrderTime = new int[n];
for (int i = 0; i < n; i++) {
cookingTime[i] = int.Parse(Console.ReadLine());
nextOrderTime[i] = (cookingTime[i] + 9) / 10 * 10;
// Console.WriteLine(cookingTime[i]+" "+nextOrderTime[i]);
}
int lastOrdersTime = 10;
int lastOrder = n;
for (int i = 0; i < n; i++) {
if ((lastOrdersTime > cookingTime[i] % 10) &&
(cookingTime[i] % 10 != 0)) {
lastOrdersTime = cookingTime[i] % 10;
lastOrder = i;
}
}
int ans = 0;
for (int i = 0; i < n; i++) {
if (i != lastOrder) {
ans += nextOrderTime[i];
}
}
ans += cookingTime[lastOrder];
Console.WriteLine(ans);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC123B {
class Program {
static void Main(string[] args) {
// 整数の入力
int n = 5;
int[] cookingTime = new int[n];
int[] nextOrderTime = new int[n];
for (int i = 0; i < n; i++) {
cookingTime[i] = int.Parse(Console.ReadLine());
nextOrderTime[i] = (cookingTime[i] + 9) / 10 * 10;
// Console.WriteLine(cookingTime[i]+" "+nextOrderTime[i]);
}
int lastOrdersTime = 10;
int lastOrder = n - 1;
for (int i = 0; i < n; i++) {
if ((lastOrdersTime > cookingTime[i] % 10) &&
(cookingTime[i] % 10 != 0)) {
lastOrdersTime = cookingTime[i] % 10;
lastOrder = i;
}
}
int ans = 0;
for (int i = 0; i < n; i++) {
if (i != lastOrder) {
ans += nextOrderTime[i];
}
}
ans += cookingTime[lastOrder];
Console.WriteLine(ans);
}
}
}
|
[["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 33], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203]]
| 8
| 240
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleTest {
class Program {
static void Main(string[] args) {
int[] a = new int[5];
a[0] = int.Parse(Console.ReadLine());
a[1] = int.Parse(Console.ReadLine());
a[2] = int.Parse(Console.ReadLine());
a[3] = int.Parse(Console.ReadLine());
a[4] = int.Parse(Console.ReadLine());
var list = a.Where(x => x % 10 == 0).ToList();
list.AddRange(a.Where(x => x % 10 > 1).OrderByDescending(x => x % 10));
a = list.ToArray();
int totalMin = 0;
for (int i = 0; i < a.Length - 1; i++) {
var delta = (a[i] % 10 == 0) ? 0 : 10 - a[i] % 10;
totalMin += a[i] + delta;
}
totalMin += a[a.Length - 1];
System.Console.WriteLine($"{totalMin}");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleTest {
class Program {
static void Main(string[] args) {
int[] a = new int[5];
a[0] = int.Parse(Console.ReadLine());
a[1] = int.Parse(Console.ReadLine());
a[2] = int.Parse(Console.ReadLine());
a[3] = int.Parse(Console.ReadLine());
a[4] = int.Parse(Console.ReadLine());
var list = a.Where(x => x % 10 == 0).ToList();
list.AddRange(a.Where(x => x % 10 >= 1).OrderByDescending(x => x % 10));
a = list.ToArray();
int totalMin = 0;
for (int i = 0; i < a.Length - 1; i++) {
var delta = (a[i] % 10 == 0) ? 0 : 10 - a[i] % 10;
totalMin += a[i] + delta;
}
totalMin += a[a.Length - 1];
System.Console.WriteLine($"{totalMin}");
}
}
}
|
[["-", 3, 4, 0, 28, 0, 218, 8, 16, 17, 47], ["+", 3, 4, 0, 28, 0, 218, 8, 16, 17, 20]]
| 8
| 263
| 2
|
using System;
using System.Linq;
namespace B___Five_Dishes {
class Program {
static void Main(string[] args) {
var dishes = new int[5];
dishes[0] = int.Parse(Console.ReadLine());
dishes[1] = int.Parse(Console.ReadLine());
dishes[2] = int.Parse(Console.ReadLine());
dishes[3] = int.Parse(Console.ReadLine());
dishes[4] = int.Parse(Console.ReadLine());
var provideDishes = dishes.Select(x => x % 10).Where(x => x > 0);
int lastDish;
if (provideDishes.Any()) {
lastDish = provideDishes.Min();
} else {
lastDish = 10;
}
var time =
dishes.Select(s => (int)(Math.Ceiling((decimal)s / 10) * 10)).Sum() -
10 + (lastDish % 10);
Console.WriteLine(time);
}
}
}
|
using System;
using System.Linq;
namespace B___Five_Dishes {
class Program {
static void Main(string[] args) {
var dishes = new int[5];
dishes[0] = int.Parse(Console.ReadLine());
dishes[1] = int.Parse(Console.ReadLine());
dishes[2] = int.Parse(Console.ReadLine());
dishes[3] = int.Parse(Console.ReadLine());
dishes[4] = int.Parse(Console.ReadLine());
var provideDishes = dishes.Select(x => x % 10).Where(x => x > 0);
int lastDish;
if (provideDishes.Any()) {
lastDish = provideDishes.Min() % 10;
} else {
lastDish = 10;
}
var time =
dishes.Select(s => (int)(Math.Ceiling((decimal)s / 10) * 10)).Sum() -
10 + lastDish;
Console.WriteLine(time);
}
}
}
|
[["+", 64, 196, 0, 1, 0, 11, 12, 16, 17, 109], ["+", 64, 196, 0, 1, 0, 11, 12, 16, 12, 203], ["-", 0, 200, 0, 212, 0, 16, 12, 23, 0, 24], ["-", 0, 212, 0, 16, 12, 23, 0, 16, 17, 109], ["-", 0, 212, 0, 16, 12, 23, 0, 16, 12, 203], ["-", 0, 200, 0, 212, 0, 16, 12, 23, 0, 25]]
| 8
| 215
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
class ABC123B {
public static void Main() {
var ae = new List<int>();
ae.Add(int.Parse(Console.ReadLine()));
ae.Add(int.Parse(Console.ReadLine()));
ae.Add(int.Parse(Console.ReadLine()));
ae.Add(int.Parse(Console.ReadLine()));
ae.Add(int.Parse(Console.ReadLine()));
var ae2 = new List<int>();
ae.ForEach(x => ae2.Add(10 - x % 10));
ae2.RemoveAll(x => x == 10);
if (ae.Count != 0)
ae2.Remove(ae2.Max());
Console.WriteLine(ae.Sum() + ae2.Sum());
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
class ABC123B {
public static void Main() {
var ae = new List<int>();
ae.Add(int.Parse(Console.ReadLine()));
ae.Add(int.Parse(Console.ReadLine()));
ae.Add(int.Parse(Console.ReadLine()));
ae.Add(int.Parse(Console.ReadLine()));
ae.Add(int.Parse(Console.ReadLine()));
var ae2 = new List<int>();
ae.ForEach(x => ae2.Add(10 - x % 10));
ae2.RemoveAll(x => x == 10);
if (ae2.Count != 0)
ae2.Remove(ae2.Max());
Console.WriteLine(ae.Sum() + ae2.Sum());
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 31, 214, 205, 22], ["+", 8, 196, 0, 57, 15, 16, 31, 214, 205, 22]]
| 8
| 194
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
class Bmondai {
static void Main() {
var line = new List<int>();
var min = int.MaxValue;
var minIndex = 0;
for (int i = 0; i < 5; ++i) {
var a = Int32.Parse(Console.ReadLine());
line.Add(a);
var ten = a % 10;
if (ten != 0 && ten < min) {
min = ten;
minIndex = i;
}
if (ten != 0) {
line[i] += (10 - ten);
}
}
var ans = line.Sum() - (min != 0 ? 10 - min : 0);
Console.WriteLine(ans);
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
class Bmondai {
static void Main() {
var line = new List<int>();
var min = int.MaxValue;
var minIndex = 0;
for (int i = 0; i < 5; ++i) {
var a = Int32.Parse(Console.ReadLine());
line.Add(a);
var ten = a % 10;
if (ten != 0 && ten < min) {
min = ten;
minIndex = i;
}
if (ten != 0) {
line[i] += (10 - ten);
}
}
var ans = line.Sum() - (min != int.MaxValue ? 10 - min : 0);
Console.WriteLine(ans);
}
}
|
[["-", 0, 16, 12, 23, 0, 41, 15, 16, 12, 203], ["+", 12, 23, 0, 41, 15, 16, 12, 214, 205, 199], ["+", 12, 23, 0, 41, 15, 16, 12, 214, 0, 131], ["+", 12, 23, 0, 41, 15, 16, 12, 214, 141, 22]]
| 8
| 160
| 4
|
using System;
using System.Linq;
using static System.Console;
public class B {
static void Main(string[] args) {
var s = Array.ConvertAll(new string[] { ReadLine(), ReadLine(), ReadLine(),
ReadLine(), ReadLine() },
int.Parse);
var sum = s.Aggregate(
0, (n, elem) => elem % 10 == 0 ? n + elem : n + elem - elem % 10 + 10);
var min = s.Where(x => x % 10 != 0);
var frac = min.Any() ? min.Min(x => x % 10) : 0;
WriteLine(sum - 10 + frac);
}
}
|
using System;
using System.Linq;
using static System.Console;
public class B {
static void Main(string[] args) {
var s = Array.ConvertAll(new string[] { ReadLine(), ReadLine(), ReadLine(),
ReadLine(), ReadLine() },
int.Parse);
var sum = s.Aggregate(
0, (n, elem) => elem % 10 == 0 ? n + elem : n + elem - elem % 10 + 10);
var min = s.Where(x => x % 10 != 0);
var frac = min.Any() ? min.Min(x => x % 10) - 10 : 0;
WriteLine(sum + frac);
}
}
|
[["+", 0, 200, 0, 212, 0, 41, 64, 16, 17, 33], ["+", 0, 200, 0, 212, 0, 41, 64, 16, 12, 203], ["-", 3, 4, 0, 28, 0, 16, 31, 16, 17, 33], ["-", 3, 4, 0, 28, 0, 16, 31, 16, 12, 203]]
| 8
| 151
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace b {
class Program {
static void Main(string[] args) {
var lis = new List<int>();
for (int i = 0; i < 5; i++)
lis.Add(int.Parse(Console.ReadLine()));
lis = lis.OrderBy(i => i % 0 == 0 ? 1000 : i % 10).ToList();
int res = lis[0];
for (int i = 1; i < 5; i++) {
res += (lis[i] + 9) / 10 * 10;
}
Console.WriteLine(res);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace b {
class Program {
static void Main(string[] args) {
var lis = new List<int>();
for (int i = 0; i < 5; i++)
lis.Add(int.Parse(Console.ReadLine()));
lis = lis.OrderBy(i => i % 10 == 0 ? 1000 : i % 10).ToList();
int res = lis[0];
for (int i = 1; i < 5; i++) {
res += (lis[i] + 9) / 10 * 10;
}
Console.WriteLine(res);
}
}
}
|
[["-", 0, 218, 8, 41, 15, 16, 31, 16, 12, 203], ["+", 0, 218, 8, 41, 15, 16, 31, 16, 12, 203]]
| 8
| 158
| 2
|
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace debug {
class ProgramD {
static void Main(string[] args) {
//入力
long n = long.Parse(Console.ReadLine());
long[] m = new long[n];
m[0] = long.Parse(Console.ReadLine());
m[1] = long.Parse(Console.ReadLine());
m[2] = long.Parse(Console.ReadLine());
m[3] = long.Parse(Console.ReadLine());
m[4] = long.Parse(Console.ReadLine());
Console.WriteLine((n + m.Min() - 1) / m.Min() + 4);
}
}
}
|
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace debug {
class ProgramD {
static void Main(string[] args) {
//入力
long n = long.Parse(Console.ReadLine());
long[] m = new long[5];
m[0] = long.Parse(Console.ReadLine());
m[1] = long.Parse(Console.ReadLine());
m[2] = long.Parse(Console.ReadLine());
m[3] = long.Parse(Console.ReadLine());
m[4] = long.Parse(Console.ReadLine());
Console.WriteLine((n + m.Min() - 1) / m.Min() + 4);
}
}
}
|
[["-", 0, 212, 0, 227, 39, 224, 225, 226, 0, 22], ["+", 0, 212, 0, 227, 39, 224, 225, 226, 0, 203]]
| 8
| 175
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class AtCoderA {
static void Main() {
var sc = new Scanner();
long n = sc.NextLong();
long[] capa = new long[5];
for (int i = 0; i < 5; i++) {
capa[i] = sc.NextLong();
}
long min = capa.Min();
long answer = 5;
answer += (n + 1) / min;
Console.WriteLine(answer);
}
class Scanner {
private string[] _line;
private int _index;
private const char Separator = ' ';
public Scanner() {
_line = new string[0];
_index = 0;
}
public string Next() {
while (_index >= _line.Length) {
_line = Console.ReadLine().Split(Separator);
_index = 0;
}
return _line[_index++];
}
public int NextInt() => int.Parse(Next());
public long NextLong() => long.Parse(Next());
public double NextDouble() => double.Parse(Next());
public decimal NextDecimal() => decimal.Parse(Next());
public char NextChar() => Next()[0];
public char[] NextCharArray() => Next().ToCharArray();
public string[] Array() {
_line = Console.ReadLine().Split(Separator);
_index = _line.Length;
return _line;
}
public int[] IntArray() => Array().Select(int.Parse).ToArray();
public long[] LongArray() => Array().Select(long.Parse).ToArray();
public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class AtCoderA {
static void Main() {
var sc = new Scanner();
long n = sc.NextLong();
long[] capa = new long[5];
for (int i = 0; i < 5; i++) {
capa[i] = sc.NextLong();
}
long min = capa.Min();
long answer = 5;
answer += (n - 1) / min;
Console.WriteLine(answer);
}
class Scanner {
private string[] _line;
private int _index;
private const char Separator = ' ';
public Scanner() {
_line = new string[0];
_index = 0;
}
public string Next() {
while (_index >= _line.Length) {
_line = Console.ReadLine().Split(Separator);
_index = 0;
}
return _line[_index++];
}
public int NextInt() => int.Parse(Next());
public long NextLong() => long.Parse(Next());
public double NextDouble() => double.Parse(Next());
public decimal NextDecimal() => decimal.Parse(Next());
public char NextChar() => Next()[0];
public char[] NextCharArray() => Next().ToCharArray();
public string[] Array() {
_line = Console.ReadLine().Split(Separator);
_index = _line.Length;
return _line;
}
public int[] IntArray() => Array().Select(int.Parse).ToArray();
public long[] LongArray() => Array().Select(long.Parse).ToArray();
public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
}
}
|
[["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33]]
| 8
| 412
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
public static class Program {
public static void Main(string[] args) {
var n = long.Parse(Console.ReadLine());
var list = Enumerable.Range(0, 5)
.Select(x => long.Parse(Console.ReadLine()))
.ToList();
Console.WriteLine(Math.Ceiling(((double)n / list.Min())) + 4);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public static class Program {
public static void Main(string[] args) {
var n = long.Parse(Console.ReadLine());
var list = Enumerable.Range(0, 5)
.Select(x => long.Parse(Console.ReadLine()))
.ToList();
Console.WriteLine(Math.Ceiling(((decimal)n / list.Min())) + 4);
}
}
|
[["-", 0, 28, 0, 23, 0, 16, 31, 74, 39, 199], ["+", 0, 28, 0, 23, 0, 16, 31, 74, 39, 199]]
| 8
| 104
| 2
|
using System;
using System.Linq;
using System.Text;
class Program {
static void Main(string[] args) {
// 入力
long n = long.Parse(Console.ReadLine());
long[] abcde = new long[5];
abcde[0] = long.Parse(Console.ReadLine());
abcde[1] = long.Parse(Console.ReadLine());
abcde[2] = long.Parse(Console.ReadLine());
abcde[3] = long.Parse(Console.ReadLine());
abcde[4] = long.Parse(Console.ReadLine());
// abcdeからMINを見つける
long min = abcde.Min();
// MINの時の最短時間を考える
long ans = 5;
if (n >= min) {
ans = (n - 1) / min;
}
Console.WriteLine(ans);
}
}
|
using System;
using System.Linq;
using System.Text;
class Program {
static void Main(string[] args) {
// 入力
long n = long.Parse(Console.ReadLine());
long[] abcde = new long[5];
abcde[0] = long.Parse(Console.ReadLine());
abcde[1] = long.Parse(Console.ReadLine());
abcde[2] = long.Parse(Console.ReadLine());
abcde[3] = long.Parse(Console.ReadLine());
abcde[4] = long.Parse(Console.ReadLine());
// abcdeからMINを見つける
long min = abcde.Min();
// MINの時の最短時間を考える
long ans = 5;
if (n >= min) {
ans += (n - 1) / min;
}
Console.WriteLine(ans);
}
}
|
[["-", 64, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 107]]
| 8
| 175
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace MyProgram {
class AtCoder {
static void Main() {
long N = long.Parse(Console.ReadLine());
long A = long.Parse(Console.ReadLine());
long B = long.Parse(Console.ReadLine());
long C = long.Parse(Console.ReadLine());
long D = long.Parse(Console.ReadLine());
long E = long.Parse(Console.ReadLine());
long min = (long)(1e15 + 1);
min = Math.Min(A, B);
min = Math.Min(min, C);
min = Math.Min(min, D);
min = Math.Min(min, E);
Console.WriteLine(Math.Ceiling((double)N / min) + 4);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace MyProgram {
class AtCoder {
static void Main() {
long N = long.Parse(Console.ReadLine());
long A = long.Parse(Console.ReadLine());
long B = long.Parse(Console.ReadLine());
long C = long.Parse(Console.ReadLine());
long D = long.Parse(Console.ReadLine());
long E = long.Parse(Console.ReadLine());
long min = (long)(1e15 + 1);
min = Math.Min(A, B);
min = Math.Min(min, C);
min = Math.Min(min, D);
min = Math.Min(min, E);
Console.WriteLine((long)Math.Ceiling((double)N / min) + 4);
}
}
}
|
[["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 25]]
| 8
| 189
| 3
|
using System;
using System.Linq;
namespace CSharp {
class Program {
public static void Main() {
var N = long.Parse(Console.ReadLine());
var city =
new long [5].Select(_ => long.Parse(Console.ReadLine())).ToArray();
Console.WriteLine(Math.Ceiling((double)N / city.Min()) + 4);
}
}
}
|
using System;
using System.Linq;
namespace CSharp {
class Program {
public static void Main() {
var N = long.Parse(Console.ReadLine());
var city =
new long [5].Select(_ => long.Parse(Console.ReadLine())).ToArray();
Console.WriteLine((long)Math.Ceiling((double)N / city.Min()) + 4);
}
}
}
|
[["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 25]]
| 8
| 90
| 3
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
public static void Main() {
var N = long.Parse(Console.ReadLine());
List<long> list = new List<long>();
list.Add(long.Parse(Console.ReadLine()));
list.Add(long.Parse(Console.ReadLine()));
list.Add(long.Parse(Console.ReadLine()));
list.Add(long.Parse(Console.ReadLine()));
list.Add(long.Parse(Console.ReadLine()));
double a = Math.Ceiling((double)N / (double)list.Min());
Console.WriteLine(a + 4);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
public static void Main() {
var N = long.Parse(Console.ReadLine());
List<long> list = new List<long>();
list.Add(long.Parse(Console.ReadLine()));
list.Add(long.Parse(Console.ReadLine()));
list.Add(long.Parse(Console.ReadLine()));
list.Add(long.Parse(Console.ReadLine()));
list.Add(long.Parse(Console.ReadLine()));
double a = Math.Ceiling((double)N / (double)list.Min());
Console.WriteLine((long)a + 4);
}
}
|
[["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 25]]
| 8
| 166
| 3
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace kp {
public class Program {
// static long[,] cmb;
static int MAX_INT = 1000000007;
static void Main(string[] args) {
long N = long.Parse(Console.ReadLine());
// int[] input = Console.ReadLine().Split().Select(p =>
// int.Parse(p)).ToArray();
long A = long.Parse(Console.ReadLine());
long B = long.Parse(Console.ReadLine());
long C = long.Parse(Console.ReadLine());
long D = long.Parse(Console.ReadLine());
long E = long.Parse(Console.ReadLine());
// A~Eの一番小さい数字を探す
long min = A;
if (min > B)
min = B;
if (min > C)
min = C;
if (min > D)
min = D;
if (min > E)
min = E;
if (N % min == 0)
Console.WriteLine((N / min * 5) + "");
else
Console.WriteLine((5 + N / min) + "");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace kp {
public class Program {
// static long[,] cmb;
static int MAX_INT = 1000000007;
static void Main(string[] args) {
long N = long.Parse(Console.ReadLine());
// int[] input = Console.ReadLine().Split().Select(p =>
// int.Parse(p)).ToArray();
long A = long.Parse(Console.ReadLine());
long B = long.Parse(Console.ReadLine());
long C = long.Parse(Console.ReadLine());
long D = long.Parse(Console.ReadLine());
long E = long.Parse(Console.ReadLine());
// A~Eの一番小さい数字を探す
long min = A;
if (min > B)
min = B;
if (min > C)
min = C;
if (min > D)
min = D;
if (min > E)
min = E;
if (N % min == 0)
Console.WriteLine((5 + (N / min - 1)) + "");
else
Console.WriteLine((5 + N / min) + "");
}
}
}
|
[["+", 0, 28, 0, 16, 31, 23, 0, 16, 31, 203], ["+", 0, 28, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["-", 0, 28, 0, 16, 31, 23, 0, 16, 17, 48], ["-", 0, 28, 0, 16, 31, 23, 0, 16, 12, 203], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["+", 31, 23, 0, 16, 12, 23, 0, 16, 12, 203], ["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
| 8
| 227
| 8
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
#if !DEBUG
using System.IO;
#endif
public class Program {
public static void Main() {
#region SetAutoFlushIsFalse
#if !DEBUG
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
#endif
#endregion
var n = ReadLib.ReadAsLong();
var min = ReadLib.ReadNTimesAsLong(5).Min();
var score = 5 + Math.Floor((decimal)n / min);
Console.WriteLine(score);
#region Flush
#if !DEBUG
Console.Out.Flush();
sw.Close();
#endif
#endregion
}
}
static class Calculation {}
static class RootedTreeNodesFactory {
public class RootedTreeNode {
public int Id { get; }
public int Parent { get; }
public int Depth { get; set; }
int[] Childs { get; }
public RootedTreeNode(int id, int parent, int[] childs) {
this.Id = id;
this.Parent = parent;
this.Childs = childs;
}
}
}
static class Quick {
internal static void Calculate(int[] ts) { QuickSort(ts, 0, ts.Count() - 1); }
private static void QuickSort(int[] ts, int p, int r) {
if (p < r) {
var q = Partition(ts, p, r);
QuickSort(ts, p, q - 1);
QuickSort(ts, q + 1, r);
}
}
public static int Partition(int[] sArr, int p, int r) {
var x = sArr[r];
var i = p - 1;
for (int j = p; j < r; j++) {
if (sArr[j] <= x) {
i++;
sArr.Swap(i, j);
}
}
sArr.Swap(i + 1, r);
return i + 1;
}
}
static class ReadLib {
public static long ReadAsLong() { return long.Parse(Console.ReadLine()); }
public static int ReadAsInt() { return int.Parse(Console.ReadLine()); }
public static int[] ReadAsIntArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => int.Parse(s) + step)
.ToArray();
}
public static long[] ReadAsLongArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => long.Parse(s) + step)
.ToArray();
}
public static ulong[] ReadAsULongArray() {
return Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray();
}
public static string[] ReadAsStringArray() {
return Console.ReadLine().Split(' ');
}
public static int[] ReadNTimesAsInt(int n, int step = 0) {
return Enumerable.Range(1, n)
.Select(s => int.Parse(Console.ReadLine()) + step)
.ToArray();
}
public static long[] ReadNTimesAsLong(int n, int step = 0) {
return Enumerable.Range(1, n)
.Select(s => long.Parse(Console.ReadLine()) + step)
.ToArray();
}
public static int[][] ReadNTimesAsIntArray(int n, int step = 0) {
return Enumerable.Range(1, n).Select(s => ReadAsIntArray(step)).ToArray();
}
public static string[] ReadNTimesAsString(int n) {
return Enumerable.Range(1, n).Select(s => Console.ReadLine()).ToArray();
}
}
static class WriteLib {
public static void Write<T>(IEnumerable<T> ts) {
ts.ToList().ForEach(s => Console.WriteLine(s));
}
}
static class MyMath {
/// <summary>階乗</summary>
public static long Factorial(int n) {
if (n == 0) {
return 1;
}
return Permutation(n, 0);
}
public static long Permutation(int n, int k) {
return Enumerable.Range(0, n - k)
.Select(i => n - i)
.Aggregate(1, (b, i) => b * i);
}
#region FullPower
/// <summary>総乗、π</summary>
public static long FullPower(IEnumerable<long> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
public static long FullPower(IEnumerable<int> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
#endregion
/// <summary>最大公約数</summary>
public static long Gcd(long item1, long item2) {
var a = Math.Max(item1, item2);
var b = Math.Min(item1, item2);
while (true) {
long mod;
Math.DivRem(a, b, out mod);
if (mod == 0) {
break;
}
a = b;
b = mod;
}
return b;
}
/// <summary>約分。最大公約数で割ったものを返す。</summary>
public static Tuple<long, long> DeviedByGcd(long item1, long item2) {
var gcd = Gcd(item1, item2);
return new Tuple<long, long>(item1 / gcd, item2 / gcd);
}
public static long Lcm(int item1, int item2) {
return Math.BigMul(item1, item2) / Gcd(item1, item2);
}
public static ModCombination ModCombination(int maxN, int mod = 1000000007) {
return new ModCombination(maxN, mod);
}
/// <summary>a^n mod</summary>
public static int ModPow(int a, int n, int mod = 1000000007) {
var res = 1;
while (n > 0) {
if ((n & 1) == 1) {
res = (int)(Math.BigMul(res % mod, a) % mod); // resにaをかける
}
a = (int)(Math.Pow(a % mod, 2) % mod); // 次のaはa^2
n >>= 1;
}
return res;
}
}
static class MyMethod {
/// <summary>数え上げて、key, 出現回数に変換</summary>
public static Dictionary<T, int> CountUp<T>(IEnumerable<T> str) {
return str.GroupBy(c => c)
.Select(g => new KeyValuePair<T, int>(g.Key, g.Count()))
.ToDictionary(e => e.Key, e => e.Value);
}
/// <summary>計数ソート</summary>
public static int[] CountingSort(int[] aArr, int k) {
int[] b, c;
var n = aArr.Length;
b = new int[n];
c = Enumerable.Repeat(0, k + 1).ToArray();
for (int i = 0; i < n; i++) {
c[aArr[i]]++;
}
for (int i = 1; i <= k; i++) {
c[i] += c[i - 1];
}
for (int i = n - 1; i >= 0; i--) {
b[c[aArr[i]] - 1] = aArr[i];
c[aArr[i]]--;
}
return b;
}
}
/// <summary>無向グラフ</summary>
class UndirectedGraph {
public Dictionary<int, List<int>> Graph { get; }
/// <param name="graphArr">point1 to point2</param>
/// <param name="n">グラフの全要素数</param>
public UndirectedGraph(int[][] graphArr, int n) {
Graph = new Dictionary<int, List<int>>();
for (int i = 1; i <= n; i++) {
Graph.Add(i, new List<int>());
}
foreach (var arr in graphArr) {
Graph[arr[0]].Add(arr[1]);
Graph[arr[1]].Add(arr[0]);
}
}
}
/// <summary>DeepCopyするクラス</summary>
class DeepCopier {
BinaryFormatter b = new BinaryFormatter();
public T DeepCopy<T>(T obj) {
T result;
using (var mem = new MemoryStream()) {
b.Serialize(mem,
obj); // binaryFormatterによりobjをmemにserial化して書き出す
mem.Position = 0; // memのpotisionを先頭に戻す
result = (T)b.Deserialize(mem); // memの内容を読み取る。
}
return result;
}
}
static class MergeSort {
public static long[] Sort(long[] arr) { return Sort(arr, 0, arr.Count()); }
// rightは+1されていることに注意
private static long[] Merge(long[] sArr, int left, int mid, int right) {
var n1 = mid - left;
var n2 = right - mid;
var lArr = new long[n1 + 1];
var rArr = new long[n2 + 1];
for (int i = 0; i < n1; i++) {
lArr[i] = sArr[left + i];
}
lArr[n1] = int.MaxValue;
for (int i = 0; i < n2; i++) {
rArr[i] = sArr[mid + i];
}
rArr[n2] = int.MaxValue;
int l = 0, r = 0;
for (int k = left; k < right; k++) {
if (lArr[l] <= rArr[r]) {
sArr[k] = lArr[l];
l++;
} else {
sArr[k] = rArr[r];
r++;
}
}
return sArr; // 要素数はright - left
}
private static long[] Sort(long[] sArr, int left, int right) {
if (left + 1 < right) {
var mid = (left + right) / 2;
sArr = Sort(sArr, left, mid);
sArr = Sort(sArr, mid, right);
sArr = Merge(sArr, left, mid, right);
}
return sArr;
}
}
/// <summary>あまりを計算するためのintのラッパー</summary>
struct ModInt {
int Value { get; }
int Mod { get; }
public override string ToString() { return Value.ToString(); }
public static explicit operator ModInt(long value) {
return new ModInt(value);
}
public ModInt(long value, int mod = 1000000007) {
this.Value = (int)(value % mod);
this.Mod = mod;
}
public static explicit operator int(ModInt modInt) { return modInt.Value; }
private static void CheckNotEqualMod(ModInt item1, ModInt item2) {
if (item1.Mod != item2.Mod) {
throw new Exception("mod not equal");
}
}
public static ModInt operator +(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = item1.Value + item2.Value;
return new ModInt(value, item1.Mod);
}
public static ModInt operator *(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = Math.BigMul(item1.Value, item2.Value);
return new ModInt(value, item1.Mod);
}
public static ModInt operator -(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = item1.Value - item2.Value;
if (value < 0) {
value += item1.Mod;
}
return new ModInt(value, item1.Mod);
}
public static ModInt operator +(ModInt item1, int item2) {
return item1 + new ModInt(item2, item1.Mod);
}
public static ModInt operator *(ModInt item1, int item2) {
return item1 * new ModInt(item2, item1.Mod);
}
public static ModInt operator -(ModInt item1, int item2) {
return item1 - new ModInt(item2, item1.Mod);
}
public override int GetHashCode() { return this.Value; }
public override bool Equals(object obj) {
if (obj == null || this.GetType() != obj.GetType()) {
return false;
}
var modIntObj = (ModInt)obj;
return modIntObj.Value == this.Value;
}
public static bool operator ==(ModInt item1, ModInt item2) {
return item1.Value == item2.Value;
}
public static bool operator !=(ModInt item1, ModInt item2) {
return !(item1 == item2);
}
public static bool operator ==(ModInt item1, int item2) {
return item1.Value == item2;
}
public static bool operator !=(ModInt item1, int item2) {
return !(item1.Value == item2);
}
public static bool operator >=(ModInt item1, ModInt item2) {
return item1.Value >= item2.Value;
}
public static bool operator <=(ModInt item1, ModInt item2) {
return item1.Value <= item2.Value;
}
public static bool operator >=(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator <=(ModInt item1, int item2) {
return item1.Value <= item2;
}
public static bool operator>(ModInt item1, ModInt item2) {
return item1.Value > item2.Value;
}
public static bool operator<(ModInt item1, ModInt item2) {
return item1.Value < item2.Value;
}
public static bool operator>(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator<(ModInt item1, int item2) {
return item1.Value <= item2;
}
}
/// <summary>組み合わせ</summary>
class ModCombination {
private int mod;
private int[] fac;
private int[] finv;
private int[] inv;
public ModCombination(int max, int mod = 1000000007) {
this.mod = mod;
fac = new int[max]; // modが法のn!の列
inv = new int[max]; // indexの逆元の列
finv = new int[max]; // modを法とした、invの累積の累積
fac[0] = 1;
fac[1] = 1;
finv[0] = 1;
finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < max; i++) {
fac[i] = (int)(Math.BigMul(fac[i - 1], i) % mod); // factorを求める
var s = Math.BigMul(inv[mod % i], mod / i) % mod;
inv[i] = (int)(mod - s);
// iに対する逆元を求める
finv[i] = (int)(Math.BigMul(finv[i - 1], inv[i]) % mod);
}
}
/// <summary>nCk</summary>
public int Calculation(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return (int)(Math.BigMul(fac[n],
(int)(Math.BigMul(finv[k], finv[n - k]) % mod)) %
mod);
}
}
/// <summary>拡張メソッドs</summary>
static class Extention {
/// <summary>iとjを入れ替える</summary>
public static void Swap<T>(this T[] arr, int i, int j) {
var buf = arr[i];
arr[i] = arr[j];
arr[j] = buf;
}
/// <summary>
/// partition。末尾sArr[r]を基準として、左に基準より小さい数、右に基準より大きい数が存在するように配列を並び替える。
/// </summary>
/// <param name="sArr"></param>
/// <param name="p">partitionの先頭の添字</param>
/// <param name="r">partitionの末尾の添字</param>
/// <returns>partitionの基準が存在する添字</returns>
public static int Partition(this int[] sArr, int p, int r) {
var x = sArr[r];
var i = p - 1;
for (int j = p; j < r; j++) {
if (sArr[j] <= x) {
i++;
sArr.Swap(i, j);
}
}
sArr.Swap(i + 1, r);
return i + 1;
}
/// <summary>深いコピーをする</summary>
public static T DeepCopy<T>(this T obj) {
T result;
var b = new BinaryFormatter();
using (var mem = new MemoryStream()) {
b.Serialize(mem,
obj); // binaryFormatterによりobjをmemにserial化して書き出す
mem.Position = 0; // memのpotisionを先頭に戻す
result = (T)b.Deserialize(mem); // memの内容を読み取る。
}
return result;
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
#if !DEBUG
using System.IO;
#endif
public class Program {
public static void Main() {
#region SetAutoFlushIsFalse
#if !DEBUG
var sw =
new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
#endif
#endregion
var n = ReadLib.ReadAsLong();
var min = ReadLib.ReadNTimesAsLong(5).Min();
var score = 4 + Math.Ceiling((decimal)n / min);
Console.WriteLine(score);
#region Flush
#if !DEBUG
Console.Out.Flush();
sw.Close();
#endif
#endregion
}
}
static class Calculation {}
static class RootedTreeNodesFactory {
public class RootedTreeNode {
public int Id { get; }
public int Parent { get; }
public int Depth { get; set; }
int[] Childs { get; }
public RootedTreeNode(int id, int parent, int[] childs) {
this.Id = id;
this.Parent = parent;
this.Childs = childs;
}
}
}
static class Quick {
internal static void Calculate(int[] ts) { QuickSort(ts, 0, ts.Count() - 1); }
private static void QuickSort(int[] ts, int p, int r) {
if (p < r) {
var q = Partition(ts, p, r);
QuickSort(ts, p, q - 1);
QuickSort(ts, q + 1, r);
}
}
public static int Partition(int[] sArr, int p, int r) {
var x = sArr[r];
var i = p - 1;
for (int j = p; j < r; j++) {
if (sArr[j] <= x) {
i++;
sArr.Swap(i, j);
}
}
sArr.Swap(i + 1, r);
return i + 1;
}
}
static class ReadLib {
public static long ReadAsLong() { return long.Parse(Console.ReadLine()); }
public static int ReadAsInt() { return int.Parse(Console.ReadLine()); }
public static int[] ReadAsIntArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => int.Parse(s) + step)
.ToArray();
}
public static long[] ReadAsLongArray(int step = 0) {
return Console.ReadLine()
.Split(' ')
.Select(s => long.Parse(s) + step)
.ToArray();
}
public static ulong[] ReadAsULongArray() {
return Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray();
}
public static string[] ReadAsStringArray() {
return Console.ReadLine().Split(' ');
}
public static int[] ReadNTimesAsInt(int n, int step = 0) {
return Enumerable.Range(1, n)
.Select(s => int.Parse(Console.ReadLine()) + step)
.ToArray();
}
public static long[] ReadNTimesAsLong(int n, int step = 0) {
return Enumerable.Range(1, n)
.Select(s => long.Parse(Console.ReadLine()) + step)
.ToArray();
}
public static int[][] ReadNTimesAsIntArray(int n, int step = 0) {
return Enumerable.Range(1, n).Select(s => ReadAsIntArray(step)).ToArray();
}
public static string[] ReadNTimesAsString(int n) {
return Enumerable.Range(1, n).Select(s => Console.ReadLine()).ToArray();
}
}
static class WriteLib {
public static void Write<T>(IEnumerable<T> ts) {
ts.ToList().ForEach(s => Console.WriteLine(s));
}
}
static class MyMath {
/// <summary>階乗</summary>
public static long Factorial(int n) {
if (n == 0) {
return 1;
}
return Permutation(n, 0);
}
public static long Permutation(int n, int k) {
return Enumerable.Range(0, n - k)
.Select(i => n - i)
.Aggregate(1, (b, i) => b * i);
}
#region FullPower
/// <summary>総乗、π</summary>
public static long FullPower(IEnumerable<long> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
public static long FullPower(IEnumerable<int> vs) {
return vs.Aggregate(1L, (a, b) => a * b);
}
#endregion
/// <summary>最大公約数</summary>
public static long Gcd(long item1, long item2) {
var a = Math.Max(item1, item2);
var b = Math.Min(item1, item2);
while (true) {
long mod;
Math.DivRem(a, b, out mod);
if (mod == 0) {
break;
}
a = b;
b = mod;
}
return b;
}
/// <summary>約分。最大公約数で割ったものを返す。</summary>
public static Tuple<long, long> DeviedByGcd(long item1, long item2) {
var gcd = Gcd(item1, item2);
return new Tuple<long, long>(item1 / gcd, item2 / gcd);
}
public static long Lcm(int item1, int item2) {
return Math.BigMul(item1, item2) / Gcd(item1, item2);
}
public static ModCombination ModCombination(int maxN, int mod = 1000000007) {
return new ModCombination(maxN, mod);
}
/// <summary>a^n mod</summary>
public static int ModPow(int a, int n, int mod = 1000000007) {
var res = 1;
while (n > 0) {
if ((n & 1) == 1) {
res = (int)(Math.BigMul(res % mod, a) % mod); // resにaをかける
}
a = (int)(Math.Pow(a % mod, 2) % mod); // 次のaはa^2
n >>= 1;
}
return res;
}
}
static class MyMethod {
/// <summary>数え上げて、key, 出現回数に変換</summary>
public static Dictionary<T, int> CountUp<T>(IEnumerable<T> str) {
return str.GroupBy(c => c)
.Select(g => new KeyValuePair<T, int>(g.Key, g.Count()))
.ToDictionary(e => e.Key, e => e.Value);
}
/// <summary>計数ソート</summary>
public static int[] CountingSort(int[] aArr, int k) {
int[] b, c;
var n = aArr.Length;
b = new int[n];
c = Enumerable.Repeat(0, k + 1).ToArray();
for (int i = 0; i < n; i++) {
c[aArr[i]]++;
}
for (int i = 1; i <= k; i++) {
c[i] += c[i - 1];
}
for (int i = n - 1; i >= 0; i--) {
b[c[aArr[i]] - 1] = aArr[i];
c[aArr[i]]--;
}
return b;
}
}
/// <summary>無向グラフ</summary>
class UndirectedGraph {
public Dictionary<int, List<int>> Graph { get; }
/// <param name="graphArr">point1 to point2</param>
/// <param name="n">グラフの全要素数</param>
public UndirectedGraph(int[][] graphArr, int n) {
Graph = new Dictionary<int, List<int>>();
for (int i = 1; i <= n; i++) {
Graph.Add(i, new List<int>());
}
foreach (var arr in graphArr) {
Graph[arr[0]].Add(arr[1]);
Graph[arr[1]].Add(arr[0]);
}
}
}
/// <summary>DeepCopyするクラス</summary>
class DeepCopier {
BinaryFormatter b = new BinaryFormatter();
public T DeepCopy<T>(T obj) {
T result;
using (var mem = new MemoryStream()) {
b.Serialize(mem,
obj); // binaryFormatterによりobjをmemにserial化して書き出す
mem.Position = 0; // memのpotisionを先頭に戻す
result = (T)b.Deserialize(mem); // memの内容を読み取る。
}
return result;
}
}
static class MergeSort {
public static long[] Sort(long[] arr) { return Sort(arr, 0, arr.Count()); }
// rightは+1されていることに注意
private static long[] Merge(long[] sArr, int left, int mid, int right) {
var n1 = mid - left;
var n2 = right - mid;
var lArr = new long[n1 + 1];
var rArr = new long[n2 + 1];
for (int i = 0; i < n1; i++) {
lArr[i] = sArr[left + i];
}
lArr[n1] = int.MaxValue;
for (int i = 0; i < n2; i++) {
rArr[i] = sArr[mid + i];
}
rArr[n2] = int.MaxValue;
int l = 0, r = 0;
for (int k = left; k < right; k++) {
if (lArr[l] <= rArr[r]) {
sArr[k] = lArr[l];
l++;
} else {
sArr[k] = rArr[r];
r++;
}
}
return sArr; // 要素数はright - left
}
private static long[] Sort(long[] sArr, int left, int right) {
if (left + 1 < right) {
var mid = (left + right) / 2;
sArr = Sort(sArr, left, mid);
sArr = Sort(sArr, mid, right);
sArr = Merge(sArr, left, mid, right);
}
return sArr;
}
}
/// <summary>あまりを計算するためのintのラッパー</summary>
struct ModInt {
int Value { get; }
int Mod { get; }
public override string ToString() { return Value.ToString(); }
public static explicit operator ModInt(long value) {
return new ModInt(value);
}
public ModInt(long value, int mod = 1000000007) {
this.Value = (int)(value % mod);
this.Mod = mod;
}
public static explicit operator int(ModInt modInt) { return modInt.Value; }
private static void CheckNotEqualMod(ModInt item1, ModInt item2) {
if (item1.Mod != item2.Mod) {
throw new Exception("mod not equal");
}
}
public static ModInt operator +(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = item1.Value + item2.Value;
return new ModInt(value, item1.Mod);
}
public static ModInt operator *(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = Math.BigMul(item1.Value, item2.Value);
return new ModInt(value, item1.Mod);
}
public static ModInt operator -(ModInt item1, ModInt item2) {
CheckNotEqualMod(item1, item2);
long value = item1.Value - item2.Value;
if (value < 0) {
value += item1.Mod;
}
return new ModInt(value, item1.Mod);
}
public static ModInt operator +(ModInt item1, int item2) {
return item1 + new ModInt(item2, item1.Mod);
}
public static ModInt operator *(ModInt item1, int item2) {
return item1 * new ModInt(item2, item1.Mod);
}
public static ModInt operator -(ModInt item1, int item2) {
return item1 - new ModInt(item2, item1.Mod);
}
public override int GetHashCode() { return this.Value; }
public override bool Equals(object obj) {
if (obj == null || this.GetType() != obj.GetType()) {
return false;
}
var modIntObj = (ModInt)obj;
return modIntObj.Value == this.Value;
}
public static bool operator ==(ModInt item1, ModInt item2) {
return item1.Value == item2.Value;
}
public static bool operator !=(ModInt item1, ModInt item2) {
return !(item1 == item2);
}
public static bool operator ==(ModInt item1, int item2) {
return item1.Value == item2;
}
public static bool operator !=(ModInt item1, int item2) {
return !(item1.Value == item2);
}
public static bool operator >=(ModInt item1, ModInt item2) {
return item1.Value >= item2.Value;
}
public static bool operator <=(ModInt item1, ModInt item2) {
return item1.Value <= item2.Value;
}
public static bool operator >=(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator <=(ModInt item1, int item2) {
return item1.Value <= item2;
}
public static bool operator>(ModInt item1, ModInt item2) {
return item1.Value > item2.Value;
}
public static bool operator<(ModInt item1, ModInt item2) {
return item1.Value < item2.Value;
}
public static bool operator>(ModInt item1, int item2) {
return item1.Value >= item2;
}
public static bool operator<(ModInt item1, int item2) {
return item1.Value <= item2;
}
}
/// <summary>組み合わせ</summary>
class ModCombination {
private int mod;
private int[] fac;
private int[] finv;
private int[] inv;
public ModCombination(int max, int mod = 1000000007) {
this.mod = mod;
fac = new int[max]; // modが法のn!の列
inv = new int[max]; // indexの逆元の列
finv = new int[max]; // modを法とした、invの累積の累積
fac[0] = 1;
fac[1] = 1;
finv[0] = 1;
finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < max; i++) {
fac[i] = (int)(Math.BigMul(fac[i - 1], i) % mod); // factorを求める
var s = Math.BigMul(inv[mod % i], mod / i) % mod;
inv[i] = (int)(mod - s);
// iに対する逆元を求める
finv[i] = (int)(Math.BigMul(finv[i - 1], inv[i]) % mod);
}
}
/// <summary>nCk</summary>
public int Calculation(int n, int k) {
if (n < k)
return 0;
if (n < 0 || k < 0)
return 0;
return (int)(Math.BigMul(fac[n],
(int)(Math.BigMul(finv[k], finv[n - k]) % mod)) %
mod);
}
}
/// <summary>拡張メソッドs</summary>
static class Extention {
/// <summary>iとjを入れ替える</summary>
public static void Swap<T>(this T[] arr, int i, int j) {
var buf = arr[i];
arr[i] = arr[j];
arr[j] = buf;
}
/// <summary>
/// partition。末尾sArr[r]を基準として、左に基準より小さい数、右に基準より大きい数が存在するように配列を並び替える。
/// </summary>
/// <param name="sArr"></param>
/// <param name="p">partitionの先頭の添字</param>
/// <param name="r">partitionの末尾の添字</param>
/// <returns>partitionの基準が存在する添字</returns>
public static int Partition(this int[] sArr, int p, int r) {
var x = sArr[r];
var i = p - 1;
for (int j = p; j < r; j++) {
if (sArr[j] <= x) {
i++;
sArr.Swap(i, j);
}
}
sArr.Swap(i + 1, r);
return i + 1;
}
/// <summary>深いコピーをする</summary>
public static T DeepCopy<T>(this T obj) {
T result;
var b = new BinaryFormatter();
using (var mem = new MemoryStream()) {
b.Serialize(mem,
obj); // binaryFormatterによりobjをmemにserial化して書き出す
mem.Position = 0; // memのpotisionを先頭に戻す
result = (T)b.Deserialize(mem); // memの内容を読み取る。
}
return result;
}
}
|
[["-", 0, 198, 0, 200, 0, 212, 0, 16, 31, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 31, 203], ["-", 0, 212, 0, 16, 12, 213, 63, 214, 141, 22], ["+", 0, 212, 0, 16, 12, 213, 63, 214, 141, 22]]
| 8
| 3,221
| 4
|
using System;
using System.Linq;
namespace C___Five_Transportations {
class Program {
static void Main(string[] args) {
var N = long.Parse(Console.ReadLine());
var ABCDE =
new int [5].Select(x => long.Parse(Console.ReadLine())).ToArray();
Console.WriteLine(4 + Math.Ceiling((double)N / ABCDE.Min()));
}
}
}
|
using System;
using System.Linq;
namespace C___Five_Transportations {
class Program {
static void Main(string[] args) {
var N = long.Parse(Console.ReadLine());
var ABCDE =
new int [5].Select(x => long.Parse(Console.ReadLine())).ToArray();
Console.WriteLine(4 + Math.Ceiling((decimal)N / ABCDE.Min()));
}
}
}
|
[["-", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199]]
| 8
| 93
| 2
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using static System.Console;
namespace ABC123C {
static class Program {
static void Main(string[] args) {
var l = ReadLineOne<long>(6);
var n = l.FirstOrDefault();
var min = l.Min();
WriteLine(Math.Ceiling((double)n / min) + 4);
}
public static T TryParse<T>(this String input) {
try {
var converter = TypeDescriptor.GetConverter(typeof(T));
if (converter != null) {
return (T)converter.ConvertFromString(input);
} else {
throw new InvalidCastException("");
}
} catch {
throw new InvalidCastException(typeof(T) + " is not supported.");
}
}
public static List<T> SplitTryParseToList<T>(this String input) {
return input.Split().Select(n => n.TryParse<T>()).ToList();
}
public static List<T> ListSwap<T>(this List<T> list, Int32 index1,
Int32 index2) {
var t = list[index1];
list[index1] = list[index2];
list[index2] = t;
return list;
}
public static List<Tuple<T, int>>
DuplicateCount<T>(this IEnumerable<T> list) {
return list.GroupBy(i => i)
.Where(g => g.Any())
.Select(g => Tuple.Create(g.Key, g.Count()))
.ToList();
}
public static List<Tuple<T, int>>
DuplicateSort<T>(this IEnumerable<Tuple<T, int>> list) {
return list.OrderByDescending((x) => x.Item2).ToList();
}
public static List<T> ReadLineOne<T>(int n) {
var list = new List<T>();
foreach (var i in Enumerable.Range(1, n)) {
list.Add(Console.ReadLine().TryParse<T>());
}
return list;
}
public static void PrintAll<T>(this IEnumerable<T> list) {
foreach (var i in list) {
Console.Write($"{i} ");
}
Console.WriteLine();
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using static System.Console;
namespace ABC123C {
static class Program {
static void Main(string[] args) {
var l = ReadLineOne<long>(6);
var n = l.FirstOrDefault();
var min = l.Min();
WriteLine((long)Math.Ceiling((double)n / min) + 4);
}
public static T TryParse<T>(this String input) {
try {
var converter = TypeDescriptor.GetConverter(typeof(T));
if (converter != null) {
return (T)converter.ConvertFromString(input);
} else {
throw new InvalidCastException("");
}
} catch {
throw new InvalidCastException(typeof(T) + " is not supported.");
}
}
public static List<T> SplitTryParseToList<T>(this String input) {
return input.Split().Select(n => n.TryParse<T>()).ToList();
}
public static List<T> ListSwap<T>(this List<T> list, Int32 index1,
Int32 index2) {
var t = list[index1];
list[index1] = list[index2];
list[index2] = t;
return list;
}
public static List<Tuple<T, int>>
DuplicateCount<T>(this IEnumerable<T> list) {
return list.GroupBy(i => i)
.Where(g => g.Any())
.Select(g => Tuple.Create(g.Key, g.Count()))
.ToList();
}
public static List<Tuple<T, int>>
DuplicateSort<T>(this IEnumerable<Tuple<T, int>> list) {
return list.OrderByDescending((x) => x.Item2).ToList();
}
public static List<T> ReadLineOne<T>(int n) {
var list = new List<T>();
foreach (var i in Enumerable.Range(1, n)) {
list.Add(Console.ReadLine().TryParse<T>());
}
return list;
}
public static void PrintAll<T>(this IEnumerable<T> list) {
foreach (var i in list) {
Console.Write($"{i} ");
}
Console.WriteLine();
}
}
}
|
[["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 25]]
| 8
| 496
| 3
|
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;
namespace ConsoleApp1 {
class Program {
static void Main(string[] args) { A(); }
static void A() {
Println(Ceiling((double)ReadLong() /
new List<long> {
ReadLong(),
ReadLong(),
ReadLong(),
ReadLong(),
ReadLong(),
}
.Min()) +
4);
}
static IEnumerable<int> Range(int start, int stop) {
if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
return new List<int>();
return Enumerable.Range(start, stop - start);
}
static bool IsDigit(string str) {
var i = 0;
return int.TryParse(str, out i);
}
static int DigitsSum(long num) {
return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
}
static int[] ToIntArray(string str) {
return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
}
static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);
static bool IsPrime(int x) {
if (x <= 1 || (x != 2 && x % 2 == 0))
return false;
if (x == 2)
return true;
for (int i = 3; i < x; i += 2)
if (x % i == 0)
return false;
return true;
}
static string Read() => Console.ReadLine();
static int ReadInt() => int.Parse(Read());
static long ReadLong() => long.Parse(Read());
static List<string> ReadSplit() => Read().Split().ToList();
static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
static List<long>
ReadSplitLong() => Read().Split().Select(long.Parse).ToList();
static void Print(object value) => Console.Write(value.ToString());
static void Println(object value) => Console.WriteLine(value.ToString());
static string Join<T>(IEnumerable<T> list) => string.Join("", list);
}
public static class MyExtensions {
public static string Slice(this string str, int start = 0, int stop = 0) {
if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
return "";
if (stop == 0)
stop = str.Length;
return str.Substring(start, stop - start);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;
namespace ConsoleApp1 {
class Program {
static void Main(string[] args) { A(); }
static void A() {
Println(Ceiling((decimal)ReadLong() /
new List<long> {
ReadLong(),
ReadLong(),
ReadLong(),
ReadLong(),
ReadLong(),
}
.Min()) +
4);
}
static IEnumerable<int> Range(int start, int stop) {
if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
return new List<int>();
return Enumerable.Range(start, stop - start);
}
static bool IsDigit(string str) {
var i = 0;
return int.TryParse(str, out i);
}
static int DigitsSum(long num) {
return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
}
static int[] ToIntArray(string str) {
return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
}
static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);
static bool IsPrime(int x) {
if (x <= 1 || (x != 2 && x % 2 == 0))
return false;
if (x == 2)
return true;
for (int i = 3; i < x; i += 2)
if (x % i == 0)
return false;
return true;
}
static string Read() => Console.ReadLine();
static int ReadInt() => int.Parse(Read());
static long ReadLong() => long.Parse(Read());
static List<string> ReadSplit() => Read().Split().ToList();
static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
static List<long>
ReadSplitLong() => Read().Split().Select(long.Parse).ToList();
static void Print(object value) => Console.Write(value.ToString());
static void Println(object value) => Console.WriteLine(value.ToString());
static string Join<T>(IEnumerable<T> list) => string.Join("", list);
}
public static class MyExtensions {
public static string Slice(this string str, int start = 0, int stop = 0) {
if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
return "";
if (stop == 0)
stop = str.Length;
return str.Substring(start, stop - start);
}
}
}
|
[["-", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199]]
| 8
| 605
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC123_C_Five_Transportations {
class Program {
static void Main(string[] args) {
long n = long.Parse(Console.ReadLine());
long[] persons = new long[5];
for (int j = 0; j < 5; j++) {
persons[j] = int.Parse(Console.ReadLine());
}
long minLimit = persons.Min();
int minIndex = Array.IndexOf(persons, minLimit) + 1;
long output = 0;
decimal i = Math.Ceiling((decimal)n / minLimit);
if (i == 0) {
output = 5;
} else {
output = (long)i + 4;
}
Console.WriteLine(output);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC123_C_Five_Transportations {
class Program {
static void Main(string[] args) {
long n = long.Parse(Console.ReadLine());
long[] persons = new long[5];
for (int j = 0; j < 5; j++) {
persons[j] = long.Parse(Console.ReadLine());
}
long minLimit = persons.Min();
int minIndex = Array.IndexOf(persons, minLimit) + 1;
long output = 0;
decimal i = Math.Ceiling((decimal)n / minLimit);
if (i == 0) {
output = 5;
} else {
output = (long)i + 4;
}
Console.WriteLine(output);
}
}
}
|
[["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199]]
| 8
| 177
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace Algorithm {
class Program {
const int NumberOfCities = 6;
const int NumberOfVehicle = 5;
static void Main(string[] args) {
var n = long.Parse(Console.ReadLine());
var citiesPeople = new long[NumberOfCities];
var vehicles = new long[NumberOfVehicle];
for (var i = 0; i < NumberOfVehicle; i++) {
vehicles[i] = int.Parse(Console.ReadLine());
}
var min = vehicles.Min();
var answer = n / min + NumberOfVehicle;
if (n % min == 0)
answer -= 1;
Console.WriteLine(answer);
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
namespace Algorithm {
class Program {
const int NumberOfCities = 6;
const int NumberOfVehicle = 5;
static void Main(string[] args) {
var n = long.Parse(Console.ReadLine());
var citiesPeople = new long[NumberOfCities];
var vehicles = new long[NumberOfVehicle];
for (var i = 0; i < NumberOfVehicle; i++) {
vehicles[i] = long.Parse(Console.ReadLine());
}
var min = vehicles.Min();
var answer = n / min + NumberOfVehicle;
if (n % min == 0)
answer -= 1;
Console.WriteLine(answer);
}
}
}
|
[["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199]]
| 8
| 152
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC123 {
class ABC123_C {
static void Main(string[] args) {
var N = long.Parse(Console.ReadLine());
var capacityList = new List<double>();
for (int i = 0; i < "ABCDE".Length; i++) {
capacityList.Add(long.Parse(Console.ReadLine()));
}
Console.WriteLine((int)Math.Ceiling(N / capacityList.Min()) + 4);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC123 {
class ABC123_C {
static void Main(string[] args) {
var N = long.Parse(Console.ReadLine());
var capacityList = new List<double>();
for (int i = 0; i < "ABCDE".Length; i++) {
capacityList.Add(long.Parse(Console.ReadLine()));
}
Console.WriteLine((long)Math.Ceiling(N / capacityList.Min()) + 4);
}
}
}
|
[["-", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199]]
| 8
| 130
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC123C {
class Program {
static void Main(string[] args) {
// 人数
long N = long.Parse(Console.ReadLine());
long[] capacity = new long[5];
for (int i = 0; i < 5; i++) {
capacity[i] = int.Parse(Console.ReadLine());
}
long min = capacity.Min();
// Console.WriteLine(min);
long ans = (N + min - 1) / min + 4L;
Console.WriteLine(ans);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC123C {
class Program {
static void Main(string[] args) {
// 人数
long N = long.Parse(Console.ReadLine());
long[] capacity = new long[5];
for (int i = 0; i < 5; i++) {
capacity[i] = long.Parse(Console.ReadLine());
}
long min = capacity.Min();
// Console.WriteLine(min);
long ans = (N + min - 1) / min + 4L;
Console.WriteLine(ans);
}
}
}
|
[["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199]]
| 8
| 136
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace abc119d {
class Program {
static void Main(string[] args) {
var N = Readlong();
var ABCDE = new long[5];
for (long i = 0; i < 5; i++) {
ABCDE[i] = Readlong();
}
var min = ABCDE.Min();
var ans = 5 + N / min;
if (N == min)
ans--;
Console.WriteLine(ans);
#if DEBUG
Console.ReadKey();
#endif
}
private static bool IsRange(long a, long from,
long to) => (from <= a && a <= to);
private static long Readlong() => long.Parse(Console.ReadLine());
private static List<long>
ReadlongList() => Console.ReadLine().Split().Select(long.Parse).ToList();
private static double ReadDouble() => double.Parse(Console.ReadLine());
private static List<double>
ReadDoubleList() => Console.ReadLine().Split().Select(double.Parse).ToList();
private static long ReadLong() => long.Parse(Console.ReadLine());
private static List<long>
ReadLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();
private static List<long> long2Digits(long a) =>
a.ToString().ToCharArray().Select(_ => long.Parse(_.ToString())).ToList();
private static long
BinarySearch<Type>(IReadOnlyList<Type> s,
Type target) // target 以下の最大要素のインデックスを返す
where Type : IComparable {
var lower = 0;
var upper = s.Count - 1;
while (upper - lower > 1) {
var mid = lower + (upper - lower) / 2;
if (s[mid].CompareTo(target) <= 0) {
lower = mid;
} else {
upper = mid;
}
}
return lower;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace abc119d {
class Program {
static void Main(string[] args) {
var N = Readlong();
var ABCDE = new long[5];
for (long i = 0; i < 5; i++) {
ABCDE[i] = Readlong();
}
var min = ABCDE.Min();
var ans = 5 + N / min;
if (N % min == 0) {
ans--;
}
Console.WriteLine(ans);
#if DEBUG
Console.ReadKey();
#endif
}
private static bool IsRange(long a, long from,
long to) => (from <= a && a <= to);
private static long Readlong() => long.Parse(Console.ReadLine());
private static List<long>
ReadlongList() => Console.ReadLine().Split().Select(long.Parse).ToList();
private static double ReadDouble() => double.Parse(Console.ReadLine());
private static List<double>
ReadDoubleList() => Console.ReadLine().Split().Select(double.Parse).ToList();
private static long ReadLong() => long.Parse(Console.ReadLine());
private static List<long>
ReadLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();
private static List<long> long2Digits(long a) =>
a.ToString().ToCharArray().Select(_ => long.Parse(_.ToString())).ToList();
private static long
BinarySearch<Type>(IReadOnlyList<Type> s,
Type target) // target 以下の最大要素のインデックスを返す
where Type : IComparable {
var lower = 0;
var upper = s.Count - 1;
while (upper - lower > 1) {
var mid = lower + (upper - lower) / 2;
if (s[mid].CompareTo(target) <= 0) {
lower = mid;
} else {
upper = mid;
}
}
return lower;
}
}
}
|
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
| 8
| 437
| 6
|
using System;
using System.Linq;
public class App {
public static void Main(string[] args) {
long n = long.Parse(Console.ReadLine());
long[] a = new long[5];
a[0] = long.Parse(Console.ReadLine());
a[1] = long.Parse(Console.ReadLine());
a[2] = long.Parse(Console.ReadLine());
a[3] = long.Parse(Console.ReadLine());
a[4] = long.Parse(Console.ReadLine());
Console.WriteLine(n / a.Min() + 5);
}
}
|
using System;
using System.Linq;
public class App {
public static void Main(string[] args) {
long n = long.Parse(Console.ReadLine()) - 1;
long[] a = new long[5];
a[0] = long.Parse(Console.ReadLine());
a[1] = long.Parse(Console.ReadLine());
a[2] = long.Parse(Console.ReadLine());
a[3] = long.Parse(Console.ReadLine());
a[4] = long.Parse(Console.ReadLine());
Console.WriteLine(n / a.Min() + 5);
}
}
|
[["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 33], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203]]
| 8
| 145
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
class Cmondai {
static void Main() {
var line = new List<long>();
long N = 0;
for (int i = 0; i < 6; ++i) {
var a = Int64.Parse(Console.ReadLine());
if (i == 0)
N = a;
else
line.Add(a);
}
var min = line.Min();
var ans = 0L;
if (min < N)
ans = ((N + 1) / min) + 4;
else
ans = 5;
Console.WriteLine(ans);
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
class Cmondai {
static void Main() {
var line = new List<long>();
long N = 0;
for (int i = 0; i < 6; ++i) {
var a = Int64.Parse(Console.ReadLine());
if (i == 0)
N = a;
else
line.Add(a);
}
var min = line.Min();
var ans = 0L;
if (min < N)
ans = ((N + min - 1) / min) + 4;
else
ans = 5;
Console.WriteLine(ans);
}
}
|
[["+", 0, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["+", 31, 23, 0, 16, 31, 23, 0, 16, 17, 33]]
| 8
| 136
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
class Cmondai {
static void Main() {
var line = new List<decimal>();
decimal N = 0;
for (int i = 0; i < 6; ++i) {
var a = decimal.Parse(Console.ReadLine());
if (i == 0)
N = a;
else
line.Add(a);
}
var min = line.Min();
decimal ans = 0;
if (min < N)
ans = Math.Ceiling(N / min) + 4;
else
ans = 0;
Console.WriteLine(ans);
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
class Cmondai {
static void Main() {
var line = new List<decimal>();
decimal N = 0;
for (int i = 0; i < 6; ++i) {
var a = decimal.Parse(Console.ReadLine());
if (i == 0)
N = a;
else
line.Add(a);
}
var min = line.Min();
decimal ans = 0;
if (min < N)
ans = Math.Ceiling(N / min) + 4;
else
ans = 5;
Console.WriteLine(ans);
}
}
|
[["-", 8, 196, 0, 57, 75, 1, 0, 11, 12, 203], ["+", 8, 196, 0, 57, 75, 1, 0, 11, 12, 203]]
| 8
| 135
| 2
|
using System;
using System.Linq;
namespace ABC123_C {
class Program {
static void Main(string[] args) {
var n = long.Parse(Console.ReadLine());
var p = new long[5];
p[0] = long.Parse(Console.ReadLine());
p[1] = long.Parse(Console.ReadLine());
p[2] = long.Parse(Console.ReadLine());
p[3] = long.Parse(Console.ReadLine());
p[4] = long.Parse(Console.ReadLine());
long min = p.Min();
long sum = 4;
if (min < n) {
sum += n % min == 0 ? n / min : 1 + n / min;
}
Console.WriteLine(sum);
}
}
}
|
using System;
using System.Linq;
namespace ABC123_C {
class Program {
static void Main(string[] args) {
var n = long.Parse(Console.ReadLine());
var p = new long[5];
p[0] = long.Parse(Console.ReadLine());
p[1] = long.Parse(Console.ReadLine());
p[2] = long.Parse(Console.ReadLine());
p[3] = long.Parse(Console.ReadLine());
p[4] = long.Parse(Console.ReadLine());
long min = p.Min();
long sum = 4;
if (min < n) {
sum += n % min == 0 ? n / min : 1 + n / min;
} else {
sum++;
}
Console.WriteLine(sum);
}
}
}
|
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 57, 75, 196, 0, 1, 0, 223, 0, 22], ["+", 0, 57, 75, 196, 0, 1, 0, 223, 0, 29], ["+", 8, 196, 0, 57, 75, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 46]]
| 8
| 177
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCorder {
class Program {
static void Main(string[] args) {
// var input = Console.ReadLine().Split(' ').Select(x =>
// long.Parse(x)).ToArray();
decimal n = decimal.Parse(Console.ReadLine());
var ls = new List<decimal>();
ls.Add(decimal.Parse(Console.ReadLine()));
ls.Add(decimal.Parse(Console.ReadLine()));
ls.Add(decimal.Parse(Console.ReadLine()));
ls.Add(decimal.Parse(Console.ReadLine()));
ls.Add(decimal.Parse(Console.ReadLine()));
ls.Sort();
var min = ls[0];
var result = Math.Floor(n / min) + 5;
Console.WriteLine(result.ToString());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCorder {
class Program {
static void Main(string[] args) {
// var input = Console.ReadLine().Split(' ').Select(x =>
// long.Parse(x)).ToArray();
decimal n = decimal.Parse(Console.ReadLine());
var ls = new List<decimal>();
ls.Add(decimal.Parse(Console.ReadLine()));
ls.Add(decimal.Parse(Console.ReadLine()));
ls.Add(decimal.Parse(Console.ReadLine()));
ls.Add(decimal.Parse(Console.ReadLine()));
ls.Add(decimal.Parse(Console.ReadLine()));
ls.Sort();
var min = ls[0];
var result = Math.Ceiling(n / min) + 4;
Console.WriteLine(result.ToString());
}
}
}
|
[["-", 0, 212, 0, 16, 31, 213, 63, 214, 141, 22], ["+", 0, 212, 0, 16, 31, 213, 63, 214, 141, 22], ["-", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203]]
| 8
| 192
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static int Main() {
long ans = 0;
long[] nin = new long[5];
long n = long.Parse(Console.ReadLine());
for (int i = 0; i < 5; i++) {
nin[i] = long.Parse(Console.ReadLine());
}
// ここまで入力
if (nin.Min() >= n) {
ans = 5;
} else {
ans = (n + 1) / nin.Min() + 4;
}
Console.WriteLine("{0}", ans);
return 0;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static int Main() {
long ans = 0;
long[] nin = new long[5];
long n = long.Parse(Console.ReadLine());
for (int i = 0; i < 5; i++) {
nin[i] = long.Parse(Console.ReadLine());
}
// ここまで入力
if (nin.Min() >= n) {
ans = 5;
} else {
ans = (n + nin.Min() - 1) / nin.Min() + 4;
}
Console.WriteLine("{0}", ans);
return 0;
}
}
|
[["+", 0, 16, 31, 16, 12, 213, 63, 214, 205, 22], ["+", 0, 16, 31, 16, 12, 213, 63, 214, 0, 131], ["+", 0, 16, 31, 16, 12, 213, 63, 214, 141, 22], ["+", 0, 16, 31, 16, 12, 213, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 213, 3, 4, 0, 25], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 33]]
| 8
| 138
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp {
class Program {
static int N = 0;
static void Main(string[] args) {
var N = long.Parse(Console.ReadLine());
var capacity = new long[5];
for (int i = 0; i < 5; i++) {
capacity[i] = int.Parse(Console.ReadLine());
}
var time = 5L;
time += (long)Math.Ceiling((double)N / capacity.Min()) - 1;
Console.WriteLine(time);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp {
class Program {
static int N = 0;
static void Main(string[] args) {
var N = long.Parse(Console.ReadLine());
var capacity = new long[5];
for (int i = 0; i < 5; i++) {
capacity[i] = long.Parse(Console.ReadLine());
}
var time = 5L;
time += (long)Math.Ceiling((double)N / capacity.Min()) - 1;
Console.WriteLine(time);
}
}
}
|
[["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199]]
| 8
| 130
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
public static partial class Program {
public static void Main() {
var n = CRL().ToInt();
var canMove = new long[5];
for (int i = 0; i < 5; i++) {
canMove[i] = CRL().ToInt();
}
var count = Math.Ceiling(1.0 * n / canMove.Min()) + 4;
CWL(count);
}
}
public static partial class Program {
//テンプレここから
private static long ToInt(this string str) => long.Parse(str);
private static long[] ToInt(this IEnumerable<string> strs) =>
strs.Select(x => x.ToInt()).ToArray();
public static long[] ArrayLongs(this string str,
char opr = ' ') => str.Split(opr).ToInt();
public static string CRL() => Console.ReadLine();
public static void CWL(object obj) => Console.WriteLine(obj);
public static long Diff(long a,
long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
public static long Sign(this long i) => Math.Sign(i);
public static bool IsEven(this long i) => i % 2 == 0;
public static bool IsEven(this int i) => i % 2 == 0;
public static long[] dx = new long[] { 0, -1, 0, 1 };
public static long[] dy = new long[] { -1, 0, 1, 0 };
public static long mod = 1000000007;
public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
public static long ToLong(this char c) => c.ToString().ToInt();
public static long[] Sort(this long[] array) {
var list = array.ToList();
list.Sort();
return list.ToArray();
}
public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
public static long LCM(long a, long b) => a * b / GCD(a, b);
//テンプレここまで
}
|
using System;
using System.Collections.Generic;
using System.Linq;
public static partial class Program {
public static void Main() {
var n = CRL().ToInt();
var canMove = new long[5];
for (int i = 0; i < 5; i++) {
canMove[i] = CRL().ToInt();
}
var count = (long)Math.Ceiling(1.0 * n / canMove.Min()) + 4;
CWL(count);
}
}
public static partial class Program {
//テンプレここから
private static long ToInt(this string str) => long.Parse(str);
private static long[] ToInt(this IEnumerable<string> strs) =>
strs.Select(x => x.ToInt()).ToArray();
public static long[] ArrayLongs(this string str,
char opr = ' ') => str.Split(opr).ToInt();
public static string CRL() => Console.ReadLine();
public static void CWL(object obj) => Console.WriteLine(obj);
public static long Diff(long a,
long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
public static long Sign(this long i) => Math.Sign(i);
public static bool IsEven(this long i) => i % 2 == 0;
public static bool IsEven(this int i) => i % 2 == 0;
public static long[] dx = new long[] { 0, -1, 0, 1 };
public static long[] dy = new long[] { -1, 0, 1, 0 };
public static long mod = 1000000007;
public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
public static long ToLong(this char c) => c.ToString().ToInt();
public static long[] Sort(this long[] array) {
var list = array.ToList();
list.Sort();
return list.ToArray();
}
public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
public static long LCM(long a, long b) => a * b / GCD(a, b);
//テンプレここまで
}
|
[["+", 0, 200, 0, 212, 0, 16, 31, 74, 0, 24], ["+", 0, 200, 0, 212, 0, 16, 31, 74, 39, 199], ["+", 0, 200, 0, 212, 0, 16, 31, 74, 0, 25]]
| 8
| 472
| 3
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace c {
class Program {
static void Main(string[] args) {
var n = long.Parse(Console.ReadLine());
var l = new List<long>();
for (int i = 0; i < 5; i++)
l.Add(int.Parse(Console.ReadLine()));
long b = l.Min();
long a = 4 + (n % b == 0 ? (n / b) : (n / b + 1));
Console.WriteLine("{0}", a);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace c {
class Program {
static void Main(string[] args) {
var n = long.Parse(Console.ReadLine());
var l = new List<long>();
for (int i = 0; i < 5; i++)
l.Add(long.Parse(Console.ReadLine()));
long b = l.Min();
long a = 4 + (n % b == 0 ? (n / b) : (n / b + 1));
Console.WriteLine("{0}", a);
}
}
}
|
[["-", 3, 4, 0, 28, 0, 213, 63, 214, 205, 199], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 205, 199]]
| 8
| 148
| 2
|
using System;
using System.Linq;
namespace AtC {
class Program {
static void Main(string[] args) {
double N = long.Parse(Console.ReadLine());
var count = new long[5];
for (int i = 0; i < count.Length; i++)
count[i] = int.Parse(Console.ReadLine());
long bottleNeck = count.Min();
Console.WriteLine((long)Math.Ceiling(N / bottleNeck) + 4);
}
}
}
|
using System;
using System.Linq;
namespace AtC {
class Program {
static void Main(string[] args) {
double N = long.Parse(Console.ReadLine());
var count = new long[5];
for (int i = 0; i < count.Length; i++)
count[i] = long.Parse(Console.ReadLine());
long bottleNeck = count.Min();
Console.WriteLine((long)Math.Ceiling(N / bottleNeck) + 4);
}
}
}
|
[["-", 8, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["+", 8, 1, 0, 11, 12, 213, 63, 214, 205, 199]]
| 8
| 110
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.