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.Linq; using System.Text; using System.Threading.Tasks; namespace practice1 { class Program { static void Main(string[] args) { int[] buff = MYCP.ReadNumbers(5); int a, b, c, x, y; a = buff[0]; b = buff[1]; c = buff[2]; x = buff[3]; y = buff[4]; c *= 2; int s, t; int min, yen, max; max = Math.Max(x, y); min = 2 * 5000 * 100000 + 100; for (int i = 0; i <= max; i++) { yen = c * i; s = x - i; t = y = i; s = Math.Max(0, s); t = Math.Max(0, t); yen += a * s; yen += b * t; if (min > yen) min = yen; } MYCP.PrintNumber(min); } } class MYCP { //標準出力の後改行する public static void Println(string str) { Console.WriteLine(str); } //標準出力の後改行しない public static void Print(string str) { Console.Write(str); } // int変数を標準出力する public static void PrintNumber(long number) { Console.WriteLine("" + number); } //あまり意味はない private static string MyScanf() { return Console.ReadLine(); } //文字列を配列化して返す public static string[] MyScanfSplit() { return MyScanf().Split(); } // double変数をソートする public static void MyDoubleSort(double[] boo) { if (boo.Length < 2) return; long i, count; double a; while (true) { count = 0; for (i = 0; i < boo.Length - 1; i++) { if (boo[i] > boo[i + 1]) { a = boo[i]; boo[i] = boo[i + 1]; boo[i + 1] = a; count++; } } if (count == 0) break; } } // int変数をソートする public static void MyIntSort(int[] boo) { if (boo.Length < 2) return; long i, count; int a; while (true) { count = 0; for (i = 0; i < boo.Length - 1; i++) { if (boo[i] > boo[i + 1]) { a = boo[i]; boo[i] = boo[i + 1]; boo[i + 1] = a; count++; } } if (count == 0) break; } } // int配列の和を返す。 public static int MyIntSum(int[] a) { int sum = 0; for (int i = 0; i < a.Length; i++) { sum += a[i]; } return sum; } // double配列の和を返す。 public static double MyDoubleSum(double[] a) { double sum = 0; for (int i = 0; i < a.Length; i++) { sum += a[i]; } return sum; } //指定された個数分int変数を読み取る public static int[] ReadNumbers(long number) { int[] a = new int[number]; string[] buff = MyScanfSplit(); for (long i = 0; i < number; i++) { a[i] = int.Parse(buff[i]); } return a; } // int配列の数字をすべて出力する public static void PrintNumbers(int[] a) { if (a.Length == 0) return; Console.Write(a[0]); for (int i = 1; i < a.Length; i++) { Console.Write(" "); Console.Write(a[i]); } Console.WriteLine(); } //渡された自然数が素数か判定する public static bool PrimeCheck(int number) { if (number < 2) return false; int a = (int)Math.Sqrt(number); for (int i = 2; i <= a; i++) { if (number % i == 0) return false; } return true; } //渡された自然数が累乗数か判定する。累乗数ならtrueを返す。 public static bool Bekizyousuu_Check(int number) { if (number == 1) return true; int i, copy; for (i = 2; i < number; i++) { copy = number; while (copy % i == 0) { copy /= i; } if (copy == 1) return true; } return false; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace practice1 { class Program { static void Main(string[] args) { int[] buff = MYCP.ReadNumbers(5); int a, b, c, x, y; a = buff[0]; b = buff[1]; c = buff[2]; x = buff[3]; y = buff[4]; c *= 2; int s, t; int min, yen, max; max = Math.Max(x, y); min = 2 * 5000 * 100000 + 100; for (int i = 0; i <= max; i++) { yen = c * i; s = x - i; t = y - i; s = Math.Max(0, s); t = Math.Max(0, t); yen += a * s; yen += b * t; if (min > yen) min = yen; } MYCP.PrintNumber(min); } } class MYCP { //標準出力の後改行する public static void Println(string str) { Console.WriteLine(str); } //標準出力の後改行しない public static void Print(string str) { Console.Write(str); } // int変数を標準出力する public static void PrintNumber(long number) { Console.WriteLine("" + number); } //あまり意味はない private static string MyScanf() { return Console.ReadLine(); } //文字列を配列化して返す public static string[] MyScanfSplit() { return MyScanf().Split(); } // double変数をソートする public static void MyDoubleSort(double[] boo) { if (boo.Length < 2) return; long i, count; double a; while (true) { count = 0; for (i = 0; i < boo.Length - 1; i++) { if (boo[i] > boo[i + 1]) { a = boo[i]; boo[i] = boo[i + 1]; boo[i + 1] = a; count++; } } if (count == 0) break; } } // int変数をソートする public static void MyIntSort(int[] boo) { if (boo.Length < 2) return; long i, count; int a; while (true) { count = 0; for (i = 0; i < boo.Length - 1; i++) { if (boo[i] > boo[i + 1]) { a = boo[i]; boo[i] = boo[i + 1]; boo[i + 1] = a; count++; } } if (count == 0) break; } } // int配列の和を返す。 public static int MyIntSum(int[] a) { int sum = 0; for (int i = 0; i < a.Length; i++) { sum += a[i]; } return sum; } // double配列の和を返す。 public static double MyDoubleSum(double[] a) { double sum = 0; for (int i = 0; i < a.Length; i++) { sum += a[i]; } return sum; } //指定された個数分int変数を読み取る public static int[] ReadNumbers(long number) { int[] a = new int[number]; string[] buff = MyScanfSplit(); for (long i = 0; i < number; i++) { a[i] = int.Parse(buff[i]); } return a; } // int配列の数字をすべて出力する public static void PrintNumbers(int[] a) { if (a.Length == 0) return; Console.Write(a[0]); for (int i = 1; i < a.Length; i++) { Console.Write(" "); Console.Write(a[i]); } Console.WriteLine(); } //渡された自然数が素数か判定する public static bool PrimeCheck(int number) { if (number < 2) return false; int a = (int)Math.Sqrt(number); for (int i = 2; i <= a; i++) { if (number % i == 0) return false; } return true; } //渡された自然数が累乗数か判定する。累乗数ならtrueを返す。 public static bool Bekizyousuu_Check(int number) { if (number == 1) return true; int i, copy; for (i = 2; i < number; i++) { copy = number; while (copy % i == 0) { copy /= i; } if (copy == 1) return true; } return false; } } }
[["-", 0, 1, 0, 11, 12, 11, 0, 202, 0, 32], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 17, 33]]
8
921
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { var sc = new Scanner(); int n = sc.NextInt(); long c = sc.NextLong(); long[] x = new long[n + 2]; int[] v = new int[n + 2]; for (int i = 1; i <= n; i++) { x[i] = sc.NextLong(); v[i] = sc.NextInt(); } x[n + 1] = c; long[,] sum = new long[2, n * 2]; long d = 0; for (int i = 1; i <= n; i++) { d += v[i] - (x[i] - x[i - 1]); sum[0, i] = Math.Max(sum[0, i - 1], d); } d = 0; for (int i = n; i >= 1; i--) { d += v[i] - (x[i + 1] - x[i]); sum[1, i] = Math.Max(sum[1, i + 1], d); } long max = 0; for (int i = 0; i <= n; i++) { long res = sum[0, i] + sum[1, i + 1] - x[i]; max = Math.Max(max, res); res = sum[0, i] + sum[1, i + 1] - c + x[i + 1]; max = Math.Max(max, res); } Console.WriteLine(max); } static long Gcd(long a, long b) { if (a < b) return Gcd(b, a); if (b == 0) return a; return Gcd(b, a % b); } } class Scanner { int index = -1; string[] buf; public Scanner() {} public int NextInt() { CheckNext(); return int.Parse(buf[index++]); } public long NextLong() { CheckNext(); return long.Parse(buf[index++]); } public double NextDouble() { CheckNext(); return double.Parse(buf[index++]); } public string NextString() { CheckNext(); return buf[index++]; } private void CheckNext() { if (index >= 0 && index < buf.Length) return; buf = Console.ReadLine().Split(' '); index = 0; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { var sc = new Scanner(); int n = sc.NextInt(); long c = sc.NextLong(); long[] x = new long[n + 2]; int[] v = new int[n + 2]; for (int i = 1; i <= n; i++) { x[i] = sc.NextLong(); v[i] = sc.NextInt(); } x[n + 1] = c; long[,] sum = new long[2, n * 2 + 10]; long d = 0; for (int i = 1; i <= n; i++) { d += v[i] - (x[i] - x[i - 1]); sum[0, i] = Math.Max(sum[0, i - 1], d); } d = 0; for (int i = n; i >= 1; i--) { d += v[i] - (x[i + 1] - x[i]); sum[1, i] = Math.Max(sum[1, i + 1], d); } long max = 0; for (int i = 0; i <= n; i++) { long res = sum[0, i] + sum[1, i + 1] - x[i]; max = Math.Max(max, res); res = sum[0, i] + sum[1, i + 1] - c + x[i + 1]; max = Math.Max(max, res); } Console.WriteLine(max); } static long Gcd(long a, long b) { if (a < b) return Gcd(b, a); if (b == 0) return a; return Gcd(b, a % b); } } class Scanner { int index = -1; string[] buf; public Scanner() {} public int NextInt() { CheckNext(); return int.Parse(buf[index++]); } public long NextLong() { CheckNext(); return long.Parse(buf[index++]); } public double NextDouble() { CheckNext(); return double.Parse(buf[index++]); } public string NextString() { CheckNext(); return buf[index++]; } private void CheckNext() { if (index >= 0 && index < buf.Length) return; buf = Console.ReadLine().Split(' '); index = 0; } }
[["+", 0, 227, 39, 224, 225, 226, 0, 16, 17, 72], ["+", 0, 227, 39, 224, 225, 226, 0, 16, 12, 203]]
8
580
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC096_C { 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 AB = int.Parse(input[2]); int needA = int.Parse(input[3]); //ピザの必要枚数 int needB = int.Parse(input[4]); int common = Math.Min(A, B); // AとBが両方存在しているとき int single = Math.Abs(A - B); //残りがAとBのどちらかのとき int moreNeed = needA > needB ? A : B; //要求数の多いほうを代入 int total = Math.Min((A + B) * common, AB * common * 2) + Math.Min(moreNeed * single, AB * single * 2); Console.WriteLine(total); // if (AB <= A / 2 && AB <= B / 2) //{ // totalMin = AB * Math.Max(needA, needB) * 2; //} // else if (AB <= (Math.Abs(A - B) / 2 + Math.Min(A, B))) //{ // int defNeed = Math.Abs(needA - needB); // if (needA < needB) // { // totalMin = B * defNeed + AB * needA * 2; // } // else if (needA > needB) // { // totalMin = A * defNeed + AB * needB * 2; // } // else // { // totalMin = AB * needA * 2; // } //} ////else if (A < AB / 2 || B < AB / 2) ////{ //// totalMin = A * needA + B * needB; ////} // else if (AB > (Math.Abs(A - B) / 2 + Math.Min(A, B))) //{ // totalMin = A * needA + B * needB; //} // else //{ // totalMin = A * needA + B * needB; //} // Console.WriteLine(totalMin); // return; // for (int a = 0; a <= needA; a++) //小文字のa,bはピザの枚数 //{ // for (int b = 0; b <= needB; b++) // { // int ab = Math.Max(needA - a, needB - b) * 2; // if (ab < 0) // //abは必ず2枚ずつでないとaとbの1枚ずつにカウントされない // { // ab = 0; // } // money = a * A + b * B + ab * AB; // if (a == 0 && b == 0) // { // totalMin = money; // } // else if (a == needA && b == needB) // { // Console.WriteLine(Math.Min(totalMin, money)); // return; // } // else // { // totalMin = Math.Min(totalMin, money); // } // } //} } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC096_C { 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 AB = int.Parse(input[2]); int needA = int.Parse(input[3]); //ピザの必要枚数 int needB = int.Parse(input[4]); int common = Math.Min(needA, needB); // AとBが両方存在しているとき int single = Math.Abs(needA - needB); //残りがAとBのどちらかのとき int moreNeed = needA > needB ? A : B; //要求数の多いほうを代入 int total = Math.Min((A + B) * common, AB * common * 2) + Math.Min(moreNeed * single, AB * single * 2); Console.WriteLine(total); // if (AB <= A / 2 && AB <= B / 2) //{ // totalMin = AB * Math.Max(needA, needB) * 2; //} // else if (AB <= (Math.Abs(A - B) / 2 + Math.Min(A, B))) //{ // int defNeed = Math.Abs(needA - needB); // if (needA < needB) // { // totalMin = B * defNeed + AB * needA * 2; // } // else if (needA > needB) // { // totalMin = A * defNeed + AB * needB * 2; // } // else // { // totalMin = AB * needA * 2; // } //} ////else if (A < AB / 2 || B < AB / 2) ////{ //// totalMin = A * needA + B * needB; ////} // else if (AB > (Math.Abs(A - B) / 2 + Math.Min(A, B))) //{ // totalMin = A * needA + B * needB; //} // else //{ // totalMin = A * needA + B * needB; //} // Console.WriteLine(totalMin); // return; // for (int a = 0; a <= needA; a++) //小文字のa,bはピザの枚数 //{ // for (int b = 0; b <= needB; b++) // { // int ab = Math.Max(needA - a, needB - b) * 2; // if (ab < 0) // //abは必ず2枚ずつでないとaとbの1枚ずつにカウントされない // { // ab = 0; // } // money = a * A + b * B + ab * AB; // if (a == 0 && b == 0) // { // totalMin = money; // } // else if (a == needA && b == needB) // { // Console.WriteLine(Math.Min(totalMin, money)); // return; // } // else // { // totalMin = Math.Min(totalMin, money); // } // } //} } } }
[["-", 0, 212, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 212, 0, 213, 3, 4, 0, 28, 0, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
8
273
8
using System; using System.Linq; using System.Diagnostics; using System.Collections.Generic; using static System.Math; class P { static void Main() { //反対に回る例もある // long[] nc = Console.ReadLine().Split().Select(long.Parse).ToArray(); // xメートル(時計)、vカロリー //時計回りで与えられる Sushi[] sushis = Enumerable.Repeat(0, (int)nc[0]) .Select( _ => new Sushi( Console.ReadLine().Split().Select(long.Parse).ToArray())) .ToArray(); //取れるカロリー long[] calDPClock = new long[sushis.Length]; long[] ClockMax = new long[sushis.Length]; calDPClock[0] = sushis[0].Cal - sushis[0].Dist; ClockMax[0] = Max(0, calDPClock[0] - sushis[0].Dist); for (long i = 1; i < calDPClock.Length; i++) { calDPClock[i] = calDPClock[i - 1] + sushis[i].Cal - (sushis[i].Dist - sushis[i - 1].Dist); ClockMax[i] = Max(ClockMax[i - 1], calDPClock[i] - sushis[i].Dist); } long[] calDPAntiClock = new long[sushis.Length]; long[] antiClockMax = new long[sushis.Length]; calDPAntiClock[calDPAntiClock.Length - 1] = sushis[sushis.Length - 1].Cal - (nc[1] - sushis[sushis.Length - 1].Dist); antiClockMax[calDPAntiClock.Length - 1] = Max(0, calDPAntiClock[sushis.Length - 1] - nc[1] - sushis[sushis.Length - 1].Dist); for (int i = calDPAntiClock.Length - 2; i >= 0; i--) { calDPAntiClock[i] = calDPAntiClock[i + 1] + sushis[i].Cal - ((nc[1] - sushis[i].Dist) - (nc[1] - sushis[i + 1].Dist)); antiClockMax[i] = Max(antiClockMax[i + 1], calDPAntiClock[i] - (nc[1] - sushis[i].Dist)); } long max = Max(0, Max(calDPClock.Last(), calDPAntiClock.First())); for (int i = 0; i < sushis.Length - 1; i++) { max = Max(max, calDPClock[i] + antiClockMax[i + 1]); } for (int i = sushis.Length - 1; i >= 1; i--) { max = Max(max, calDPAntiClock[i] + ClockMax[i - 1]); } Console.WriteLine(max); //引き返した時に取れる最大のカロリー } } struct Sushi { public long Dist; public long Cal; public Sushi(long dist, long cal) { Dist = dist; Cal = cal; } public Sushi(long[] a) : this(a[0], a[1]) {} }
using System; using System.Linq; using System.Diagnostics; using System.Collections.Generic; using static System.Math; class P { static void Main() { //反対に回る例もある // long[] nc = Console.ReadLine().Split().Select(long.Parse).ToArray(); // xメートル(時計)、vカロリー //時計回りで与えられる Sushi[] sushis = Enumerable.Repeat(0, (int)nc[0]) .Select( _ => new Sushi( Console.ReadLine().Split().Select(long.Parse).ToArray())) .ToArray(); //取れるカロリー long[] calDPClock = new long[sushis.Length]; long[] ClockMax = new long[sushis.Length]; calDPClock[0] = sushis[0].Cal - sushis[0].Dist; ClockMax[0] = Max(0, calDPClock[0] - sushis[0].Dist); for (long i = 1; i < calDPClock.Length; i++) { calDPClock[i] = calDPClock[i - 1] + sushis[i].Cal - (sushis[i].Dist - sushis[i - 1].Dist); ClockMax[i] = Max(ClockMax[i - 1], calDPClock[i] - sushis[i].Dist); } long[] calDPAntiClock = new long[sushis.Length]; long[] antiClockMax = new long[sushis.Length]; calDPAntiClock[calDPAntiClock.Length - 1] = sushis[sushis.Length - 1].Cal - (nc[1] - sushis[sushis.Length - 1].Dist); antiClockMax[calDPAntiClock.Length - 1] = Max(0, calDPAntiClock[sushis.Length - 1] - (nc[1] - sushis[sushis.Length - 1].Dist)); for (int i = calDPAntiClock.Length - 2; i >= 0; i--) { calDPAntiClock[i] = calDPAntiClock[i + 1] + sushis[i].Cal - ((nc[1] - sushis[i].Dist) - (nc[1] - sushis[i + 1].Dist)); antiClockMax[i] = Max(antiClockMax[i + 1], calDPAntiClock[i] - (nc[1] - sushis[i].Dist)); } long max = Max(0, Max(calDPClock.Last(), calDPAntiClock.First())); for (int i = 0; i < sushis.Length - 1; i++) { max = Max(max, calDPClock[i] + antiClockMax[i + 1]); } for (int i = sushis.Length - 1; i >= 1; i--) { max = Max(max, calDPAntiClock[i] + ClockMax[i - 1]); } Console.WriteLine(max); } } struct Sushi { public long Dist; public long Cal; public Sushi(long dist, long cal) { Dist = dist; Cal = cal; } public Sushi(long[] a) : this(a[0], a[1]) {} }
[["+", 3, 4, 0, 28, 0, 16, 12, 23, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 12, 23, 0, 25]]
8
642
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Atc_0042 { class Program { static void Main(string[] args) { var S = Console.ReadLine(); var A = int.Parse(S.Split(' ')[0]); var B = int.Parse(S.Split(' ')[1]); var C = int.Parse(S.Split(' ')[2]); if ((C - A) <= B && A <= C) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Atc_0042 { class Program { static void Main(string[] args) { var S = Console.ReadLine(); var A = int.Parse(S.Split(' ')[0]); var B = int.Parse(S.Split(' ')[1]); var C = int.Parse(S.Split(' ')[2]); if ((C - A) <= B && A <= C) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
152
4
using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { string[] input = ReadLine().Split(); int a = int.Parse(input[0]); int b = int.Parse(input[1]); int x = int.Parse(input[2]); if (a + b >= x) { WriteLine("YES"); } else { WriteLine("NO"); } } }
using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { string[] input = ReadLine().Split(); int a = int.Parse(input[0]); int b = int.Parse(input[1]); int x = int.Parse(input[2]); if (a + b >= x && a <= x) { WriteLine("YES"); } else { WriteLine("NO"); } } }
[["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 19], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 12, 22]]
8
115
4
using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Numerics; namespace FertiLib.Contest.A { static class Program { public static void Solve(Scanner cin) { var (a, b, x) = cin.ReadValue<int, int, int>(); YesNo(a <= x && x <= a + b); } public static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); var cin = new Scanner(); Solve(cin); Console.Out.Flush(); } public static void YESNO(bool condition) => Console.WriteLine(condition ? "YES" : "NO"); public static void YesNo(bool condition) => Console.WriteLine(condition ? "Yes" : "No"); public static void yesno(bool condition) => Console.WriteLine(condition ? "yes" : "no"); public static bool Chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) >= 0) return false; a = b; return true; } public static bool Chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) <= 0) return false; a = b; return true; } } static class Util { public static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x); } class Scanner { string[] s; int i; char[] separator = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string Read() => ReadString(); public string ReadString() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(separator, StringSplitOptions.RemoveEmptyEntries); if (s.Length == 0) return ReadString(); i = 0; return s[i++]; } public string[] ReadStringArray(int N) { string[] Array = new string[N]; for (int i = 0; i < N; i++) { Array[i] = ReadString(); } return Array; } public int ReadInt() { return int.Parse(ReadString()); } public int[] ReadIntArray(int N, int add = 0) { int[] Array = new int[N]; for (int i = 0; i < N; i++) { Array[i] = ReadInt() + add; } return Array; } public long ReadLong() { return long.Parse(ReadString()); } public long[] ReadLongArray(int N, long add = 0) { long[] Array = new long[N]; for (int i = 0; i < N; i++) { Array[i] = ReadLong() + add; } return Array; } public double ReadDouble() { return double.Parse(ReadString()); } public double[] ReadDoubleArray(int N, double add = 0) { double[] Array = new double[N]; for (int i = 0; i < N; i++) { Array[i] = ReadDouble() + add; } return Array; } public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(), typeof(T1)); public (T1, T2) ReadValue<T1, T2>() { var inputs = ReadStringArray(2); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); return (v1, v2); } public (T1, T2, T3) ReadValue<T1, T2, T3>() { var inputs = ReadStringArray(3); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); return (v1, v2, v3); } public (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>() { var inputs = ReadStringArray(4); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); return (v1, v2, v3, v4); } public (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>() { var inputs = ReadStringArray(5); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); return (v1, v2, v3, v4, v5); } public (T1, T2, T3, T4, T5, T6) ReadValue<T1, T2, T3, T4, T5, T6>() { var inputs = ReadStringArray(6); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); return (v1, v2, v3, v4, v5, v6); } public (T1, T2, T3, T4, T5, T6, T7) ReadValue<T1, T2, T3, T4, T5, T6, T7>() { var inputs = ReadStringArray(7); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7)); return (v1, v2, v3, v4, v5, v6, v7); } public T1[] ReadValueArray<T1>(int N) { var v1 = new T1[N]; for (int i = 0; i < N; i++) { v1[i] = ReadValue<T1>(); } return v1; } public (T1[], T2[]) ReadValueArray<T1, T2>(int N) { var (v1, v2) = (new T1[N], new T2[N]); for (int i = 0; i < N; i++) { var (t1, t2) = ReadValue<T1, T2>(); v1[i] = t1; v2[i] = t2; } return (v1, v2); } public (T1[], T2[], T3[]) ReadValueArray<T1, T2, T3>(int N) { var (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3) = ReadValue<T1, T2, T3>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; } return (v1, v2, v3); } public (T1[], T2[], T3[], T4[]) ReadValueArray<T1, T2, T3, T4>(int N) { var (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4) = ReadValue<T1, T2, T3, T4>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; } return (v1, v2, v3, v4); } public (T1[], T2[], T3[], T4[], T5[]) ReadValueArray<T1, T2, T3, T4, T5>(int N) { var (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5) = ReadValue<T1, T2, T3, T4, T5>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; } return (v1, v2, v3, v4, v5); } public (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray<T1, T2, T3, T4, T5, T6>(int N) { var (v1, v2, v3, v4, v5, v6) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6) = ReadValue<T1, T2, T3, T4, T5, T6>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; } return (v1, v2, v3, v4, v5, v6); } public (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray<T1, T2, T3, T4, T5, T6, T7>(int N) { var (v1, v2, v3, v4, v5, v6, v7) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N], new T7[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6, t7) = ReadValue<T1, T2, T3, T4, T5, T6, T7>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; v7[i] = t7; } return (v1, v2, v3, v4, v5, v6, v7); } } }
using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Numerics; namespace FertiLib.Contest.A { static class Program { public static void Solve(Scanner cin) { var (a, b, x) = cin.ReadValue<int, int, int>(); YESNO(a <= x && x <= a + b); } public static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); var cin = new Scanner(); Solve(cin); Console.Out.Flush(); } public static void YESNO(bool condition) => Console.WriteLine(condition ? "YES" : "NO"); public static void YesNo(bool condition) => Console.WriteLine(condition ? "Yes" : "No"); public static void yesno(bool condition) => Console.WriteLine(condition ? "yes" : "no"); public static bool Chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) >= 0) return false; a = b; return true; } public static bool Chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) <= 0) return false; a = b; return true; } } static class Util { public static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x); } class Scanner { string[] s; int i; char[] separator = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string Read() => ReadString(); public string ReadString() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(separator, StringSplitOptions.RemoveEmptyEntries); if (s.Length == 0) return ReadString(); i = 0; return s[i++]; } public string[] ReadStringArray(int N) { string[] Array = new string[N]; for (int i = 0; i < N; i++) { Array[i] = ReadString(); } return Array; } public int ReadInt() { return int.Parse(ReadString()); } public int[] ReadIntArray(int N, int add = 0) { int[] Array = new int[N]; for (int i = 0; i < N; i++) { Array[i] = ReadInt() + add; } return Array; } public long ReadLong() { return long.Parse(ReadString()); } public long[] ReadLongArray(int N, long add = 0) { long[] Array = new long[N]; for (int i = 0; i < N; i++) { Array[i] = ReadLong() + add; } return Array; } public double ReadDouble() { return double.Parse(ReadString()); } public double[] ReadDoubleArray(int N, double add = 0) { double[] Array = new double[N]; for (int i = 0; i < N; i++) { Array[i] = ReadDouble() + add; } return Array; } public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(), typeof(T1)); public (T1, T2) ReadValue<T1, T2>() { var inputs = ReadStringArray(2); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); return (v1, v2); } public (T1, T2, T3) ReadValue<T1, T2, T3>() { var inputs = ReadStringArray(3); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); return (v1, v2, v3); } public (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>() { var inputs = ReadStringArray(4); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); return (v1, v2, v3, v4); } public (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>() { var inputs = ReadStringArray(5); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); return (v1, v2, v3, v4, v5); } public (T1, T2, T3, T4, T5, T6) ReadValue<T1, T2, T3, T4, T5, T6>() { var inputs = ReadStringArray(6); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); return (v1, v2, v3, v4, v5, v6); } public (T1, T2, T3, T4, T5, T6, T7) ReadValue<T1, T2, T3, T4, T5, T6, T7>() { var inputs = ReadStringArray(7); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7)); return (v1, v2, v3, v4, v5, v6, v7); } public T1[] ReadValueArray<T1>(int N) { var v1 = new T1[N]; for (int i = 0; i < N; i++) { v1[i] = ReadValue<T1>(); } return v1; } public (T1[], T2[]) ReadValueArray<T1, T2>(int N) { var (v1, v2) = (new T1[N], new T2[N]); for (int i = 0; i < N; i++) { var (t1, t2) = ReadValue<T1, T2>(); v1[i] = t1; v2[i] = t2; } return (v1, v2); } public (T1[], T2[], T3[]) ReadValueArray<T1, T2, T3>(int N) { var (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3) = ReadValue<T1, T2, T3>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; } return (v1, v2, v3); } public (T1[], T2[], T3[], T4[]) ReadValueArray<T1, T2, T3, T4>(int N) { var (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4) = ReadValue<T1, T2, T3, T4>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; } return (v1, v2, v3, v4); } public (T1[], T2[], T3[], T4[], T5[]) ReadValueArray<T1, T2, T3, T4, T5>(int N) { var (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5) = ReadValue<T1, T2, T3, T4, T5>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; } return (v1, v2, v3, v4, v5); } public (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray<T1, T2, T3, T4, T5, T6>(int N) { var (v1, v2, v3, v4, v5, v6) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6) = ReadValue<T1, T2, T3, T4, T5, T6>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; } return (v1, v2, v3, v4, v5, v6); } public (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray<T1, T2, T3, T4, T5, T6, T7>(int N) { var (v1, v2, v3, v4, v5, v6, v7) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N], new T7[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6, t7) = ReadValue<T1, T2, T3, T4, T5, T6, T7>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; v7[i] = t7; } return (v1, v2, v3, v4, v5, v6, v7); } } }
[["-", 0, 195, 8, 196, 0, 1, 0, 213, 63, 22], ["+", 0, 195, 8, 196, 0, 1, 0, 213, 63, 22]]
8
2,653
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC094A_CatsandDog { class Program { static void Main(string[] args) { string[] word = Console.ReadLine().Split(' '); int a = int.Parse(word[0]); int b = int.Parse(word[1]); int x = int.Parse(word[2]); if (a + b >= x) Console.WriteLine("YES"); else Console.WriteLine("NO"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC094A_CatsandDog { class Program { static void Main(string[] args) { string[] word = Console.ReadLine().Split(' '); int a = int.Parse(word[0]); int b = int.Parse(word[1]); int x = int.Parse(word[2]); if (a + b >= x && a <= x) Console.WriteLine("YES"); else Console.WriteLine("NO"); } } }
[["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 19], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 12, 22]]
8
130
4
using System; namespace a { class Program { static void Main(string[] args) { var _ = Console.ReadLine().Split(); var a = int.Parse(_[0]); var b = int.Parse(_[1]); var x = int.Parse(_[2]); if (a > x) { Console.WriteLine("No"); } else { x -= a; if (x <= b) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } } }
using System; namespace a { class Program { static void Main(string[] args) { var _ = Console.ReadLine().Split(); var a = int.Parse(_[0]); var b = int.Parse(_[1]); var x = int.Parse(_[2]); if (a > x) { Console.WriteLine("NO"); } else { x -= a; if (x <= b) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
127
6
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.nextInt(); var b = cin.nextInt(); var x = cin.nextInt(); Console.WriteLine((a <= x && x <= b) ? "YES" : "NO"); } } 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.nextInt(); var b = cin.nextInt(); var x = cin.nextInt(); Console.WriteLine((a <= x && x <= a + b) ? "YES" : "NO"); } } 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(); } }
[["+", 15, 23, 0, 16, 12, 16, 12, 16, 31, 22], ["+", 15, 23, 0, 16, 12, 16, 12, 16, 17, 72]]
8
589
2
using System; using System.Diagnostics; using System.IO; using System.Text; using System.Linq; using System.Collections.Generic; using System.Text.RegularExpressions; class Program { const string Yes = "Yes"; const string No = "No"; const long Mod = 1000000007; static void Main(string[] args) { #if DEBUG MyDebugger.Test(process, "../TextFile1.txt"); #else object ret = process(new StreamReader(Console.OpenStandardInput())); Console.WriteLine(ret); #endif } static object process(TextReader input) { var spl = input.ReadLine().Split(' '); var a = int.Parse(spl[0]); var b = int.Parse(spl[1]); var x = int.Parse(spl[2]); return a <= x && x <= a + b ? Yes : No; } static int[] ToIntArray(string strs, int n) { var ret = new int[n]; var spl = strs.Split(' '); for (int i = 0; i < n; i++) ret[i] = int.Parse(spl[i]); return ret; } }
using System; using System.Diagnostics; using System.IO; using System.Text; using System.Linq; using System.Collections.Generic; using System.Text.RegularExpressions; class Program { const string Yes = "Yes"; const string No = "No"; const long Mod = 1000000007; static void Main(string[] args) { #if DEBUG MyDebugger.Test(process, "../TextFile1.txt"); #else object ret = process(new StreamReader(Console.OpenStandardInput())); Console.WriteLine(ret); #endif } static object process(TextReader input) { var spl = input.ReadLine().Split(' '); var a = int.Parse(spl[0]); var b = int.Parse(spl[1]); var x = int.Parse(spl[2]); return a <= x && x <= a + b ? "YES" : "NO"; } static int[] ToIntArray(string strs, int n) { var ret = new int[n]; var spl = strs.Split(' '); for (int i = 0; i < n; i++) ret[i] = int.Parse(spl[i]); return ret; } }
[["-", 0, 195, 8, 196, 0, 37, 0, 41, 64, 22], ["+", 8, 196, 0, 37, 0, 41, 64, 5, 0, 62], ["+", 8, 196, 0, 37, 0, 41, 64, 5, 0, 222], ["-", 0, 195, 8, 196, 0, 37, 0, 41, 75, 22], ["+", 8, 196, 0, 37, 0, 41, 75, 5, 0, 62], ["+", 8, 196, 0, 37, 0, 41, 75, 5, 0, 222]]
8
261
8
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(); WriteLine(tmp[0] <= tmp[2] && tmp[0] + tmp[1] <= tmp[2] ? "YES" : "NO"); } } }
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(); WriteLine(tmp[0] <= tmp[2] && tmp[0] + tmp[1] >= tmp[2] ? "YES" : "NO"); } } }
[["-", 0, 28, 0, 41, 15, 16, 12, 16, 17, 19], ["+", 0, 28, 0, 41, 15, 16, 12, 16, 17, 20]]
8
96
2
using System; using System.Collections.Generic; using System.IO; using System.Linq; using static Libraries.Input; namespace Libraries { static class Input { private static Func<string, T[]> Cast<T>() => _ => _.Split(' ').Select(Convert<T>()).ToArray(); private static Func<string, T> Convert<T>() { Type t = typeof(T); if (t == typeof(string)) return _ => (T)(object)_; if (t == typeof(int)) return _ => (T)(object) int.Parse(_); if (t == typeof(long)) return _ => (T)(object) long.Parse(_); if (t == typeof(double)) return _ => (T)(object) double.Parse(_); if (t == typeof(string[])) return _ => (T)(object)_.Split(' '); if (t == typeof(int[])) return _ => (T)(object)Cast<int>()(_); if (t == typeof(long[])) return _ => (T)(object)Cast<long>()(_); if (t == typeof(double[])) return _ => (T)(object)Cast<double>()(_); throw new NotSupportedException(t + "is not supported."); } private static T Convert<T>(string s) => Convert<T>()(s); private static string String() => Console.ReadLine(); private static string[] String(long rowNumber) => new bool [rowNumber].Select(_ => String()).ToArray(); public static void Cin<T>(out T a) => a = Convert<T>(String()); public static void Cin<T1, T2>(out T1 a1, out T2 a2) { var v = String().Split(' '); set(v[0], out a1); set(v[1], out a2); } public static void Cin<T1, T2, T3>(out T1 a1, out T2 a2, out T3 a3) { var v = String().Split(' '); set(v[0], out a1); set(v[1], out a2); set(v[2], out a3); } public static void Cin<T1, T2, T3, T4>(out T1 a1, out T2 a2, out T3 a3, out T4 a4) { var v = String().Split(' '); set(v[0], out a1); set(v[1], out a2); set(v[2], out a3); set(v[3], out a4); } public static void Cin<T1, T2, T3, T4, T5>(out T1 a1, out T2 a2, out T3 a3, out T4 a4, out T5 a5) { var v = String().Split(' '); set(v[0], out a1); set(v[1], out a2); set(v[2], out a3); set(v[3], out a4); set(v[4], out a5); } public static void Cin<T1, T2, T3, T4, T5, T6>(out T1 a1, out T2 a2, out T3 a3, out T4 a4, out T5 a5, out T6 a6) { var v = String().Split(' '); set(v[0], out a1); set(v[1], out a2); set(v[2], out a3); set(v[3], out a4); set(v[4], out a5); set(v[5], out a6); } private static void set<T1>(string s, out T1 o1) => o1 = Convert<T1>(s); public static void Cin<T>(long n, out T[] l) => l = String(n).Select(Convert<T>()).ToArray(); public static void Cin<T1, T2>(long n, out T1[] l1, out T2[] l2) { l1 = new T1[n]; l2 = new T2[n]; for (int i = 0; i < n; i++) Cin(out l1[i], out l2[i]); } public static void Cin<T1, T2, T3>(long n, out T1[] l1, out T2[] l2, out T3[] l3) { l1 = new T1[n]; l2 = new T2[n]; l3 = new T3[n]; for (int i = 0; i < n; i++) Cin(out l1[i], out l2[i], out l3[i]); } public static void Cin<T1, T2, T3, T4>(long n, out T1[] l1, out T2[] l2, out T3[] l3, out T4[] l4) { l1 = new T1[n]; l2 = new T2[n]; l3 = new T3[n]; l4 = new T4[n]; for (int i = 0; i < n; i++) Cin(out l1[i], out l2[i], out l3[i], out l4[i]); } public static void Cin<T>(out T[] a) => a = Convert<T[]>(String()); public static void Cin<T>(long h, out T[][] map) => map = String(h).Select(Convert<T[]>()).ToArray(); } class Program { public static void Main(string[] args) { StreamWriter streamWriter = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(streamWriter); new Solver().Solve(); Console.Out.Flush(); } public static void Debug() { new Solver().Solve(); } } class Solver { public void Solve() { long A; long B; long X; Cin(out A, out B, out X); Console.WriteLine(X < A || A + B > X ? "NO" : "YES"); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using static Libraries.Input; namespace Libraries { static class Input { private static Func<string, T[]> Cast<T>() => _ => _.Split(' ').Select(Convert<T>()).ToArray(); private static Func<string, T> Convert<T>() { Type t = typeof(T); if (t == typeof(string)) return _ => (T)(object)_; if (t == typeof(int)) return _ => (T)(object) int.Parse(_); if (t == typeof(long)) return _ => (T)(object) long.Parse(_); if (t == typeof(double)) return _ => (T)(object) double.Parse(_); if (t == typeof(string[])) return _ => (T)(object)_.Split(' '); if (t == typeof(int[])) return _ => (T)(object)Cast<int>()(_); if (t == typeof(long[])) return _ => (T)(object)Cast<long>()(_); if (t == typeof(double[])) return _ => (T)(object)Cast<double>()(_); throw new NotSupportedException(t + "is not supported."); } private static T Convert<T>(string s) => Convert<T>()(s); private static string String() => Console.ReadLine(); private static string[] String(long rowNumber) => new bool [rowNumber].Select(_ => String()).ToArray(); public static void Cin<T>(out T a) => a = Convert<T>(String()); public static void Cin<T1, T2>(out T1 a1, out T2 a2) { var v = String().Split(' '); set(v[0], out a1); set(v[1], out a2); } public static void Cin<T1, T2, T3>(out T1 a1, out T2 a2, out T3 a3) { var v = String().Split(' '); set(v[0], out a1); set(v[1], out a2); set(v[2], out a3); } public static void Cin<T1, T2, T3, T4>(out T1 a1, out T2 a2, out T3 a3, out T4 a4) { var v = String().Split(' '); set(v[0], out a1); set(v[1], out a2); set(v[2], out a3); set(v[3], out a4); } public static void Cin<T1, T2, T3, T4, T5>(out T1 a1, out T2 a2, out T3 a3, out T4 a4, out T5 a5) { var v = String().Split(' '); set(v[0], out a1); set(v[1], out a2); set(v[2], out a3); set(v[3], out a4); set(v[4], out a5); } public static void Cin<T1, T2, T3, T4, T5, T6>(out T1 a1, out T2 a2, out T3 a3, out T4 a4, out T5 a5, out T6 a6) { var v = String().Split(' '); set(v[0], out a1); set(v[1], out a2); set(v[2], out a3); set(v[3], out a4); set(v[4], out a5); set(v[5], out a6); } private static void set<T1>(string s, out T1 o1) => o1 = Convert<T1>(s); public static void Cin<T>(long n, out T[] l) => l = String(n).Select(Convert<T>()).ToArray(); public static void Cin<T1, T2>(long n, out T1[] l1, out T2[] l2) { l1 = new T1[n]; l2 = new T2[n]; for (int i = 0; i < n; i++) Cin(out l1[i], out l2[i]); } public static void Cin<T1, T2, T3>(long n, out T1[] l1, out T2[] l2, out T3[] l3) { l1 = new T1[n]; l2 = new T2[n]; l3 = new T3[n]; for (int i = 0; i < n; i++) Cin(out l1[i], out l2[i], out l3[i]); } public static void Cin<T1, T2, T3, T4>(long n, out T1[] l1, out T2[] l2, out T3[] l3, out T4[] l4) { l1 = new T1[n]; l2 = new T2[n]; l3 = new T3[n]; l4 = new T4[n]; for (int i = 0; i < n; i++) Cin(out l1[i], out l2[i], out l3[i], out l4[i]); } public static void Cin<T>(out T[] a) => a = Convert<T[]>(String()); public static void Cin<T>(long h, out T[][] map) => map = String(h).Select(Convert<T[]>()).ToArray(); } class Program { public static void Main(string[] args) { StreamWriter streamWriter = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(streamWriter); new Solver().Solve(); Console.Out.Flush(); } public static void Debug() { new Solver().Solve(); } } class Solver { public void Solve() { long A; long B; long X; Cin(out A, out B, out X); Console.WriteLine(X < A || A + B < X ? "NO" : "YES"); } } }
[["-", 0, 28, 0, 41, 15, 16, 12, 16, 17, 47], ["+", 0, 28, 0, 41, 15, 16, 12, 16, 17, 18]]
8
1,415
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 str = IO.GetIntList(); var ans = str[0] < str[2] && str[2] <= str[0] + str[1] ? "YES" : "NO"; Console.Write(ans); } } static class IO { static public string GetString() { return Console.ReadLine(); } static public int GetInt() { return int.Parse(Console.ReadLine()); } static public long GetLong() { return long.Parse(Console.ReadLine()); } static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); } static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); } static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); } static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); } static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } } } }
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 str = IO.GetIntList(); var ans = str[0] <= str[2] && str[2] <= str[0] + str[1] ? "YES" : "NO"; Console.Write(ans); } } static class IO { static public string GetString() { return Console.ReadLine(); } static public int GetInt() { return int.Parse(Console.ReadLine()); } static public long GetLong() { return long.Parse(Console.ReadLine()); } static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); } static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); } static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); } static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); } static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } } } }
[["-", 0, 212, 0, 41, 15, 16, 31, 16, 17, 18], ["+", 0, 212, 0, 41, 15, 16, 31, 16, 17, 19]]
8
344
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC94A { class Program { static void Main(string[] args) { int A, B, X; String[] str = Console.ReadLine().Split(' '); A = int.Parse(str[0]); B = int.Parse(str[1]); X = int.Parse(str[2]); if ((A + B) >= X && A <= X) Console.Write("Yes"); else Console.Write("No"); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC94A { class Program { static void Main(string[] args) { int A, B, X; String[] str = Console.ReadLine().Split(' '); A = int.Parse(str[0]); B = int.Parse(str[1]); X = int.Parse(str[2]); if ((A + B) >= X && A <= X) Console.Write("YES"); else Console.Write("NO"); Console.ReadKey(); } } }
[["-", 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; using System.Collections.Generic; namespace Algorithm { class Program { static void Main(string[] args) { var l = Console.ReadLine().Split().Select(int.Parse).ToArray(); int A = l[0], B = l[1], X = l[2]; if (A + B < X || X < A) Console.WriteLine("No"); else Console.WriteLine("Yes"); } } }
using System; using System.Linq; using System.Collections.Generic; namespace Algorithm { class Program { static void Main(string[] args) { var l = Console.ReadLine().Split().Select(int.Parse).ToArray(); int A = l[0], B = l[1], X = l[2]; if (A + B < X || X < A) Console.WriteLine("NO"); else Console.WriteLine("YES"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
111
4
using System; namespace abc94_a { class Program { static void Main(string[] args) { string[] array = Console.ReadLine().Split(' '); int cat = int.Parse(array[0]); int index = int.Parse(array[2]); int catdog = int.Parse(array[1]); if (cat > index) { Console.WriteLine("No"); } else if (cat + catdog >= index) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; namespace abc94_a { class Program { static void Main(string[] args) { string[] array = Console.ReadLine().Split(' '); int cat = int.Parse(array[0]); int index = int.Parse(array[2]); int catdog = int.Parse(array[1]); if (cat > index) { Console.WriteLine("NO"); } else if (cat + catdog >= index) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
128
6
using System; using System.Collections; using System.Collections.Generic; using System.Text; public class A { public static void Main() { string[] args = Console.ReadLine().Split(' '); int A = Int32.Parse(args[0]); int B = Int32.Parse(args[1]); int X = Int32.Parse(args[2]); Console.WriteLine(((A <= X) && (X <= A + B)) ? "Yes" : "No"); } }
using System; using System.Collections; using System.Collections.Generic; using System.Text; public class A { public static void Main() { string[] args = Console.ReadLine().Split(' '); int A = Int32.Parse(args[0]); int B = Int32.Parse(args[1]); int X = Int32.Parse(args[2]); Console.WriteLine(((A <= X) && (X <= A + B)) ? "YES" : "NO"); } }
[["-", 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
119
4
using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; namespace AtCoder { class Practice { static void Main() => CustomMain(); static void Solve() { var a = ReadIntArray(); if (a[2] <= a[0] + a[1] && a[0] < a[2]) { WriteAnswer("YES"); } else { WriteAnswer("NO"); } } static void CustomMain() { #if DEBUG // ファイルからテストケースを読み込む global::Common.ChangeStdIn(); // 時間計測 var stopwatch = new Stopwatch(); stopwatch.Start(); #endif // 出力高速化 var streamWriter = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(streamWriter); // 回答 Solve(); #if DEBUG stopwatch.Stop(); Console.WriteLine(stopwatch.Elapsed); #endif Console.Out.Flush(); } static string ReadString() => Console.ReadLine().Trim(); static int ReadInt() => int.Parse(ReadString()); static long ReadLong() => long.Parse(ReadString()); static float ReadFloat() => float.Parse(ReadString()); static double ReadDouble => double.Parse(ReadString()); static string[] ReadStringArray() => ReadString().Split(' '); static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse); static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse); static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse); static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse); static T TypeConversion<T>(string s) { if (typeof(T) == typeof(int)) { return (T)Convert.ChangeType(int.Parse(s), typeof(T)); } else if (typeof(T) == typeof(long)) { return (T)Convert.ChangeType(long.Parse(s), typeof(T)); } else if (typeof(T) == typeof(double)) { return (T)Convert.ChangeType(double.Parse(s), typeof(T)); } else { return (T)Convert.ChangeType(s, typeof(T)); } } static void ReadMulti<T, U>(out T a, out U b) { var str = ReadStringArray(); a = TypeConversion<T>(str[0]); b = TypeConversion<U>(str[1]); } static void ReadMulti<T, U, V>(out T a, out U b, out V c) { var str = ReadStringArray(); a = TypeConversion<T>(str[0]); b = TypeConversion<U>(str[1]); c = TypeConversion<V>(str[2]); } static void WriteAnswer(object ans) => Console.WriteLine(ans); static bool IsOdd(long num) { return (num & 1) == 1; } static bool IsEven(long num) { return (num & 1) == 0; } static long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; namespace AtCoder { class Practice { static void Main() => CustomMain(); static void Solve() { var a = ReadIntArray(); if (a[2] <= a[0] + a[1] && a[0] <= a[2]) { WriteAnswer("YES"); } else { WriteAnswer("NO"); } } static void CustomMain() { #if DEBUG // ファイルからテストケースを読み込む global::Common.ChangeStdIn(); // 時間計測 var stopwatch = new Stopwatch(); stopwatch.Start(); #endif // 出力高速化 var streamWriter = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(streamWriter); // 回答 Solve(); #if DEBUG stopwatch.Stop(); Console.WriteLine(stopwatch.Elapsed); #endif Console.Out.Flush(); } static string ReadString() => Console.ReadLine().Trim(); static int ReadInt() => int.Parse(ReadString()); static long ReadLong() => long.Parse(ReadString()); static float ReadFloat() => float.Parse(ReadString()); static double ReadDouble => double.Parse(ReadString()); static string[] ReadStringArray() => ReadString().Split(' '); static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse); static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse); static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse); static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse); static T TypeConversion<T>(string s) { if (typeof(T) == typeof(int)) { return (T)Convert.ChangeType(int.Parse(s), typeof(T)); } else if (typeof(T) == typeof(long)) { return (T)Convert.ChangeType(long.Parse(s), typeof(T)); } else if (typeof(T) == typeof(double)) { return (T)Convert.ChangeType(double.Parse(s), typeof(T)); } else { return (T)Convert.ChangeType(s, typeof(T)); } } static void ReadMulti<T, U>(out T a, out U b) { var str = ReadStringArray(); a = TypeConversion<T>(str[0]); b = TypeConversion<U>(str[1]); } static void ReadMulti<T, U, V>(out T a, out U b, out V c) { var str = ReadStringArray(); a = TypeConversion<T>(str[0]); b = TypeConversion<U>(str[1]); c = TypeConversion<V>(str[2]); } static void WriteAnswer(object ans) => Console.WriteLine(ans); static bool IsOdd(long num) { return (num & 1) == 1; } static bool IsEven(long num) { return (num & 1) == 0; } static long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; } } }
[["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 19]]
8
748
2
using System; using System.Linq; namespace A.Cats_and_Dogs { class Program { static void Main(string[] args) { var ABX = Console.ReadLine().Split().Select(int.Parse).ToArray(); var A = ABX[0]; var B = ABX[1]; var X = ABX[2]; bool flg1 = X > A; bool flg2 = X <= A + B; Console.WriteLine(flg1 && flg2 ? "YES" : "NO"); } } }
using System; using System.Linq; namespace A.Cats_and_Dogs { class Program { static void Main(string[] args) { var ABX = Console.ReadLine().Split().Select(int.Parse).ToArray(); var A = ABX[0]; var B = ABX[1]; var X = ABX[2]; bool flg1 = X >= A; bool flg2 = X <= A + B; Console.WriteLine(flg1 && flg2 ? "YES" : "NO"); } } }
[["-", 0, 198, 0, 200, 0, 212, 0, 16, 17, 47], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 20]]
8
110
2
using System; using System.Collections; using System.Collections.Generic; using System.Linq; public class Test { public static void Main() { int[] n = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); if (n[0] > n[2]) Console.WriteLine("No"); else if (n[0] + n[1] < n[2]) Console.WriteLine("NO"); else Console.WriteLine("YES"); } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; public class Test { public static void Main() { int[] n = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); if (n[0] > n[2]) Console.WriteLine("NO"); else if (n[0] + n[1] < n[2]) Console.WriteLine("NO"); else Console.WriteLine("YES"); } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
125
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Atcoder { class Atcoderrrrrrr { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int A = int.Parse(input[0]); int B = int.Parse(input[1]); int X = int.Parse(input[2]); if (A < X) { if ((A + B) > X) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } else { Console.WriteLine("NO"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Atcoder { class Atcoderrrrrrr { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int A = int.Parse(input[0]); int B = int.Parse(input[1]); int X = int.Parse(input[2]); if (A <= X) { if ((A + B) >= X) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } else { Console.WriteLine("NO"); } } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19], ["-", 0, 57, 64, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 57, 64, 196, 0, 57, 15, 16, 17, 20]]
8
156
4
using System; namespace ABC094_A_Cats_and_Dogs { internal class Program { public static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int a = int.Parse(input[0]); int b = int.Parse(input[1]); int x = int.Parse(input[2]); if (x - a <= b) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; namespace ABC094_A_Cats_and_Dogs { internal class Program { public static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int a = int.Parse(input[0]); int b = int.Parse(input[1]); int x = int.Parse(input[2]); if (x - a <= b && a <= x) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } }
[["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 19], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 12, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
112
8
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Practice { class Program { private static int ReadAndParseInt() { return int.Parse(Console.ReadLine()); } private static int[] ReadAndParseIntArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); } private static long ReadAndParseLong() { return long.Parse(Console.ReadLine()); } private static long[] ReadAndParseLongArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse); } static void Main(string[] args) { SolveA(args); // SolveB(args); // SolveC(args); // SolveD(args); } static void SolveA(string[] args) { int[] abx = ReadAndParseIntArr(); int a = abx[0]; int b = abx[1]; int x = abx[2]; x -= a; if (0 <= x && x <= b) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Practice { class Program { private static int ReadAndParseInt() { return int.Parse(Console.ReadLine()); } private static int[] ReadAndParseIntArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); } private static long ReadAndParseLong() { return long.Parse(Console.ReadLine()); } private static long[] ReadAndParseLongArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse); } static void Main(string[] args) { SolveA(args); // SolveB(args); // SolveC(args); // SolveD(args); } static void SolveA(string[] args) { int[] abx = ReadAndParseIntArr(); int a = abx[0]; int b = abx[1]; int x = abx[2]; x -= a; if (0 <= x && x <= b) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
234
4
using System; using System.Text; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; using static System.Math; namespace atPra { class Class1 { static void Main() { string[] str = Console.ReadLine().Split(' '); int A = int.Parse(str[0]); int B = int.Parse(str[1]); int X = int.Parse(str[2]); bool possible = true; if (A + B < X) possible = false; if (A > X) possible = false; if (possible == false) Console.WriteLine("No"); if (possible == true) Console.WriteLine("Yes"); } } }
using System; using System.Text; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; using static System.Math; namespace atPra { class Class1 { static void Main() { string[] str = Console.ReadLine().Split(' '); int A = int.Parse(str[0]); int B = int.Parse(str[1]); int X = int.Parse(str[2]); bool possible = true; if (A + B < X) possible = false; if (A > X) possible = false; if (possible == false) Console.WriteLine("NO"); if (possible == true) Console.WriteLine("YES"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
166
4
using System; namespace atcoder_BegginerContest94_Question1 { class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int a = Int32.Parse(input[0]); int b = Int32.Parse(input[1]); int x = Int32.Parse(input[2]); if (a < x) { if (a + b > x) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } else { Console.WriteLine("NO"); } } } }
using System; namespace atcoder_BegginerContest94_Question1 { class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); int a = Int32.Parse(input[0]); int b = Int32.Parse(input[1]); int x = Int32.Parse(input[2]); if (a <= x) { if (a + b >= x) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } else { Console.WriteLine("NO"); } } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19], ["-", 0, 57, 64, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 57, 64, 196, 0, 57, 15, 16, 17, 20]]
8
130
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC094A { class Program { static void Main(string[] args) { var line1 = Console.ReadLine().Split().Select(int.Parse).ToArray(); int A = line1[0]; int B = line1[1]; int X = line1[2]; if (X > A && X <= A + B) { Console.WriteLine("YES"); } else Console.WriteLine("NO"); Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC094A { class Program { static void Main(string[] args) { var line1 = Console.ReadLine().Split().Select(int.Parse).ToArray(); int A = line1[0]; int B = line1[1]; int X = line1[2]; if (X >= A && X <= A + B) { Console.WriteLine("YES"); } else Console.WriteLine("NO"); Console.ReadLine(); } } }
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 20]]
8
133
2
using System; class Program { static void Main() { int[] a = new int[3]; String[] input = Console.ReadLine().Split(' '); a[0] = Int32.Parse(input[0]); a[1] = Int32.Parse(input[1]); a[2] = Int32.Parse(input[2]); if (a[0] <= a[2] & a[0] + a[1] >= a[2]) { Console.Write("Yes"); } else { Console.Write("No"); } } }
using System; class Program { static void Main() { int[] a = new int[3]; String[] input = Console.ReadLine().Split(' '); a[0] = Int32.Parse(input[0]); a[1] = Int32.Parse(input[1]); a[2] = Int32.Parse(input[2]); if (a[0] <= a[2] & a[0] + a[1] >= a[2]) { Console.Write("YES"); } else { Console.Write("NO"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
138
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ProgrammingContest { class Writer : IDisposable { private System.IO.TextWriter writer; private StringBuilder sb; private bool isReactive; public Writer(string path) : this(new System.IO.StreamWriter(path)) {} public Writer(bool isReactive) : this(null, isReactive) {} public Writer(System.IO.TextWriter writer = null, bool isReactive = false) { this.writer = (writer ?? Console.Out); this.isReactive = isReactive; if (!this.isReactive) { this.sb = new StringBuilder(); } } public void Dispose() { if (!this.isReactive) { this.writer.Write(sb.ToString()); } if (!this.writer.Equals(Console.Out)) { this.writer.Dispose(); } } public void Write(object val) { if (this.isReactive) { this.writer.Write(val.ToString()); this.writer.Flush(); } else { this.sb.Append(val.ToString()); } } public void Write(string format, params object[] vals) { if (this.isReactive) { this.writer.Write(format, vals); this.writer.Flush(); } else { this.sb.AppendFormat(format, vals); } } public void WriteLine(object val = null) { this.Write((val ?? string.Empty).ToString() + System.Environment.NewLine); } public void WriteLine(int val) { this.WriteLine(val.ToString()); } public void WriteLine(long val) { this.WriteLine(val.ToString()); } public void WriteLine(string val) { this.WriteLine((object)val); } public void WriteLine(string format, params object[] vals) { this.Write(format + System.Environment.NewLine, vals); } } class Scanner : IDisposable { private Queue<string> buffer; private char[] sep; private System.IO.TextReader reader; public Scanner(string path, char[] sep = null) : this(new System.IO.StreamReader(path), sep) {} public Scanner(System.IO.TextReader reader = null, char[] sep = null) { this.buffer = new Queue<string>(); this.sep = (sep ?? new char[] { ' ' }); this.reader = (reader ?? Console.In); } private void CheckBuffer() { if (this.buffer.Count == 0 && this.reader.Peek() != -1) { string str = string.Empty; for (; string.IsNullOrEmpty(str); str = this.reader.ReadLine()) ; str.Split(this.sep).ToList().ForEach(el => this.buffer.Enqueue(el)); } } public void Dispose() { if (!this.reader.Equals(Console.In)) { this.reader.Dispose(); } } public string Next { get { this.CheckBuffer(); return this.buffer.Dequeue(); } } public string[] GetStringArray(int N) { return Enumerable.Range(0, N).Select(e => this.Next).ToArray(); } public int NextInt { get { return int.Parse(this.Next); } } public int[] GetIntArray(int N) { return Enumerable.Range(0, N).Select(e => this.NextInt).ToArray(); } public double NextDouble { get { return double.Parse(this.Next); } } public double[] GetdoubleArray(int N) { return Enumerable.Range(0, N).Select(e => this.NextDouble).ToArray(); } public long NextLong { get { return long.Parse(this.Next); } } public long[] GetLongArray(int N) { return Enumerable.Range(0, N).Select(e => this.NextLong).ToArray(); } public bool IsEnd { get { this.CheckBuffer(); return this.buffer.Count == 0; } } } class MainClass : IDisposable { Scanner sc; Writer wr; const string backPath = ".."; char dirSep = System.IO.Path.DirectorySeparatorChar; string inFilePath = string.Empty; string outFilePath = string.Empty; public MainClass() { this.inFilePath = MainClass.backPath + this.dirSep + MainClass.backPath + this.dirSep + "in.txt"; this.outFilePath = MainClass.backPath + this.dirSep + MainClass.backPath + this.dirSep + "out.txt"; this.wr = new Writer(this.IsReactive); // this.wr = new Writer(this.outFilePath); #if DEBUG if (!this.IsReactive) { this.sc = new Scanner(this.inFilePath); } else { this.sc = new Scanner(); } #else this.sc = new Scanner(); #endif } static void Main(string[] args) { using (var mainClass = new MainClass()) { mainClass.Solve(); } } public void Dispose() { if (this.sc != null) { this.sc.Dispose(); this.sc = null; } if (this.wr != null) { this.wr.Dispose(); this.wr = null; } #if DEBUG Console.WriteLine("続行するには何かキーを押してください..."); Console.ReadKey(); #endif } void MakeTestCase() { var rand = new Random(); if (this.wr != null) { this.wr.Dispose(); } this.wr = new Writer(inFilePath); } void Solve() { int a = sc.NextInt; int b = sc.NextInt; int x = sc.NextInt; wr.WriteLine(x - a <= b ? "YES" : "NO"); } private bool IsReactive { get; } = false; // TODO: reactive check !! } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ProgrammingContest { class Writer : IDisposable { private System.IO.TextWriter writer; private StringBuilder sb; private bool isReactive; public Writer(string path) : this(new System.IO.StreamWriter(path)) {} public Writer(bool isReactive) : this(null, isReactive) {} public Writer(System.IO.TextWriter writer = null, bool isReactive = false) { this.writer = (writer ?? Console.Out); this.isReactive = isReactive; if (!this.isReactive) { this.sb = new StringBuilder(); } } public void Dispose() { if (!this.isReactive) { this.writer.Write(sb.ToString()); } if (!this.writer.Equals(Console.Out)) { this.writer.Dispose(); } } public void Write(object val) { if (this.isReactive) { this.writer.Write(val.ToString()); this.writer.Flush(); } else { this.sb.Append(val.ToString()); } } public void Write(string format, params object[] vals) { if (this.isReactive) { this.writer.Write(format, vals); this.writer.Flush(); } else { this.sb.AppendFormat(format, vals); } } public void WriteLine(object val = null) { this.Write((val ?? string.Empty).ToString() + System.Environment.NewLine); } public void WriteLine(int val) { this.WriteLine(val.ToString()); } public void WriteLine(long val) { this.WriteLine(val.ToString()); } public void WriteLine(string val) { this.WriteLine((object)val); } public void WriteLine(string format, params object[] vals) { this.Write(format + System.Environment.NewLine, vals); } } class Scanner : IDisposable { private Queue<string> buffer; private char[] sep; private System.IO.TextReader reader; public Scanner(string path, char[] sep = null) : this(new System.IO.StreamReader(path), sep) {} public Scanner(System.IO.TextReader reader = null, char[] sep = null) { this.buffer = new Queue<string>(); this.sep = (sep ?? new char[] { ' ' }); this.reader = (reader ?? Console.In); } private void CheckBuffer() { if (this.buffer.Count == 0 && this.reader.Peek() != -1) { string str = string.Empty; for (; string.IsNullOrEmpty(str); str = this.reader.ReadLine()) ; str.Split(this.sep).ToList().ForEach(el => this.buffer.Enqueue(el)); } } public void Dispose() { if (!this.reader.Equals(Console.In)) { this.reader.Dispose(); } } public string Next { get { this.CheckBuffer(); return this.buffer.Dequeue(); } } public string[] GetStringArray(int N) { return Enumerable.Range(0, N).Select(e => this.Next).ToArray(); } public int NextInt { get { return int.Parse(this.Next); } } public int[] GetIntArray(int N) { return Enumerable.Range(0, N).Select(e => this.NextInt).ToArray(); } public double NextDouble { get { return double.Parse(this.Next); } } public double[] GetdoubleArray(int N) { return Enumerable.Range(0, N).Select(e => this.NextDouble).ToArray(); } public long NextLong { get { return long.Parse(this.Next); } } public long[] GetLongArray(int N) { return Enumerable.Range(0, N).Select(e => this.NextLong).ToArray(); } public bool IsEnd { get { this.CheckBuffer(); return this.buffer.Count == 0; } } } class MainClass : IDisposable { Scanner sc; Writer wr; const string backPath = ".."; char dirSep = System.IO.Path.DirectorySeparatorChar; string inFilePath = string.Empty; string outFilePath = string.Empty; public MainClass() { this.inFilePath = MainClass.backPath + this.dirSep + MainClass.backPath + this.dirSep + "in.txt"; this.outFilePath = MainClass.backPath + this.dirSep + MainClass.backPath + this.dirSep + "out.txt"; this.wr = new Writer(this.IsReactive); // this.wr = new Writer(this.outFilePath); #if DEBUG if (!this.IsReactive) { this.sc = new Scanner(this.inFilePath); } else { this.sc = new Scanner(); } #else this.sc = new Scanner(); #endif } static void Main(string[] args) { using (var mainClass = new MainClass()) { mainClass.Solve(); } } public void Dispose() { if (this.sc != null) { this.sc.Dispose(); this.sc = null; } if (this.wr != null) { this.wr.Dispose(); this.wr = null; } #if DEBUG Console.WriteLine("続行するには何かキーを押してください..."); Console.ReadKey(); #endif } void MakeTestCase() { var rand = new Random(); if (this.wr != null) { this.wr.Dispose(); } this.wr = new Writer(inFilePath); } void Solve() { int a = sc.NextInt; int b = sc.NextInt; int x = sc.NextInt; wr.WriteLine(x - a >= 0 && x - a <= b ? "YES" : "NO"); } private bool IsReactive { get; } = false; // TODO: reactive check !! } }
[["+", 0, 28, 0, 41, 15, 16, 31, 16, 17, 20], ["+", 0, 28, 0, 41, 15, 16, 31, 16, 12, 203], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 98], ["+", 0, 41, 15, 16, 12, 16, 31, 16, 31, 22], ["+", 0, 41, 15, 16, 12, 16, 31, 16, 17, 33], ["+", 0, 41, 15, 16, 12, 16, 31, 16, 12, 22]]
8
1,259
6
using System; using System.Collections.Generic; using System.Linq; using static Atcoder; using System.Threading.Tasks; using System.ComponentModel; public class Hello { public static void Main() { int[] n = SpRead(' ').Select(a => int.Parse(a)).ToArray(); if (n[0] < n[2] && (n[0] + n[1]) >= n[2]) Console.WriteLine("YES"); else Console.WriteLine("NO"); } } public class Atcoder { static void Swap<T>(ref T a, ref T b) { var t = a; a = b; b = t; } public static int LCM(int a, int b) { int c = a * b; if (a < b) Swap(ref a, ref b); int d = a % b; while (d != 0) { a = b; b = d; d = a % b; } return c / b; } public static string strReverce(string s) { return new string(s.Reverse().ToArray()); } public static int Cin() { return int.Parse(Console.ReadLine()); } public static bool IsPrime(int n) { if (n < 2) return false; if (n == 2) return true; if (n % 2 == 0) return false; // double sqrtNum = Math.Sqrt(n); for (int i = 3; i < n; i += 2) { if (n % i == 0) return false; } return true; } public static string[] SpRead(char c) { return Console.ReadLine().Split(c); } }
using System; using System.Collections.Generic; using System.Linq; using static Atcoder; using System.Threading.Tasks; using System.ComponentModel; public class Hello { public static void Main() { int[] n = SpRead(' ').Select(a => int.Parse(a)).ToArray(); if (n[0] <= n[2] && (n[0] + n[1]) >= n[2]) Console.WriteLine("YES"); else Console.WriteLine("NO"); } } public class Atcoder { static void Swap<T>(ref T a, ref T b) { var t = a; a = b; b = t; } public static int LCM(int a, int b) { int c = a * b; if (a < b) Swap(ref a, ref b); int d = a % b; while (d != 0) { a = b; b = d; d = a % b; } return c / b; } public static string strReverce(string s) { return new string(s.Reverse().ToArray()); } public static int Cin() { return int.Parse(Console.ReadLine()); } public static bool IsPrime(int n) { if (n < 2) return false; if (n == 2) return true; if (n % 2 == 0) return false; // double sqrtNum = Math.Sqrt(n); for (int i = 3; i < n; i += 2) { if (n % i == 0) return false; } return true; } public static string[] SpRead(char c) { return Console.ReadLine().Split(c); } }
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 18], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 19]]
8
364
2
using System; public class Hello { public static void Main() { // Your code here! string[] input = Console.ReadLine().Split(' '); int a = int.Parse(input[0]); int b = int.Parse(input[1]); int x = int.Parse(input[2]); if (x > a + b || x < a) { Console.WriteLine("No"); } else { Console.WriteLine("Yes"); } } }
using System; public class Hello { public static void Main() { // Your code here! string[] input = Console.ReadLine().Split(' '); int a = int.Parse(input[0]); int b = int.Parse(input[1]); int x = int.Parse(input[2]); if (x > a + b || x < a) { Console.WriteLine("NO"); } else { Console.WriteLine("YES"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
109
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtCoder_ABC089_A { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(' '); int a = int.Parse(str[0]); int b = int.Parse(str[1]); int x = int.Parse(str[2]); Console.WriteLine((a <= x && x <= a + b) ? "Yes" : "No"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtCoder_ABC089_A { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(' '); int a = int.Parse(str[0]); int b = int.Parse(str[1]); int x = int.Parse(str[2]); Console.WriteLine((a <= x && x <= a + b) ? "YES" : "NO"); } } }
[["-", 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
128
4
using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { var a = new List<string>(Console.ReadLine().Split(' ')) .Select(x => int.Parse(x)) .ToList(); if (a[0] <= a[2] && a[2] <= a[0] + a[1]) { Console.WriteLine("YES"); } else { Console.WriteLine("No"); } } }
using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { var a = new List<string>(Console.ReadLine().Split(' ')) .Select(x => int.Parse(x)) .ToList(); if (a[0] <= a[2] && a[2] <= a[0] + a[1]) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
119
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { int a, b, c, d; // a = int.Parse(Console.ReadLine()); //標準入力 string[] str = Console.ReadLine().Split(' '); // 2つ以上のスペース区切り入力の取得 b = int.Parse(str[0]); //数値で受け取りたい場合は変換する c = int.Parse(str[1]); d = int.Parse(str[2]); string re = "NO"; if (b < d) { if (b + c >= d) { re = "YES"; } } Console.Write(re); // Console.Write("改行なし a = {0} b = {1} c = {2}", a, b, c)//改行なし出力 // Console.WriteLine("改行あり a = {0} b = {1} c = {2}", a, b, // c);//改行付き出力 } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { int a, b, c, d; // a = int.Parse(Console.ReadLine()); //標準入力 string[] str = Console.ReadLine().Split(' '); // 2つ以上のスペース区切り入力の取得 b = int.Parse(str[0]); //数値で受け取りたい場合は変換する c = int.Parse(str[1]); d = int.Parse(str[2]); string re = "NO"; if (b <= d) { if (b + c >= d) { re = "YES"; } } Console.Write(re); // Console.Write("改行なし a = {0} b = {1} c = {2}", a, b, c)//改行なし出力 // Console.WriteLine("改行あり a = {0} b = {1} c = {2}", a, b, // c);//改行付き出力 } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
8
153
2
using System; using System.Diagnostics; using System.IO; using System.Text; using System.Linq; using System.Collections.Generic; using System.Text.RegularExpressions; class Program { const string Yes = "Yes"; const string No = "No"; const long Mod = 1000000007; static void Main(string[] args) { #if DEBUG MyDebugger.Test(process, "../TextFile1.txt"); #else object ret = process(new StreamReader(Console.OpenStandardInput())); Console.WriteLine(ret); #endif } static object process(TextReader input) { var spl = input.ReadLine().Split(' '); var n = int.Parse(spl[0]); var m = int.Parse(spl[1]); var x = int.Parse(spl[2]); var ary = ToIntArray(input.ReadLine(), n); int left = 0; int right = 0; foreach (int i in ary) { if (i < x) left++; if (i > x) right++; } return Math.Min(left, right); } static int[] ToIntArray(string strs, int n) { var ret = new int[n]; var spl = strs.Split(' '); for (int i = 0; i < n; i++) ret[i] = int.Parse(spl[i]); return ret; } }
using System; using System.Diagnostics; using System.IO; using System.Text; using System.Linq; using System.Collections.Generic; using System.Text.RegularExpressions; class Program { const string Yes = "Yes"; const string No = "No"; const long Mod = 1000000007; static void Main(string[] args) { #if DEBUG MyDebugger.Test(process, "../TextFile1.txt"); #else object ret = process(new StreamReader(Console.OpenStandardInput())); Console.WriteLine(ret); #endif } static object process(TextReader input) { var spl = input.ReadLine().Split(' '); var n = int.Parse(spl[0]); var m = int.Parse(spl[1]); var x = int.Parse(spl[2]); var ary = ToIntArray(input.ReadLine(), m); int left = 0; int right = 0; foreach (int i in ary) { if (i < x) left++; if (i > x) right++; } return Math.Min(left, right); } static int[] ToIntArray(string strs, int n) { var ret = new int[n]; var spl = strs.Split(' '); for (int i = 0; i < n; i++) ret[i] = int.Parse(spl[i]); return ret; } }
[["-", 0, 212, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 212, 0, 213, 3, 4, 0, 28, 0, 22]]
8
307
2
using System; using System.Linq; namespace abc094_b { class Program { static void Main(string[] args) { int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray(); int b = 0; int c = 0; for (int i = 0; i < x[2]; i++) { if (a[i] < x[1]) b++; else c++; } Console.WriteLine(Math.Min(b, c)); } } }
using System; using System.Linq; namespace abc094_b { class Program { static void Main(string[] args) { int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray(); int b = 0; int c = 0; for (int i = 0; i < x[1]; i++) { if (a[i] < x[2]) b++; else c++; } Console.WriteLine(Math.Min(b, c)); } } }
[["-", 15, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 15, 16, 12, 204, 206, 207, 0, 28, 0, 203]]
8
141
4
using System; using System.Linq; using System.Collections.Generic; namespace Atcoder { class MainClass { public static void Main(string[] args) { var inputs = Enumerable.Range(0, 2).Select(_ => Console.ReadLine()).ToArray(); var memberCount = int.Parse(inputs[0]); var hoge = inputs[1].Split(' ').Select(x => int.Parse(x)).ToArray(); var day = hoge[0]; var remain = hoge[1]; var consumes = Enumerable.Range(0, memberCount) .Select(_ => Console.ReadLine()) .Select(x => int.Parse(x)) .ToArray(); var tabeta = 0; for (var i = 0; i < memberCount; i++) { var sugita = 0; while (sugita <= day) { sugita += consumes[i]; tabeta++; } } Console.WriteLine(remain + tabeta); } } }
using System; using System.Linq; using System.Collections.Generic; namespace Atcoder { class MainClass { public static void Main(string[] args) { var inputs = Enumerable.Range(0, 2).Select(_ => Console.ReadLine()).ToArray(); var memberCount = int.Parse(inputs[0]); var hoge = inputs[1].Split(' ').Select(x => int.Parse(x)).ToArray(); var day = hoge[0]; var remain = hoge[1]; var consumes = Enumerable.Range(0, memberCount) .Select(_ => Console.ReadLine()) .Select(x => int.Parse(x)) .ToArray(); var tabeta = 0; for (var i = 0; i < memberCount; i++) { var sugita = 0; while (sugita < day) { sugita += consumes[i]; tabeta++; } } Console.WriteLine(remain + tabeta); } } }
[["-", 0, 7, 8, 196, 0, 52, 15, 16, 17, 19], ["+", 0, 7, 8, 196, 0, 52, 15, 16, 17, 18]]
8
214
2
using System; using System.Text; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; using static System.Math; namespace AtCoder { public class Program { public static void Main(string[] args) { new Program().Solve(new ConsoleInput(Console.In, ' ')); } public void Solve(ConsoleInput cin) { var N = cin.ReadInt; var D = cin.ReadInt; var X = cin.ReadInt; var A = new int[N]; for (int i = 0; i < N; i++) { A[i] = cin.ReadInt; } var ans = 0; for (int i = 0; i < N; i++) { var tmp = 1 + (D - 1) / A[i]; ans += tmp; } WriteLine(ans); } } public class ConsoleInput { private readonly System.IO.TextReader _stream; private char _separator = ' '; private Queue<string> inputStream; public ConsoleInput(System.IO.TextReader stream, char separator = ' ') { this._separator = separator; this._stream = stream; inputStream = new Queue<string>(); } public string Read { get { if (inputStream.Count != 0) return inputStream.Dequeue(); string[] tmp = _stream.ReadLine().Split(_separator); for (int i = 0; i < tmp.Length; ++i) inputStream.Enqueue(tmp[i]); return inputStream.Dequeue(); } } public string ReadLine { get { return _stream.ReadLine(); } } public int ReadInt { get { return int.Parse(Read); } } public long ReadLong { get { return long.Parse(Read); } } public double ReadDouble { get { return double.Parse(Read); } } public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; } public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; } public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; } } }
using System; using System.Text; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; using static System.Math; namespace AtCoder { public class Program { public static void Main(string[] args) { new Program().Solve(new ConsoleInput(Console.In, ' ')); } public void Solve(ConsoleInput cin) { var N = cin.ReadInt; var D = cin.ReadInt; var X = cin.ReadInt; var A = new int[N]; for (int i = 0; i < N; i++) { A[i] = cin.ReadInt; } var ans = 0; for (int i = 0; i < N; i++) { var tmp = 1 + (D - 1) / A[i]; ans += tmp; } ans += X; WriteLine(ans); } } public class ConsoleInput { private readonly System.IO.TextReader _stream; private char _separator = ' '; private Queue<string> inputStream; public ConsoleInput(System.IO.TextReader stream, char separator = ' ') { this._separator = separator; this._stream = stream; inputStream = new Queue<string>(); } public string Read { get { if (inputStream.Count != 0) return inputStream.Dequeue(); string[] tmp = _stream.ReadLine().Split(_separator); for (int i = 0; i < tmp.Length; ++i) inputStream.Enqueue(tmp[i]); return inputStream.Dequeue(); } } public string ReadLine { get { return _stream.ReadLine(); } } public int ReadInt { get { return int.Parse(Read); } } public long ReadLong { get { return long.Parse(Read); } } public double ReadDouble { get { return double.Parse(Read); } } public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; } public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; } public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; } } }
[["+", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 8, 196, 0, 1, 0, 11, 0, 202, 0, 107], ["+", 0, 195, 8, 196, 0, 1, 0, 11, 12, 22], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35]]
8
525
4
using System; using System.Linq; class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); var d = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); var a = new int[n]; int count = 0; for (int i = 0; i < n; i++) { a[i] = int.Parse(Console.ReadLine()); for (int j = 1; j <= d[0]; j += a[i]) { count++; } } Console.WriteLine(count); } }
using System; using System.Linq; class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); var d = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); var a = new int[n]; int count = 0; for (int i = 0; i < n; i++) { a[i] = int.Parse(Console.ReadLine()); for (int j = 1; j <= d[0]; j += a[i]) { count++; } } Console.WriteLine(count + d[1]); } }
[["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["+", 3, 4, 0, 28, 0, 16, 12, 204, 205, 22], ["+", 0, 28, 0, 16, 12, 204, 206, 207, 0, 70], ["+", 0, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 28, 0, 16, 12, 204, 206, 207, 0, 73]]
8
145
5
using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Runtime.CompilerServices; namespace FertiLib.Contest.A { static class Program { public static void Solve(Scanner cin) { int n = cin.ReadInt(); var a = cin.ReadIntArray(n); var l = new List<int>(); l.Add(0); for (int i = 0; i < n; i++) { l.Add(a[i]); } l.Add(0); long ans = 0; for (int i = 0; i < n + 1; i++) { ans += Math.Abs(l[i + 1] - l[i]); } for (int i = 0 + 1; i < n + 1; i++) { Console.WriteLine(ans - Math.Abs(l[i] - l[i - 1]) - Math.Abs(l[i + 1] - l[i]) + Math.Abs(l[i + 1] - l[i])); } } public static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); var cin = new Scanner(); Solve(cin); Console.Out.Flush(); } public static void YESNO(bool condition) => Console.WriteLine(condition ? "YES" : "NO"); public static void YesNo(bool condition) => Console.WriteLine(condition ? "Yes" : "No"); public static void yesno(bool condition) => Console.WriteLine(condition ? "yes" : "no"); public static bool Chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) >= 0) return false; a = b; return true; } public static bool Chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) <= 0) return false; a = b; return true; } } static class Extention { public static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x); public static int UpperBound<T>(this IList<T> list, T value) => list.BinarySearch(value, true, 0, list.Count, Comparer<T>.Default); public static int LowerBound<T>(this IList<T> list, T value) => list.BinarySearch(value, false, 0, list.Count, Comparer<T>.Default); public static int BinarySearch<T>(this IList<T> list, T value, bool isUpperBound, int index, int length, Comparer<T> comparer) { var ng = index - 1; var ok = index + length; while (ok - ng > 1) { var mid = ng + (ok - ng) / 2; var res = comparer.Compare(list[mid], value); if (res < 0 || (isUpperBound && res == 0)) ng = mid; else ok = mid; } return ok; } } class Scanner { string[] s; int i; char[] separator = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string Read() => ReadString(); public string ReadString() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(separator, StringSplitOptions.RemoveEmptyEntries); if (s.Length == 0) return ReadString(); i = 0; return s[i++]; } public string[] ReadStringArray(int N) { string[] Array = new string[N]; for (int i = 0; i < N; i++) { Array[i] = ReadString(); } return Array; } public int ReadInt() { return int.Parse(ReadString()); } public int[] ReadIntArray(int N, int add = 0) { int[] Array = new int[N]; for (int i = 0; i < N; i++) { Array[i] = ReadInt() + add; } return Array; } public long ReadLong() { return long.Parse(ReadString()); } public long[] ReadLongArray(int N, long add = 0) { long[] Array = new long[N]; for (int i = 0; i < N; i++) { Array[i] = ReadLong() + add; } return Array; } public double ReadDouble() { return double.Parse(ReadString()); } public double[] ReadDoubleArray(int N, double add = 0) { double[] Array = new double[N]; for (int i = 0; i < N; i++) { Array[i] = ReadDouble() + add; } return Array; } public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(), typeof(T1)); public (T1, T2) ReadValue<T1, T2>() { var inputs = ReadStringArray(2); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); return (v1, v2); } public (T1, T2, T3) ReadValue<T1, T2, T3>() { var inputs = ReadStringArray(3); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); return (v1, v2, v3); } public (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>() { var inputs = ReadStringArray(4); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); return (v1, v2, v3, v4); } public (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>() { var inputs = ReadStringArray(5); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); return (v1, v2, v3, v4, v5); } public (T1, T2, T3, T4, T5, T6) ReadValue<T1, T2, T3, T4, T5, T6>() { var inputs = ReadStringArray(6); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); return (v1, v2, v3, v4, v5, v6); } public (T1, T2, T3, T4, T5, T6, T7) ReadValue<T1, T2, T3, T4, T5, T6, T7>() { var inputs = ReadStringArray(7); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7)); return (v1, v2, v3, v4, v5, v6, v7); } public T1[] ReadValueArray<T1>(int N) { var v1 = new T1[N]; for (int i = 0; i < N; i++) { v1[i] = ReadValue<T1>(); } return v1; } public (T1[], T2[]) ReadValueArray<T1, T2>(int N) { var (v1, v2) = (new T1[N], new T2[N]); for (int i = 0; i < N; i++) { var (t1, t2) = ReadValue<T1, T2>(); v1[i] = t1; v2[i] = t2; } return (v1, v2); } public (T1[], T2[], T3[]) ReadValueArray<T1, T2, T3>(int N) { var (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3) = ReadValue<T1, T2, T3>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; } return (v1, v2, v3); } public (T1[], T2[], T3[], T4[]) ReadValueArray<T1, T2, T3, T4>(int N) { var (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4) = ReadValue<T1, T2, T3, T4>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; } return (v1, v2, v3, v4); } public (T1[], T2[], T3[], T4[], T5[]) ReadValueArray<T1, T2, T3, T4, T5>(int N) { var (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5) = ReadValue<T1, T2, T3, T4, T5>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; } return (v1, v2, v3, v4, v5); } public (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray<T1, T2, T3, T4, T5, T6>(int N) { var (v1, v2, v3, v4, v5, v6) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6) = ReadValue<T1, T2, T3, T4, T5, T6>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; } return (v1, v2, v3, v4, v5, v6); } public (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray<T1, T2, T3, T4, T5, T6, T7>(int N) { var (v1, v2, v3, v4, v5, v6, v7) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N], new T7[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6, t7) = ReadValue<T1, T2, T3, T4, T5, T6, T7>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; v7[i] = t7; } return (v1, v2, v3, v4, v5, v6, v7); } } }
using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Runtime.CompilerServices; namespace FertiLib.Contest.A { static class Program { public static void Solve(Scanner cin) { int n = cin.ReadInt(); var a = cin.ReadIntArray(n); var l = new List<int>(); l.Add(0); for (int i = 0; i < n; i++) { l.Add(a[i]); } l.Add(0); long ans = 0; for (int i = 0; i < n + 1; i++) { ans += Math.Abs(l[i + 1] - l[i]); } for (int i = 0 + 1; i < n + 1; i++) { Console.WriteLine(ans - Math.Abs(l[i] - l[i - 1]) - Math.Abs(l[i + 1] - l[i]) + Math.Abs(l[i + 1] - l[i - 1])); } } public static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); var cin = new Scanner(); Solve(cin); Console.Out.Flush(); } public static void YESNO(bool condition) => Console.WriteLine(condition ? "YES" : "NO"); public static void YesNo(bool condition) => Console.WriteLine(condition ? "Yes" : "No"); public static void yesno(bool condition) => Console.WriteLine(condition ? "yes" : "no"); public static bool Chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) >= 0) return false; a = b; return true; } public static bool Chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) <= 0) return false; a = b; return true; } } static class Extention { public static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x); public static int UpperBound<T>(this IList<T> list, T value) => list.BinarySearch(value, true, 0, list.Count, Comparer<T>.Default); public static int LowerBound<T>(this IList<T> list, T value) => list.BinarySearch(value, false, 0, list.Count, Comparer<T>.Default); public static int BinarySearch<T>(this IList<T> list, T value, bool isUpperBound, int index, int length, Comparer<T> comparer) { var ng = index - 1; var ok = index + length; while (ok - ng > 1) { var mid = ng + (ok - ng) / 2; var res = comparer.Compare(list[mid], value); if (res < 0 || (isUpperBound && res == 0)) ng = mid; else ok = mid; } return ok; } } class Scanner { string[] s; int i; char[] separator = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string Read() => ReadString(); public string ReadString() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(separator, StringSplitOptions.RemoveEmptyEntries); if (s.Length == 0) return ReadString(); i = 0; return s[i++]; } public string[] ReadStringArray(int N) { string[] Array = new string[N]; for (int i = 0; i < N; i++) { Array[i] = ReadString(); } return Array; } public int ReadInt() { return int.Parse(ReadString()); } public int[] ReadIntArray(int N, int add = 0) { int[] Array = new int[N]; for (int i = 0; i < N; i++) { Array[i] = ReadInt() + add; } return Array; } public long ReadLong() { return long.Parse(ReadString()); } public long[] ReadLongArray(int N, long add = 0) { long[] Array = new long[N]; for (int i = 0; i < N; i++) { Array[i] = ReadLong() + add; } return Array; } public double ReadDouble() { return double.Parse(ReadString()); } public double[] ReadDoubleArray(int N, double add = 0) { double[] Array = new double[N]; for (int i = 0; i < N; i++) { Array[i] = ReadDouble() + add; } return Array; } public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(), typeof(T1)); public (T1, T2) ReadValue<T1, T2>() { var inputs = ReadStringArray(2); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); return (v1, v2); } public (T1, T2, T3) ReadValue<T1, T2, T3>() { var inputs = ReadStringArray(3); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); return (v1, v2, v3); } public (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>() { var inputs = ReadStringArray(4); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); return (v1, v2, v3, v4); } public (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>() { var inputs = ReadStringArray(5); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); return (v1, v2, v3, v4, v5); } public (T1, T2, T3, T4, T5, T6) ReadValue<T1, T2, T3, T4, T5, T6>() { var inputs = ReadStringArray(6); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); return (v1, v2, v3, v4, v5, v6); } public (T1, T2, T3, T4, T5, T6, T7) ReadValue<T1, T2, T3, T4, T5, T6, T7>() { var inputs = ReadStringArray(7); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7)); return (v1, v2, v3, v4, v5, v6, v7); } public T1[] ReadValueArray<T1>(int N) { var v1 = new T1[N]; for (int i = 0; i < N; i++) { v1[i] = ReadValue<T1>(); } return v1; } public (T1[], T2[]) ReadValueArray<T1, T2>(int N) { var (v1, v2) = (new T1[N], new T2[N]); for (int i = 0; i < N; i++) { var (t1, t2) = ReadValue<T1, T2>(); v1[i] = t1; v2[i] = t2; } return (v1, v2); } public (T1[], T2[], T3[]) ReadValueArray<T1, T2, T3>(int N) { var (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3) = ReadValue<T1, T2, T3>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; } return (v1, v2, v3); } public (T1[], T2[], T3[], T4[]) ReadValueArray<T1, T2, T3, T4>(int N) { var (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4) = ReadValue<T1, T2, T3, T4>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; } return (v1, v2, v3, v4); } public (T1[], T2[], T3[], T4[], T5[]) ReadValueArray<T1, T2, T3, T4, T5>(int N) { var (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5) = ReadValue<T1, T2, T3, T4, T5>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; } return (v1, v2, v3, v4, v5); } public (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray<T1, T2, T3, T4, T5, T6>(int N) { var (v1, v2, v3, v4, v5, v6) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6) = ReadValue<T1, T2, T3, T4, T5, T6>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; } return (v1, v2, v3, v4, v5, v6); } public (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray<T1, T2, T3, T4, T5, T6, T7>(int N) { var (v1, v2, v3, v4, v5, v6, v7) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N], new T7[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6, t7) = ReadValue<T1, T2, T3, T4, T5, T6, T7>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; v7[i] = t7; } return (v1, v2, v3, v4, v5, v6, v7); } } }
[["+", 12, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 12, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
8
3,010
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); var A = Console.ReadLine().Split().Select(int.Parse).ToArray(); int total = A[0]; for (int i = 0; i < N - 1; i++) { total += Math.Abs(A[i + 1] - A[i]); } total += Math.Abs(A[N - 1]); Console.WriteLine(total - Math.Abs(A[0]) - Math.Abs(A[1] - A[0]) + Math.Abs(A[1])); for (int i = 1; i < N - 1; i++) { Console.WriteLine(total - Math.Abs(A[i] - A[i - 1]) - Math.Abs(A[i + 1] - A[i]) + Math.Abs(A[i + 1] - A[i - 1])); } Console.WriteLine(total - Math.Abs(A[N - 1] - A[N - 2]) - Math.Abs(A[N - 1]) + Math.Abs(A[N - 2])); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); var A = Console.ReadLine().Split().Select(int.Parse).ToArray(); int total = Math.Abs(A[0]); for (int i = 0; i < N - 1; i++) { total += Math.Abs(A[i + 1] - A[i]); } total += Math.Abs(A[N - 1]); Console.WriteLine(total - Math.Abs(A[0]) - Math.Abs(A[1] - A[0]) + Math.Abs(A[1])); for (int i = 1; i < N - 1; i++) { Console.WriteLine(total - Math.Abs(A[i] - A[i - 1]) - Math.Abs(A[i + 1] - A[i]) + Math.Abs(A[i + 1] - A[i - 1])); } Console.WriteLine(total - Math.Abs(A[N - 1] - A[N - 2]) - Math.Abs(A[N - 1]) + Math.Abs(A[N - 2])); } }
[["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 22], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 0, 131], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 141, 22], ["+", 0, 200, 0, 212, 0, 213, 3, 4, 0, 24], ["+", 0, 200, 0, 212, 0, 213, 3, 4, 0, 25]]
8
309
5
using System; using System.Linq; using System.Collections.Generic; 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 c = int.Parse(input[2]); if ((a + b) > c) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } }
using System; using System.Linq; using System.Collections.Generic; 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 c = int.Parse(input[2]); if ((a + b) >= c) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20]]
8
117
2
using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Security.Cryptography; using System.Text; namespace cswork { class Program { 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); i = 0; return next(); } public int nextInt() { return int.Parse(next()); } public long nextLong() { return long.Parse(next()); } public double nextDouble() { return double.Parse(next()); } } public Program() {} static void Main(string[] args) { new Program().Omame(); } Scanner cin; const int MAXIN = 1024; bool[] used = new bool[MAXIN]; int[] perm = new int[MAXIN]; List<int[]> permList = new List<int[]>(); public void Permutation(int pos, int n, int length) { if (pos == n) { permList.Add((int[])perm.Clone()); } for (int i = 0; i < n; i++) { if (!used[i]) { perm[pos] = i; used[i] = true; Permutation(pos + 1, n, length); used[i] = false; } } } public static List<long> GeneratePrime(long max) { long prime; double sqrtMax = Math.Sqrt(max); var primeList = new List<long>(); List<long> searchList = new List<long>(); for (long i = 2; i <= max - 1; i++) { searchList.Add(i); } do { prime = searchList.First(); primeList.Add(prime); searchList.RemoveAll(n => n % prime == 0); } while (prime < sqrtMax); primeList.AddRange(searchList); return primeList; } public static readonly string Yes = "Yes"; public static readonly string YES = "YES"; public static readonly string No = "No"; public static readonly string NO = "NO"; public static readonly string OK = "OK"; public static readonly string NG = "NG"; void Omame() { cin = new Scanner(); long A = cin.nextLong(); long B = cin.nextLong(); long C = cin.nextLong(); if (A + B * 2 >= C) { Console.WriteLine(Yes); } else { Console.WriteLine(No); } } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Security.Cryptography; using System.Text; namespace cswork { class Program { 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); i = 0; return next(); } public int nextInt() { return int.Parse(next()); } public long nextLong() { return long.Parse(next()); } public double nextDouble() { return double.Parse(next()); } } public Program() {} static void Main(string[] args) { new Program().Omame(); } Scanner cin; const int MAXIN = 1024; bool[] used = new bool[MAXIN]; int[] perm = new int[MAXIN]; List<int[]> permList = new List<int[]>(); public void Permutation(int pos, int n, int length) { if (pos == n) { permList.Add((int[])perm.Clone()); } for (int i = 0; i < n; i++) { if (!used[i]) { perm[pos] = i; used[i] = true; Permutation(pos + 1, n, length); used[i] = false; } } } public static List<long> GeneratePrime(long max) { long prime; double sqrtMax = Math.Sqrt(max); var primeList = new List<long>(); List<long> searchList = new List<long>(); for (long i = 2; i <= max - 1; i++) { searchList.Add(i); } do { prime = searchList.First(); primeList.Add(prime); searchList.RemoveAll(n => n % prime == 0); } while (prime < sqrtMax); primeList.AddRange(searchList); return primeList; } public static readonly string Yes = "Yes"; public static readonly string YES = "YES"; public static readonly string No = "No"; public static readonly string NO = "NO"; public static readonly string OK = "OK"; public static readonly string NG = "NG"; void Omame() { cin = new Scanner(); long A = cin.nextLong(); long B = cin.nextLong(); long C = cin.nextLong(); if (A + B >= C) { Console.WriteLine(Yes); } else { Console.WriteLine(No); } } } }
[["-", 0, 57, 15, 16, 31, 16, 12, 16, 17, 48], ["-", 0, 57, 15, 16, 31, 16, 12, 16, 12, 203]]
8
636
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC091A { class Program { static void Main(string[] args) { int a, b, c; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); c = int.Parse(word[2]); if (a + b <= c) { Console.WriteLine("No"); } else { Console.WriteLine("Yes"); } Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC091A { class Program { static void Main(string[] args) { int a, b, c; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); c = int.Parse(word[2]); if (a + b < c) { Console.WriteLine("No"); } else { Console.WriteLine("Yes"); } Console.ReadKey(); } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18]]
8
142
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC091A { class Program { static void Main(string[] args) { string[] n = Console.ReadLine().Split(' '); int a = int.Parse(n[0]); int b = int.Parse(n[1]); int c = int.Parse(n[2]); if ((a + b) >= c) Console.WriteLine("Yes"); else Console.WriteLine("NO"); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC091A { class Program { static void Main(string[] args) { string[] n = Console.ReadLine().Split(' '); int a = int.Parse(n[0]); int b = int.Parse(n[1]); int c = int.Parse(n[2]); if ((a + b) >= c) Console.WriteLine("Yes"); else Console.WriteLine("No"); Console.ReadKey(); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
138
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC091A { class Program { static void Main(string[] args) { int a, b, c; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); c = int.Parse(word[2]); if (a + b > c) Console.WriteLine("Yes"); else Console.WriteLine("No"); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC091A { class Program { static void Main(string[] args) { int a, b, c; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); c = int.Parse(word[2]); if (a + b >= c) Console.WriteLine("Yes"); else Console.WriteLine("No"); Console.ReadKey(); } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20]]
8
138
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC091A { class Program { static void Main(string[] args) { int a, b, c; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); c = int.Parse(word[2]); if (c <= a + c) Console.WriteLine("Yes"); else Console.WriteLine("No"); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC091A { class Program { static void Main(string[] args) { int a, b, c; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); c = int.Parse(word[2]); if (c <= a + b) Console.WriteLine("Yes"); else Console.WriteLine("No"); Console.ReadKey(); } } }
[["-", 8, 196, 0, 57, 15, 16, 12, 16, 12, 22], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 12, 22]]
8
138
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp36 { class Program { static void Main(string[] args) { var st = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); int A = st[0]; int B = st[1]; int C = st[2]; if (A + B * 2 >= C) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp36 { class Program { static void Main(string[] args) { var st = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); int A = st[0]; int B = st[1]; int C = st[2]; if (A + B >= C) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
[["-", 0, 57, 15, 16, 31, 16, 12, 16, 17, 48], ["-", 0, 57, 15, 16, 31, 16, 12, 16, 12, 203]]
8
130
2
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.CompilerServices; using static System.Math; using System.Text; namespace Program { public static class ABC091A { static public void Solve() { var A = NN; var B = NN; var C = NN; if (C <= 2 * A + 2 * B) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } static public void Main(string[] args) { if (args.Length == 0) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); } Solve(); Console.Out.Flush(); } static Random rand = new Random(); static class Console_ { static Queue<string> param = new Queue<string>(); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); } } static long NN => long.Parse(Console_.NextString()); static double ND => double.Parse(Console_.NextString()); static string NS => Console_.NextString(); [MethodImpl(MethodImplOptions.AggressiveInlining)] static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray(); [MethodImpl(MethodImplOptions.AggressiveInlining)] static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray(); [MethodImpl(MethodImplOptions.AggressiveInlining)] static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray(); [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => rand.Next()); [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n); [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c); [MethodImpl(MethodImplOptions.AggressiveInlining)] static void RevSort<T>(T[] l) where T : IComparable { Array.Sort(l, (x, y) => y.CompareTo(x)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static void RevSort<T>(T[] l, Comparison<T> comp) where T : IComparable { Array.Sort(l, (x, y) => comp(y, x)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<long> Primes(long x) { if (x < 2) yield break; yield return 2; var halfx = x / 2; var table = new bool[halfx + 1]; var max = (long)(Math.Sqrt(x) / 2); for (long i = 1; i <= max; ++i) { if (table[i]) continue; var add = 2 * i + 1; yield return add; for (long j = 2 * i * (i + 1); j <= halfx; j += add) table[j] = true; } for (long i = max + 1; i <= halfx; ++i) if (!table[i] && 2 * i + 1 <= x) yield return 2 * i + 1; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<long> Factors(long x) { if (x < 2) yield break; while (x % 2 == 0) { x /= 2; yield return 2; } var max = (long)Math.Sqrt(x); for (long i = 3; i <= max; i += 2) while (x % i == 0) { x /= i; yield return i; } if (x != 1) yield return x; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<long> Divisor(long x) { if (x < 1) yield break; var max = (long)Math.Sqrt(x); for (long i = 1; i <= max; ++i) { if (x % i != 0) continue; yield return i; if (i != x / i) yield return x / i; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] static long GCD(long a, long b) { while (b > 0) { var tmp = b; b = a % b; a = tmp; } return a; } static long LCM(long a, long b) => a * b / GCD(a, b); [MethodImpl(MethodImplOptions.AggressiveInlining)] static Mat<T> Pow<T>(Mat<T> x, long y) => Mat<T>.Pow(x, y); [MethodImpl(MethodImplOptions.AggressiveInlining)] static T Pow<T>(T x, long y) { T a = (dynamic)1; while (y != 0) { if ((y & 1) == 1) a *= (dynamic)x; x *= (dynamic)x; y >>= 1; } return a; } static List<long> _fact = new List<long>() { 1 }; [MethodImpl(MethodImplOptions.AggressiveInlining)] static void _B(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static long Comb(long n, long k) { _B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static long Perm(long n, long k) { _B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)]; } class PQ<T> where T : IComparable { List<T> h; Comparison<T> c; public T Peek => h[0]; public int Count => h.Count; [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(int cap, Comparison<T> c, bool asc = true) { h = new List<T>(cap); this.c = asc ? c : (x, y) => c(y, x); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(Comparison<T> c, bool asc = true) { h = new List<T>(); this.c = asc ? c : (x, y) => c(y, x); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) {} [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) {} [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Push(T v) { var i = h.Count; h.Add(v); while (i > 0) { var ni = (i - 1) / 2; if (c(v, h[ni]) >= 0) break; h[i] = h[ni]; i = ni; } h[i] = v; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public T Pop() { var r = h[0]; var v = h[h.Count - 1]; h.RemoveAt(h.Count - 1); if (h.Count == 0) return r; var i = 0; while (i * 2 + 1 < h.Count) { var i1 = i * 2 + 1; var i2 = i * 2 + 2; if (i2 < h.Count && c(h[i1], h[i2]) > 0) i1 = i2; if (c(v, h[i1]) <= 0) break; h[i] = h[i1]; i = i1; } h[i] = v; return r; } } class PQ<TK, TV> where TK : IComparable { PQ<Tuple<TK, TV>> q; public Tuple<TK, TV> Peek => q.Peek; public int Count => q.Count; [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(int cap, Comparison<TK> c, bool asc = true) { q = new PQ<Tuple<TK, TV>>(cap, (x, y) => c(x.Item1, y.Item1), asc); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(Comparison<TK> c, bool asc = true) { q = new PQ<Tuple<TK, TV>>((x, y) => c(x.Item1, y.Item1), asc); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) {} [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) {} [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Push(TK k, TV v) => q.Push(Tuple.Create(k, v)); [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<TK, TV> Pop() => q.Pop(); } public class UF { long[] d; [MethodImpl(MethodImplOptions.AggressiveInlining)] public UF(long s) { d = Repeat(-1L, s).ToArray(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Unite(long x, long y) { x = Root(x); y = Root(y); if (x != y) { if (d[y] < d[x]) { var t = y; y = x; x = t; } d[x] += d[y]; d[y] = x; } return x != y; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool IsSame(long x, long y) => Root(x) == Root(y); [MethodImpl(MethodImplOptions.AggressiveInlining)] public long Root(long x) => d[x] < 0 ? x : d[x] = Root(d[x]); [MethodImpl(MethodImplOptions.AggressiveInlining)] public long Count(long x) => -d[Root(d[x])]; } struct Mod : IEquatable<object> { static public long _mod = 1000000007; long _val; [MethodImpl(MethodImplOptions.AggressiveInlining)] public Mod(long x) { if (x < _mod && x >= 0) _val = x; else if ((_val = x % _mod) < 0) _val += _mod; } static public implicit operator Mod(long x) => new Mod(x); [MethodImpl(MethodImplOptions.AggressiveInlining)] static public implicit operator long(Mod x) => x._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod operator +(Mod x, Mod y) => x._val + y._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod operator -(Mod x, Mod y) => x._val - y._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod operator *(Mod x, Mod y) => x._val * y._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod operator /(Mod x, Mod y) => x._val * Inverse(y._val); [MethodImpl(MethodImplOptions.AggressiveInlining)] static public bool operator ==(Mod x, Mod y) => x._val == y._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public bool operator !=(Mod x, Mod y) => x._val != y._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public long Inverse(long x) { long b = _mod, r = 1, u = 0, t = 0; while (b > 0) { var q = x / b; t = u; u = r - q * u; r = t; t = b; b = x - q * b; x = t; } return r < 0 ? r + _mod : r; } [MethodImpl(MethodImplOptions.AggressiveInlining)] bool IEquatable<object>.Equals(object obj) => obj == null ? false : Equals((Mod)obj); [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) => obj == null ? false : Equals((Mod)obj); [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Equals(Mod obj) => obj == null ? false : _val == obj._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] public override int GetHashCode() => _val.GetHashCode(); [MethodImpl(MethodImplOptions.AggressiveInlining)] public override string ToString() => _val.ToString(); static List<Mod> _fact = new List<Mod>() { 1 }; [MethodImpl(MethodImplOptions.AggressiveInlining)] static void B(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod Comb(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod Perm(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)]; } } struct Mat<T> { T[,] m; [MethodImpl(MethodImplOptions.AggressiveInlining)] public Mat(T[,] v) { m = (T[,])v.Clone(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public implicit operator Mat<T>(T[,] v) => new Mat<T>(v); public T this[int r, int c] { get { return m[r, c]; } set { m[r, c] = value; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator +(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)x; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator +(Mat<T> a, Mat<T> b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)b[r, c]; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator -(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)x; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator -(Mat<T> a, Mat<T> b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)b[r, c]; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator *(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] *= (dynamic)x; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator *(Mat<T> a, Mat<T> b) { var nr = a.m.GetLength(0); var nc = b.m.GetLength(1); var tm = new T[nr, nc]; for (int i = 0; i < nr; ++i) for (int j = 0; j < nc; ++j) tm[i, j] = (dynamic)0; for (int r = 0; r < nr; ++r) for (int c = 0; c < nc; ++c) for (int i = 0; i < a.m.GetLength(1); ++i) tm[r, c] += a[r, i] * (dynamic)b[i, c]; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> Pow(Mat<T> x, long y) { var n = x.m.GetLength(0); var t = (Mat<T>)new T[n, n]; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) t[i, j] = (dynamic)(i == j ? 1 : 0); while (y != 0) { if ((y & 1) == 1) t *= x; x *= x; y >>= 1; } return t; } } class Tree { long N; int l; List<long>[] p; int[] d; long[][] pr; long r; Tuple<long, long, int>[] e; Tuple<long, long>[] b; bool lca; bool euler; bool bfs; [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tree(List<long>[] p_, long r_) { N = p_.Length; p = p_; r = r_; lca = false; euler = false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<long, long>[] FromRoot() { if (!bfs) { var nb = new List<Tuple<long, long>>(); var q = new Queue<long>(); var d = new bool[N]; nb.Add(Tuple.Create(r, -1L)); d[r] = true; q.Enqueue(r); while (q.Count > 0) { var w = q.Dequeue(); foreach (var i in p[w]) { if (d[i]) continue; d[i] = true; q.Enqueue(i); nb.Add(Tuple.Create(i, w)); } } b = nb.ToArray(); bfs = true; } return b; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<long, long>[] FromLeaf() => FromRoot().Reverse().ToArray(); [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<long, long, int>[] Euler() { if (!euler) { var ne = new List<Tuple<long, long, int>>(); var s = new Stack<Tuple<long, long>>(); var d = new bool[N]; d[r] = true; s.Push(Tuple.Create(r, -1L)); while (s.Count > 0) { var w = s.Peek(); var ad = true; foreach (var i in p[w.Item1]) { if (d[i]) continue; d[i] = true; ad = false; s.Push(Tuple.Create(i, w.Item1)); } if (!ad || p[w.Item1].Count == 1) ne.Add(Tuple.Create(w.Item1, w.Item2, 1)); if (ad) { s.Pop(); ne.Add(Tuple.Create(w.Item1, w.Item2, -1)); } } e = ne.ToArray(); euler = true; } return e; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public long LCA(long u, long v) { if (!lca) { l = 0; while (N > (1 << l)) l++; d = new int[N]; pr = Repeat(0, l).Select(_ => new long[N]).ToArray(); d[r] = 0; pr[0][r] = -1; var q = new Stack<long>(); q.Push(r); while (q.Count > 0) { var w = q.Pop(); foreach (var i in p[w]) { if (i == pr[0][w]) continue; q.Push(i); d[i] = d[w] + 1; pr[0][i] = w; } } for (var k = 0; k + 1 < l; k++) for (var w = 0; w < N; w++) if (pr[k][w] < 0) pr[k + 1][w] = -1; else pr[k + 1][w] = pr[k][pr[k][w]]; lca = true; } if (d[u] > d[v]) { var t = u; u = v; v = t; } for (var k = 0; k < l; k++) if ((((d[v] - d[u]) >> k) & 1) != 0) v = pr[k][v]; if (u == v) return u; for (var k = l - 1; k >= 0; k--) if (pr[k][u] != pr[k][v]) { u = pr[k][u]; v = pr[k][v]; } return pr[0][u]; } } class BT<T> where T : IComparable { class Node { public Node l; public Node r; public T v; public bool b; } Comparison<T> c; Node r; bool ch; T lm; [MethodImpl(MethodImplOptions.AggressiveInlining)] public BT(Comparison<T> _c) { c = _c; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public BT() : this((x, y) => x.CompareTo(y)) {} [MethodImpl(MethodImplOptions.AggressiveInlining)] bool R(Node n) => n != null && !n.b; [MethodImpl(MethodImplOptions.AggressiveInlining)] bool B(Node n) => n != null && n.b; [MethodImpl(MethodImplOptions.AggressiveInlining)] Node RtL(Node n) { Node m = n.r, t = m.l; m.l = n; n.r = t; return m; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node RtR(Node n) { Node m = n.l, t = m.r; m.r = n; n.l = t; return m; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node RtLR(Node n) { n.l = RtL(n.l); return RtR(n); } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node RtRL(Node n) { n.r = RtR(n.r); return RtL(n); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Add(T x) { r = A(r, x); r.b = true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node A(Node n, T x) { if (n == null) { ch = true; return new Node() { v = x }; } if (c(x, n.v) < 0) n.l = A(n.l, x); else n.r = A(n.r, x); return Bl(n); } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node Bl(Node n) { if (!ch) return n; if (!B(n)) return n; if (R(n.l) && R(n.l.l)) { n = RtR(n); n.l.b = true; } else if (R(n.l) && R(n.l.r)) { n = RtLR(n); n.l.b = true; } else if (R(n.r) && R(n.r.l)) { n = RtRL(n); n.r.b = true; } else if (R(n.r) && R(n.r.r)) { n = RtL(n); n.r.b = true; } else ch = false; return n; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Remove(T x) { r = Rm(r, x); if (r != null) r.b = true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node Rm(Node n, T x) { if (n == null) { ch = false; return n; } var r = c(x, n.v); if (r < 0) { n.l = Rm(n.l, x); return BlL(n); } if (r > 0) { n.r = Rm(n.r, x); return BlR(n); } if (n.l == null) { ch = n.b; return n.r; } n.l = RmM(n.l); n.v = lm; return BlL(n); } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node RmM(Node n) { if (n.r != null) { n.r = RmM(n.r); return BlR(n); } lm = n.v; ch = n.b; return n.l; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node BlL(Node n) { if (!ch) return n; if (B(n.r) && R(n.r.l)) { var b = n.b; n = RtRL(n); n.b = b; n.l.b = true; ch = false; } else if (B(n.r) && R(n.r.r)) { var b = n.b; n = RtL(n); n.b = b; n.r.b = true; n.l.b = true; ch = false; } else if (B(n.r)) { ch = n.b; n.b = true; n.r.b = false; } else { n = RtL(n); n.b = true; n.l.b = false; n.l = BlL(n.l); ch = false; } return n; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node BlR(Node n) { if (!ch) return n; if (B(n.l) && R(n.l.r)) { var b = n.b; n = RtLR(n); n.b = b; n.r.b = true; ch = false; } else if (B(n.l) && R(n.l.l)) { var b = n.b; n = RtR(n); n.b = b; n.l.b = true; n.r.b = true; ch = false; } else if (B(n.l)) { ch = n.b; n.b = true; n.l.b = false; } else { n = RtR(n); n.b = true; n.r.b = false; n.r = BlR(n.r); ch = false; } return n; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Have(T x) { var t = FindUpper(x); return t.Item1 && t.Item2.CompareTo(x) == 0; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<bool, T> FindUpper(T x) { var v = FU(r, x); return v == null ? Tuple.Create(false, default(T)) : v; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Tuple<bool, T> FU(Node n, T x) { if (n == null) return null; var r = c(x, n.v); if (r < 0) { var v = FU(n.l, x); return v == null ? Tuple.Create(true, n.v) : v; } if (r > 0) return FU(n.r, x); return Tuple.Create(true, n.v); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<bool, T> FindLower(T x) { var v = FL(r, x); return v == null ? Tuple.Create(false, default(T)) : v; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Tuple<bool, T> FL(Node n, T x) { if (n == null) return null; var r = c(x, n.v); if (r < 0) return FL(n.l, x); if (r > 0) { var v = FL(n.r, x); return v == null ? Tuple.Create(true, n.v) : v; } return Tuple.Create(true, n.v); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public T Min() { Node n = r, p = null; while (n != null) { p = n; n = n.l; } return p == null ? default(T) : p.v; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public T Max() { Node n = r, p = null; while (n != null) { p = n; n = n.r; } return p == null ? default(T) : p.v; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Any() => r != null; [MethodImpl(MethodImplOptions.AggressiveInlining)] public int CountSlow() => L(r).Count(); [MethodImpl(MethodImplOptions.AggressiveInlining)] public IEnumerable<T> List() => L(r); [MethodImpl(MethodImplOptions.AggressiveInlining)] IEnumerable<T> L(Node n) { if (n == null) yield break; foreach (var i in L(n.l)) yield return i; yield return n.v; foreach (var i in L(n.r)) yield return i; } } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.CompilerServices; using static System.Math; using System.Text; namespace Program { public static class ABC091A { static public void Solve() { var A = NN; var B = NN; var C = NN; if (C <= A + B) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } static public void Main(string[] args) { if (args.Length == 0) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); } Solve(); Console.Out.Flush(); } static Random rand = new Random(); static class Console_ { static Queue<string> param = new Queue<string>(); [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); } } static long NN => long.Parse(Console_.NextString()); static double ND => double.Parse(Console_.NextString()); static string NS => Console_.NextString(); [MethodImpl(MethodImplOptions.AggressiveInlining)] static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray(); [MethodImpl(MethodImplOptions.AggressiveInlining)] static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray(); [MethodImpl(MethodImplOptions.AggressiveInlining)] static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray(); [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => rand.Next()); [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n); [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c); [MethodImpl(MethodImplOptions.AggressiveInlining)] static void RevSort<T>(T[] l) where T : IComparable { Array.Sort(l, (x, y) => y.CompareTo(x)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static void RevSort<T>(T[] l, Comparison<T> comp) where T : IComparable { Array.Sort(l, (x, y) => comp(y, x)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<long> Primes(long x) { if (x < 2) yield break; yield return 2; var halfx = x / 2; var table = new bool[halfx + 1]; var max = (long)(Math.Sqrt(x) / 2); for (long i = 1; i <= max; ++i) { if (table[i]) continue; var add = 2 * i + 1; yield return add; for (long j = 2 * i * (i + 1); j <= halfx; j += add) table[j] = true; } for (long i = max + 1; i <= halfx; ++i) if (!table[i] && 2 * i + 1 <= x) yield return 2 * i + 1; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<long> Factors(long x) { if (x < 2) yield break; while (x % 2 == 0) { x /= 2; yield return 2; } var max = (long)Math.Sqrt(x); for (long i = 3; i <= max; i += 2) while (x % i == 0) { x /= i; yield return i; } if (x != 1) yield return x; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static IEnumerable<long> Divisor(long x) { if (x < 1) yield break; var max = (long)Math.Sqrt(x); for (long i = 1; i <= max; ++i) { if (x % i != 0) continue; yield return i; if (i != x / i) yield return x / i; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] static long GCD(long a, long b) { while (b > 0) { var tmp = b; b = a % b; a = tmp; } return a; } static long LCM(long a, long b) => a * b / GCD(a, b); [MethodImpl(MethodImplOptions.AggressiveInlining)] static Mat<T> Pow<T>(Mat<T> x, long y) => Mat<T>.Pow(x, y); [MethodImpl(MethodImplOptions.AggressiveInlining)] static T Pow<T>(T x, long y) { T a = (dynamic)1; while (y != 0) { if ((y & 1) == 1) a *= (dynamic)x; x *= (dynamic)x; y >>= 1; } return a; } static List<long> _fact = new List<long>() { 1 }; [MethodImpl(MethodImplOptions.AggressiveInlining)] static void _B(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static long Comb(long n, long k) { _B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static long Perm(long n, long k) { _B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)]; } class PQ<T> where T : IComparable { List<T> h; Comparison<T> c; public T Peek => h[0]; public int Count => h.Count; [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(int cap, Comparison<T> c, bool asc = true) { h = new List<T>(cap); this.c = asc ? c : (x, y) => c(y, x); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(Comparison<T> c, bool asc = true) { h = new List<T>(); this.c = asc ? c : (x, y) => c(y, x); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) {} [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) {} [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Push(T v) { var i = h.Count; h.Add(v); while (i > 0) { var ni = (i - 1) / 2; if (c(v, h[ni]) >= 0) break; h[i] = h[ni]; i = ni; } h[i] = v; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public T Pop() { var r = h[0]; var v = h[h.Count - 1]; h.RemoveAt(h.Count - 1); if (h.Count == 0) return r; var i = 0; while (i * 2 + 1 < h.Count) { var i1 = i * 2 + 1; var i2 = i * 2 + 2; if (i2 < h.Count && c(h[i1], h[i2]) > 0) i1 = i2; if (c(v, h[i1]) <= 0) break; h[i] = h[i1]; i = i1; } h[i] = v; return r; } } class PQ<TK, TV> where TK : IComparable { PQ<Tuple<TK, TV>> q; public Tuple<TK, TV> Peek => q.Peek; public int Count => q.Count; [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(int cap, Comparison<TK> c, bool asc = true) { q = new PQ<Tuple<TK, TV>>(cap, (x, y) => c(x.Item1, y.Item1), asc); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(Comparison<TK> c, bool asc = true) { q = new PQ<Tuple<TK, TV>>((x, y) => c(x.Item1, y.Item1), asc); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(int cap, bool asc = true) : this(cap, (x, y) => x.CompareTo(y), asc) {} [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(bool asc = true) : this((x, y) => x.CompareTo(y), asc) {} [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Push(TK k, TV v) => q.Push(Tuple.Create(k, v)); [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<TK, TV> Pop() => q.Pop(); } public class UF { long[] d; [MethodImpl(MethodImplOptions.AggressiveInlining)] public UF(long s) { d = Repeat(-1L, s).ToArray(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Unite(long x, long y) { x = Root(x); y = Root(y); if (x != y) { if (d[y] < d[x]) { var t = y; y = x; x = t; } d[x] += d[y]; d[y] = x; } return x != y; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool IsSame(long x, long y) => Root(x) == Root(y); [MethodImpl(MethodImplOptions.AggressiveInlining)] public long Root(long x) => d[x] < 0 ? x : d[x] = Root(d[x]); [MethodImpl(MethodImplOptions.AggressiveInlining)] public long Count(long x) => -d[Root(d[x])]; } struct Mod : IEquatable<object> { static public long _mod = 1000000007; long _val; [MethodImpl(MethodImplOptions.AggressiveInlining)] public Mod(long x) { if (x < _mod && x >= 0) _val = x; else if ((_val = x % _mod) < 0) _val += _mod; } static public implicit operator Mod(long x) => new Mod(x); [MethodImpl(MethodImplOptions.AggressiveInlining)] static public implicit operator long(Mod x) => x._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod operator +(Mod x, Mod y) => x._val + y._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod operator -(Mod x, Mod y) => x._val - y._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod operator *(Mod x, Mod y) => x._val * y._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod operator /(Mod x, Mod y) => x._val * Inverse(y._val); [MethodImpl(MethodImplOptions.AggressiveInlining)] static public bool operator ==(Mod x, Mod y) => x._val == y._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public bool operator !=(Mod x, Mod y) => x._val != y._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] static public long Inverse(long x) { long b = _mod, r = 1, u = 0, t = 0; while (b > 0) { var q = x / b; t = u; u = r - q * u; r = t; t = b; b = x - q * b; x = t; } return r < 0 ? r + _mod : r; } [MethodImpl(MethodImplOptions.AggressiveInlining)] bool IEquatable<object>.Equals(object obj) => obj == null ? false : Equals((Mod)obj); [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object obj) => obj == null ? false : Equals((Mod)obj); [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Equals(Mod obj) => obj == null ? false : _val == obj._val; [MethodImpl(MethodImplOptions.AggressiveInlining)] public override int GetHashCode() => _val.GetHashCode(); [MethodImpl(MethodImplOptions.AggressiveInlining)] public override string ToString() => _val.ToString(); static List<Mod> _fact = new List<Mod>() { 1 }; [MethodImpl(MethodImplOptions.AggressiveInlining)] static void B(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod Comb(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mod Perm(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)]; } } struct Mat<T> { T[,] m; [MethodImpl(MethodImplOptions.AggressiveInlining)] public Mat(T[,] v) { m = (T[,])v.Clone(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public implicit operator Mat<T>(T[,] v) => new Mat<T>(v); public T this[int r, int c] { get { return m[r, c]; } set { m[r, c] = value; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator +(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)x; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator +(Mat<T> a, Mat<T> b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] += (dynamic)b[r, c]; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator -(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)x; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator -(Mat<T> a, Mat<T> b) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] -= (dynamic)b[r, c]; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator *(Mat<T> a, T x) { var tm = (T[,])a.m.Clone(); for (int r = 0; r < tm.GetLength(0); ++r) for (int c = 0; c < tm.GetLength(1); ++c) tm[r, c] *= (dynamic)x; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> operator *(Mat<T> a, Mat<T> b) { var nr = a.m.GetLength(0); var nc = b.m.GetLength(1); var tm = new T[nr, nc]; for (int i = 0; i < nr; ++i) for (int j = 0; j < nc; ++j) tm[i, j] = (dynamic)0; for (int r = 0; r < nr; ++r) for (int c = 0; c < nc; ++c) for (int i = 0; i < a.m.GetLength(1); ++i) tm[r, c] += a[r, i] * (dynamic)b[i, c]; return tm; } [MethodImpl(MethodImplOptions.AggressiveInlining)] static public Mat<T> Pow(Mat<T> x, long y) { var n = x.m.GetLength(0); var t = (Mat<T>)new T[n, n]; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) t[i, j] = (dynamic)(i == j ? 1 : 0); while (y != 0) { if ((y & 1) == 1) t *= x; x *= x; y >>= 1; } return t; } } class Tree { long N; int l; List<long>[] p; int[] d; long[][] pr; long r; Tuple<long, long, int>[] e; Tuple<long, long>[] b; bool lca; bool euler; bool bfs; [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tree(List<long>[] p_, long r_) { N = p_.Length; p = p_; r = r_; lca = false; euler = false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<long, long>[] FromRoot() { if (!bfs) { var nb = new List<Tuple<long, long>>(); var q = new Queue<long>(); var d = new bool[N]; nb.Add(Tuple.Create(r, -1L)); d[r] = true; q.Enqueue(r); while (q.Count > 0) { var w = q.Dequeue(); foreach (var i in p[w]) { if (d[i]) continue; d[i] = true; q.Enqueue(i); nb.Add(Tuple.Create(i, w)); } } b = nb.ToArray(); bfs = true; } return b; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<long, long>[] FromLeaf() => FromRoot().Reverse().ToArray(); [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<long, long, int>[] Euler() { if (!euler) { var ne = new List<Tuple<long, long, int>>(); var s = new Stack<Tuple<long, long>>(); var d = new bool[N]; d[r] = true; s.Push(Tuple.Create(r, -1L)); while (s.Count > 0) { var w = s.Peek(); var ad = true; foreach (var i in p[w.Item1]) { if (d[i]) continue; d[i] = true; ad = false; s.Push(Tuple.Create(i, w.Item1)); } if (!ad || p[w.Item1].Count == 1) ne.Add(Tuple.Create(w.Item1, w.Item2, 1)); if (ad) { s.Pop(); ne.Add(Tuple.Create(w.Item1, w.Item2, -1)); } } e = ne.ToArray(); euler = true; } return e; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public long LCA(long u, long v) { if (!lca) { l = 0; while (N > (1 << l)) l++; d = new int[N]; pr = Repeat(0, l).Select(_ => new long[N]).ToArray(); d[r] = 0; pr[0][r] = -1; var q = new Stack<long>(); q.Push(r); while (q.Count > 0) { var w = q.Pop(); foreach (var i in p[w]) { if (i == pr[0][w]) continue; q.Push(i); d[i] = d[w] + 1; pr[0][i] = w; } } for (var k = 0; k + 1 < l; k++) for (var w = 0; w < N; w++) if (pr[k][w] < 0) pr[k + 1][w] = -1; else pr[k + 1][w] = pr[k][pr[k][w]]; lca = true; } if (d[u] > d[v]) { var t = u; u = v; v = t; } for (var k = 0; k < l; k++) if ((((d[v] - d[u]) >> k) & 1) != 0) v = pr[k][v]; if (u == v) return u; for (var k = l - 1; k >= 0; k--) if (pr[k][u] != pr[k][v]) { u = pr[k][u]; v = pr[k][v]; } return pr[0][u]; } } class BT<T> where T : IComparable { class Node { public Node l; public Node r; public T v; public bool b; } Comparison<T> c; Node r; bool ch; T lm; [MethodImpl(MethodImplOptions.AggressiveInlining)] public BT(Comparison<T> _c) { c = _c; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public BT() : this((x, y) => x.CompareTo(y)) {} [MethodImpl(MethodImplOptions.AggressiveInlining)] bool R(Node n) => n != null && !n.b; [MethodImpl(MethodImplOptions.AggressiveInlining)] bool B(Node n) => n != null && n.b; [MethodImpl(MethodImplOptions.AggressiveInlining)] Node RtL(Node n) { Node m = n.r, t = m.l; m.l = n; n.r = t; return m; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node RtR(Node n) { Node m = n.l, t = m.r; m.r = n; n.l = t; return m; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node RtLR(Node n) { n.l = RtL(n.l); return RtR(n); } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node RtRL(Node n) { n.r = RtR(n.r); return RtL(n); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Add(T x) { r = A(r, x); r.b = true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node A(Node n, T x) { if (n == null) { ch = true; return new Node() { v = x }; } if (c(x, n.v) < 0) n.l = A(n.l, x); else n.r = A(n.r, x); return Bl(n); } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node Bl(Node n) { if (!ch) return n; if (!B(n)) return n; if (R(n.l) && R(n.l.l)) { n = RtR(n); n.l.b = true; } else if (R(n.l) && R(n.l.r)) { n = RtLR(n); n.l.b = true; } else if (R(n.r) && R(n.r.l)) { n = RtRL(n); n.r.b = true; } else if (R(n.r) && R(n.r.r)) { n = RtL(n); n.r.b = true; } else ch = false; return n; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Remove(T x) { r = Rm(r, x); if (r != null) r.b = true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node Rm(Node n, T x) { if (n == null) { ch = false; return n; } var r = c(x, n.v); if (r < 0) { n.l = Rm(n.l, x); return BlL(n); } if (r > 0) { n.r = Rm(n.r, x); return BlR(n); } if (n.l == null) { ch = n.b; return n.r; } n.l = RmM(n.l); n.v = lm; return BlL(n); } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node RmM(Node n) { if (n.r != null) { n.r = RmM(n.r); return BlR(n); } lm = n.v; ch = n.b; return n.l; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node BlL(Node n) { if (!ch) return n; if (B(n.r) && R(n.r.l)) { var b = n.b; n = RtRL(n); n.b = b; n.l.b = true; ch = false; } else if (B(n.r) && R(n.r.r)) { var b = n.b; n = RtL(n); n.b = b; n.r.b = true; n.l.b = true; ch = false; } else if (B(n.r)) { ch = n.b; n.b = true; n.r.b = false; } else { n = RtL(n); n.b = true; n.l.b = false; n.l = BlL(n.l); ch = false; } return n; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Node BlR(Node n) { if (!ch) return n; if (B(n.l) && R(n.l.r)) { var b = n.b; n = RtLR(n); n.b = b; n.r.b = true; ch = false; } else if (B(n.l) && R(n.l.l)) { var b = n.b; n = RtR(n); n.b = b; n.l.b = true; n.r.b = true; ch = false; } else if (B(n.l)) { ch = n.b; n.b = true; n.l.b = false; } else { n = RtR(n); n.b = true; n.r.b = false; n.r = BlR(n.r); ch = false; } return n; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Have(T x) { var t = FindUpper(x); return t.Item1 && t.Item2.CompareTo(x) == 0; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<bool, T> FindUpper(T x) { var v = FU(r, x); return v == null ? Tuple.Create(false, default(T)) : v; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Tuple<bool, T> FU(Node n, T x) { if (n == null) return null; var r = c(x, n.v); if (r < 0) { var v = FU(n.l, x); return v == null ? Tuple.Create(true, n.v) : v; } if (r > 0) return FU(n.r, x); return Tuple.Create(true, n.v); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<bool, T> FindLower(T x) { var v = FL(r, x); return v == null ? Tuple.Create(false, default(T)) : v; } [MethodImpl(MethodImplOptions.AggressiveInlining)] Tuple<bool, T> FL(Node n, T x) { if (n == null) return null; var r = c(x, n.v); if (r < 0) return FL(n.l, x); if (r > 0) { var v = FL(n.r, x); return v == null ? Tuple.Create(true, n.v) : v; } return Tuple.Create(true, n.v); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public T Min() { Node n = r, p = null; while (n != null) { p = n; n = n.l; } return p == null ? default(T) : p.v; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public T Max() { Node n = r, p = null; while (n != null) { p = n; n = n.r; } return p == null ? default(T) : p.v; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Any() => r != null; [MethodImpl(MethodImplOptions.AggressiveInlining)] public int CountSlow() => L(r).Count(); [MethodImpl(MethodImplOptions.AggressiveInlining)] public IEnumerable<T> List() => L(r); [MethodImpl(MethodImplOptions.AggressiveInlining)] IEnumerable<T> L(Node n) { if (n == null) yield break; foreach (var i in L(n.l)) yield return i; yield return n.v; foreach (var i in L(n.r)) yield return i; } } } }
[["-", 0, 57, 15, 16, 12, 16, 31, 16, 31, 203], ["-", 0, 57, 15, 16, 12, 16, 31, 16, 17, 48], ["-", 0, 57, 15, 16, 12, 16, 12, 16, 31, 203], ["-", 0, 57, 15, 16, 12, 16, 12, 16, 17, 48]]
8
6,928
4
using System; namespace abc91_a { class Program { static void Main(string[] args) { string[] array = Console.ReadLine().Split(' '); int[] inputs = new int[array.Length]; for (int i = 0; i < array.Length; i++) { inputs[i] = int.Parse(array[i]); } if (inputs[0] + (2 * inputs[1]) >= inputs[2]) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; namespace abc91_a { class Program { static void Main(string[] args) { string[] array = Console.ReadLine().Split(' '); int[] inputs = new int[array.Length]; for (int i = 0; i < array.Length; i++) { inputs[i] = int.Parse(array[i]); } if (inputs[0] + inputs[1] >= inputs[2]) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
[["-", 0, 57, 15, 16, 31, 16, 12, 23, 0, 24], ["-", 15, 16, 31, 16, 12, 23, 0, 16, 31, 203], ["-", 15, 16, 31, 16, 12, 23, 0, 16, 17, 48], ["-", 0, 57, 15, 16, 31, 16, 12, 23, 0, 25]]
8
130
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Collections; static class Extensions { public static int ToInt(this string s) => int.Parse(s); public static long ToLong(this string s) => long.Parse(s); public static char ToChar(this string s) => char.Parse(s); public static double ToDouble(this string s) => double.Parse(s); public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray(); public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray(); public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray(); } class Program { static void Main() { var abc = Console.ReadLine().ToIntArray(); if (abc[0] + abc[1] * 2 >= abc[2]) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Collections; static class Extensions { public static int ToInt(this string s) => int.Parse(s); public static long ToLong(this string s) => long.Parse(s); public static char ToChar(this string s) => char.Parse(s); public static double ToDouble(this string s) => double.Parse(s); public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray(); public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray(); public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray(); } class Program { static void Main() { var abc = Console.ReadLine().ToIntArray(); if (abc[0] + abc[1] >= abc[2]) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } }
[["-", 0, 57, 15, 16, 31, 16, 12, 16, 17, 48], ["-", 0, 57, 15, 16, 31, 16, 12, 16, 12, 203]]
8
319
2
using System; using System.Collections; using System.Text; class Program { static void Main(string[] args) { #if LOCAL_ENVIRONMENT var stdin = new System.IO.StreamReader("stdin.txt"); System.Console.SetIn(stdin); #endif SimpleScanner sc = new SimpleScanner(); int A = sc.NextInt(), B = sc.NextInt(), C = sc.NextInt(); Console.WriteLine(A + B > C ? "Yes" : "No"); } // Main public class SimpleScanner { private int cnt; private string[] items; public SimpleScanner() { this.cnt = 0; var sb = new StringBuilder(); var s = Console.ReadLine(); while (s != null) { sb.Append(s + " "); s = Console.ReadLine(); } this.items = sb.ToString().Split(' '); #if LOCAL_ENVIRONMENT Console.Error.WriteLine("SimpleScanner.items: {0}", this.items.ToStringA()); #endif } public void SetCnt(int n) { this.cnt = n; } public int NextInt() { return int.Parse(this.items[this.cnt++]); } public long NextLong() { return long.Parse(this.items[this.cnt++]); } public string NextString() { return this.items[this.cnt++]; } public int[] NextIntArray(int n) { if (n < 1) throw new IndexOutOfRangeException("引数は1以上であること!"); var result = new int[n]; for (var i = 0; i < n; i++) result[i] = this.NextInt(); #if LOCAL_ENVIRONMENT Console.Error.WriteLine("{0}", result.ToStringA()); #endif return result; } public long[] NextLongArray(int n) { if (n < 1) throw new IndexOutOfRangeException("引数は1以上であること!"); var result = new long[n]; for (var i = 0; i < n; i++) result[i] = this.NextLong(); #if LOCAL_ENVIRONMENT Console.Error.WriteLine("{0}", result.ToStringA()); #endif return result; } public string[] NextStringArray(int n) { if (n < 1) throw new IndexOutOfRangeException("引数は1以上であること!"); var result = new string[n]; for (var i = 0; i < n; i++) result[i] = this.NextString(); #if LOCAL_ENVIRONMENT Console.Error.WriteLine("{0}", result.ToStringA()); #endif return result; } public int[][] NextInt2Col(int n) { const int M = 2; if (n < 1) throw new IndexOutOfRangeException("引数は1以上であること!"); int[][] result = new int [M][] { new int[n], new int[n], }; for (var i = 0; i < n; i++) { result[0][i] = this.NextInt(); result[1][i] = this.NextInt(); } #if LOCAL_ENVIRONMENT Console.Error.WriteLine("NextInt2Col: ["); for (var i = 0; i < M; i++) Console.Error.WriteLine(" {0},", result[i].ToStringA()); Console.Error.WriteLine("]"); #endif return result; } } }
using System; using System.Collections; using System.Text; class Program { static void Main(string[] args) { #if LOCAL_ENVIRONMENT var stdin = new System.IO.StreamReader("stdin.txt"); System.Console.SetIn(stdin); #endif SimpleScanner sc = new SimpleScanner(); int A = sc.NextInt(), B = sc.NextInt(), C = sc.NextInt(); Console.WriteLine(A + B >= C ? "Yes" : "No"); } // Main public class SimpleScanner { private int cnt; private string[] items; public SimpleScanner() { this.cnt = 0; var sb = new StringBuilder(); var s = Console.ReadLine(); while (s != null) { sb.Append(s + " "); s = Console.ReadLine(); } this.items = sb.ToString().Split(' '); #if LOCAL_ENVIRONMENT Console.Error.WriteLine("SimpleScanner.items: {0}", this.items.ToStringA()); #endif } public void SetCnt(int n) { this.cnt = n; } public int NextInt() { return int.Parse(this.items[this.cnt++]); } public long NextLong() { return long.Parse(this.items[this.cnt++]); } public string NextString() { return this.items[this.cnt++]; } public int[] NextIntArray(int n) { if (n < 1) throw new IndexOutOfRangeException("引数は1以上であること!"); var result = new int[n]; for (var i = 0; i < n; i++) result[i] = this.NextInt(); #if LOCAL_ENVIRONMENT Console.Error.WriteLine("{0}", result.ToStringA()); #endif return result; } public long[] NextLongArray(int n) { if (n < 1) throw new IndexOutOfRangeException("引数は1以上であること!"); var result = new long[n]; for (var i = 0; i < n; i++) result[i] = this.NextLong(); #if LOCAL_ENVIRONMENT Console.Error.WriteLine("{0}", result.ToStringA()); #endif return result; } public string[] NextStringArray(int n) { if (n < 1) throw new IndexOutOfRangeException("引数は1以上であること!"); var result = new string[n]; for (var i = 0; i < n; i++) result[i] = this.NextString(); #if LOCAL_ENVIRONMENT Console.Error.WriteLine("{0}", result.ToStringA()); #endif return result; } public int[][] NextInt2Col(int n) { const int M = 2; if (n < 1) throw new IndexOutOfRangeException("引数は1以上であること!"); int[][] result = new int [M][] { new int[n], new int[n], }; for (var i = 0; i < n; i++) { result[0][i] = this.NextInt(); result[1][i] = this.NextInt(); } #if LOCAL_ENVIRONMENT Console.Error.WriteLine("NextInt2Col: ["); for (var i = 0; i < M; i++) Console.Error.WriteLine(" {0},", result[i].ToStringA()); Console.Error.WriteLine("]"); #endif return result; } } }
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 47], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 20]]
8
727
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using static System.Console; using static System.Math; namespace At { class Program { static void Main(string[] args) { var input = ReadInts(); if (input[2] < input[0] + input[1]) WriteLine("Yes"); else WriteLine("No"); } private static string Read() { return ReadLine(); } private static string[] Reads() { return (Read().Split()); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using static System.Console; using static System.Math; namespace At { class Program { static void Main(string[] args) { var input = ReadInts(); if (input[2] <= input[0] + input[1]) WriteLine("Yes"); else WriteLine("No"); } private static string Read() { return ReadLine(); } private static string[] Reads() { return (Read().Split()); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
8
262
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { var imp = Console.ReadLine().Split(' '); if (int.Parse(imp[0]) + int.Parse(imp[1]) > int.Parse(imp[2])) { Console.Write("Yes"); } else { Console.Write("No"); } // System.Threading.Thread.Sleep(1000); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { var imp = Console.ReadLine().Split(' '); if (int.Parse(imp[0]) + int.Parse(imp[1]) >= int.Parse(imp[2])) { Console.Write("Yes"); } else { Console.Write("No"); } // System.Threading.Thread.Sleep(1000); } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20]]
8
118
2
using System; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; class Program { static void Main() { //入力 // int n = 100; /* long n = long.Parse(Console.ReadLine()); long[] input = new long[5]; for(int a = 0; a < 5; a++) { input[a]=long.Parse(Console.ReadLine()); } */ int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray(); Console.WriteLine(input[2] - input[1] - input[0] >= 0 ? "Yes" : "No"); /* //処理速度計測 var sw = new System.Diagnostics.Stopwatch(); sw.Start(); //解法 //処理速度表示 sw.Stop(); TimeSpan ts = sw.Elapsed; Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms"); */ Console.ReadLine(); } }
using System; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; class Program { static void Main() { //入力 // int n = 100; /* long n = long.Parse(Console.ReadLine()); long[] input = new long[5]; for(int a = 0; a < 5; a++) { input[a]=long.Parse(Console.ReadLine()); } */ int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray(); Console.WriteLine(input[2] - input[1] - input[0] <= 0 ? "Yes" : "No"); /* //処理速度計測 var sw = new System.Diagnostics.Stopwatch(); sw.Start(); //解法 //処理速度表示 sw.Stop(); TimeSpan ts = sw.Elapsed; Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms"); */ Console.ReadLine(); } }
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 20], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19]]
8
108
2
using System; class Program { static void Main(string[] args) { var s = Console.ReadLine().Split(' '); var a = int.Parse(s[0]); var b = int.Parse(s[1]); var c = int.Parse(s[2]); if (a + b <= c) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } }
using System; class Program { static void Main(string[] args) { var s = Console.ReadLine().Split(' '); var a = int.Parse(s[0]); var b = int.Parse(s[1]); var c = int.Parse(s[2]); if (c <= a + b) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } }
[["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 12, 22]]
8
104
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Practice { class Program { static void Main(string[] args) { Solve(); } private const long MOD = 1000000007; static void Solve() { var o = ReadAndParseIntArr(); int a = o[0]; int b = o[1]; int c = o[2]; string ans = a + b * 2 >= c ? "Yes" : "No"; Console.WriteLine(ans); } #region よく使う便利関数 private static bool isPrime(long x) { if (x == 2) { return true; } if (x < 2 || x % 2 == 0) { return false; } long i = 3; while (i * i <= x) { if (x % i == 0) { return false; } i = i + 2; } return true; } private static long lcm(long x, long y) { return x / gcd(x, y) * y; } private static long gcd(long x, long y) { return y > 0 ? gcd(y, x % y) : x; } private static long pow(long x, long n) { if (n == 0) { return 1; } long res = pow(x * x % MOD, n / 2); if (n % 2 == 1) { res = res * x % MOD; } return res; } private static int ReadAndParseInt() { return int.Parse(Console.ReadLine()); } private static int[] ReadAndParseIntArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); } private static long ReadAndParseLong() { return long.Parse(Console.ReadLine()); } private static long[] ReadAndParseLongArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse); } #endregion } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Practice { class Program { static void Main(string[] args) { Solve(); } private const long MOD = 1000000007; static void Solve() { var o = ReadAndParseIntArr(); int a = o[0]; int b = o[1]; int c = o[2]; string ans = (a + b) >= c ? "Yes" : "No"; Console.WriteLine(ans); } #region よく使う便利関数 private static bool isPrime(long x) { if (x == 2) { return true; } if (x < 2 || x % 2 == 0) { return false; } long i = 3; while (i * i <= x) { if (x % i == 0) { return false; } i = i + 2; } return true; } private static long lcm(long x, long y) { return x / gcd(x, y) * y; } private static long gcd(long x, long y) { return y > 0 ? gcd(y, x % y) : x; } private static long pow(long x, long n) { if (n == 0) { return 1; } long res = pow(x * x % MOD, n / 2); if (n % 2 == 1) { res = res * x % MOD; } return res; } private static int ReadAndParseInt() { return int.Parse(Console.ReadLine()); } private static int[] ReadAndParseIntArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); } private static long ReadAndParseLong() { return long.Parse(Console.ReadLine()); } private static long[] ReadAndParseLongArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse); } #endregion } }
[["+", 0, 212, 0, 41, 15, 16, 31, 23, 0, 24], ["-", 0, 41, 15, 16, 31, 16, 12, 16, 17, 48], ["-", 0, 41, 15, 16, 31, 16, 12, 16, 12, 203], ["+", 0, 212, 0, 41, 15, 16, 31, 23, 0, 25]]
8
415
4
using System; using System.Collections; using System.Collections.Generic; using System.Dynamic; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection.Emit; using System.Runtime.Remoting.Proxies; using System.Text; using static System.Console; using static System.Math; using static Ex; using static ArrayEx; class AC { /*------------------------------------------------------------------*/ int a, b, c; void Solve() { io.i(out a, out b, out c); io.Yn(a + b * 2 >= c); } /*------------------------------------------------------------------*/ void Test() { //--- TEST ---// } public static void Main(string[] args) => new AC().Stream(); IO io = new IO(); private void Stream() { /* var exStdIn = new System.IO.StreamReader("stdin.txt"); SetIn(exStdIn); Test(); */ Solve(); io.Flush(); } } #region OTHER class IO { #region INPUT private const int Size = 1 << 12; private readonly Stream _stream = OpenStandardInput(); private readonly byte[] _buffer = new byte[Size]; private int _ptr = 0, _buffLen = 0; private bool HasNextByte() { if (_ptr < _buffLen) return true; _ptr = 0; _buffLen = _stream.Read(_buffer, 0, Size); return _buffLen > 0; } private byte ReadByte() { if (HasNextByte()) return _buffer[_ptr++]; else // inputの末尾の改行がないとerror throw new EndOfStreamException(); } private bool IsAscii(int c) => '!' <= c && c <= '~'; private char NextChar() { byte b = 0; do b = ReadByte(); while (!IsAscii(b)); return (char)b; } private string Next() { var sb = new StringBuilder(); for (var b = NextChar(); IsAscii(b); b = (char)ReadByte()) sb.Append(b); return sb.ToString(); } private void Read<T>(out T v) => v = SuitType<T>(Next()); private bool TypeEqual<T, TU>() => typeof(T) == typeof(TU); private T SuitType<T>(string s) { if (TypeEqual<T, int>()) ConvertType<T, int>(int.Parse(s)); if (TypeEqual<T, long>()) ConvertType<T, long>(long.Parse(s)); if (TypeEqual<T, double>()) ConvertType<T, double>(double.Parse(s)); if (TypeEqual<T, char>()) ConvertType<T, char>(char.Parse(s)); return ConvertType<T, string>(s); } private T i<T>() => SuitType<T>(String); public string String => Next(); public char Char => NextChar(); public int Int => int.Parse(Next()); public long Long => long.Parse(Next()); public double Double => double.Parse(Next()); public void i<T>(out T v) => Read(out v); public void i<T, TU>(out T t, out TU u) { i(out t); i(out u); } public void i<T, TU, TV>(out T t, out TU u, out TV v) { i(out t, out u); i(out v); } public void i<T, TU, TV, TW>(out T t, out TU u, out TV v, out TW w) { i(out t, out u); i(out v, out w); } public void i<T, TU, TV, TW, TX>(out T t, out TU u, out TV v, out TW w, out TX x) { i(out t, out u, out v); i(out w, out x); } public void i<T, TU, TV, TW, TX, TY>(out T t, out TU u, out TV v, out TW w, out TX x, out TY y) { i(out t, out u, out v); i(out w, out x, out y); } public void ini<T>(out T[] a, int n) { a = new T[n]; for (int i = 0; i < n; ++i) a[i] = i<T>(); } public void ini<T, TU>(out T[] a, out TU[] b, int n) { a = new T[n]; b = new TU[n]; for (int i = 0; i < n; ++i) { a[i] = i<T>(); b[i] = i<TU>(); } } public void ini<T, TU, TV>(out T[] a, out TU[] b, out TV[] c, int n) { a = new T[n]; b = new TU[n]; c = new TV[n]; for (int i = 0; i < n; ++i) { a[i] = i<T>(); b[i] = i<TU>(); c[i] = i<TV>(); } } public void ini<T>(out T[,] a, int h, int w) { a = new T[h, w]; for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) a[i, j] = i<T>(); } #endregion #region OUTPUT private readonly StreamWriter _sw = new StreamWriter(OpenStandardOutput()) { #if DEBUG AutoFlush = true #else AutoFlush = false #endif }; public void Flush() => Console.Out.Flush(); public void o(params Object[] xs) => Print(false, xs); public void o_(params Object[] xs) => Print(true, xs); private void Print(bool isOneLine, params object[] xs) { foreach (var x in xs) { if (x is int[]) PrintArr<int>(isOneLine, x); else if (x is long[]) PrintArr<int>(isOneLine, x); else if (x is double[]) PrintArr<int>(isOneLine, x); else if (x is char[]) PrintArr<int>(isOneLine, x); else if (x is string[]) PrintArr<int>(isOneLine, x); else if (x is bool[]) PrintArr<int>(isOneLine, x); else if (x is int[,]) PrintArr2D(ConvertType<int[,], object>(x)); else if (x is long[,]) PrintArr2D(ConvertType<long[,], object>(x)); else if (x is double[,]) PrintArr2D(ConvertType<double[,], object>(x)); else if (x is char[,]) PrintArr2D(ConvertType<char[,], object>(x)); else if (x is string[,]) PrintArr2D(ConvertType<string[,], object>(x)); else if (x is bool[,]) PrintArr2D(ConvertType<bool[,], object>(x)); else WriteLine(x); } } private void PrintArr2D<T>(T[,] a) { int a0 = a.GetLength(0), a1 = a.GetLength(1); for (int i = 0; i < a0; ++i) { for (int j = 0; j < a1 - 1; ++j) Write(a[i, j] + " "); WriteLine(a[i, a1 - 1]); } } private void PrintArr<T>(bool isOneLine, object xs) { if (isOneLine) PrintArr1D_(ConvertType<T[], object>(xs)); else PrintArr1D(ConvertType<T[], object>(xs)); } private void PrintArr1D<T>(T[] xs) { foreach (var x in xs) WriteLine(x); } private void PrintArr1D_<T>(T[] xs) => WriteLine(string.Join(" ", xs)); public void YN(bool f) => WriteLine(f ? "YES" : "NO"); public void Yn(bool f) => WriteLine(f ? "Yes" : "No"); public void yn(bool f) => WriteLine(f ? "yes" : "no"); #endregion private T ConvertType<T, TU>(TU v) => (T)Convert.ChangeType(v, typeof(T)); public IO() { SetOut(_sw); } } static class Ex { public static void REP(int a, Action<int> act) => FOR(0, a, act); public static void FOR(int a, int b, Action<int> act) => FOR(a, b, 1, act); public static void FOR(int a, int b, int n, Action<int> act) { for (int i = a; i < b; i += n) act(i); } public static void REPEQ(int a, Action<int> act) => FOR(0, a + 1, act); public static void FOREQ(int a, int b, Action<int> act) => FOR(a, b + 1, act); public static void FOREQ(int a, int b, int n, Action<int> act) => FOR(a, b + 1, n, act); public static T MIN<T>(params T[] a) => a.Min(); public static T MAX<T>(params T[] a) => a.Max(); } static class NumEx { public static string toString(this double d) => d.ToString("R"); public static string Pad0<T>(this T s, int n) => s.ToString().PadLeft(n, '0'); public static int RoundOff(this double v, int n) => (int) Round(v, n - 1, MidpointRounding.AwayFromZero); public static int RoundUp(this double v) => (int)Ceiling(v); public static int RoundDown(this double v) => (int)Floor(v); public static bool Odd(this int v) => (v & 1) != 0; public static bool Odd(this long v) => (v & 1) != 0; } static class ArrayEx { public static void SET<T>(this T[] a, T v) { for (int i = 0; i < a.Length; ++i) a[i] = v; } public static void SET<T>(this T[,] a, T v) { for (int i = 0; i < a.GetLength(0); ++i) for (int j = 0; j < a.GetLength(1); ++j) a[i, j] = v; } public static void ITER<T>(this IEnumerable<T> xs, Action<T> act) { foreach (var x in xs) act(x); } } #endregion
using System; using System.Collections; using System.Collections.Generic; using System.Dynamic; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection.Emit; using System.Runtime.Remoting.Proxies; using System.Text; using static System.Console; using static System.Math; using static Ex; using static ArrayEx; class AC { /*------------------------------------------------------------------*/ int a, b, c; void Solve() { io.i(out a, out b, out c); io.Yn(a + b >= c); } /*------------------------------------------------------------------*/ void Test() { //--- TEST ---// } public static void Main(string[] args) => new AC().Stream(); IO io = new IO(); private void Stream() { /* var exStdIn = new System.IO.StreamReader("stdin.txt"); SetIn(exStdIn); Test(); */ Solve(); io.Flush(); } } #region OTHER class IO { #region INPUT private const int Size = 1 << 12; private readonly Stream _stream = OpenStandardInput(); private readonly byte[] _buffer = new byte[Size]; private int _ptr = 0, _buffLen = 0; private bool HasNextByte() { if (_ptr < _buffLen) return true; _ptr = 0; _buffLen = _stream.Read(_buffer, 0, Size); return _buffLen > 0; } private byte ReadByte() { if (HasNextByte()) return _buffer[_ptr++]; else // inputの末尾の改行がないとerror throw new EndOfStreamException(); } private bool IsAscii(int c) => '!' <= c && c <= '~'; private char NextChar() { byte b = 0; do b = ReadByte(); while (!IsAscii(b)); return (char)b; } private string Next() { var sb = new StringBuilder(); for (var b = NextChar(); IsAscii(b); b = (char)ReadByte()) sb.Append(b); return sb.ToString(); } private void Read<T>(out T v) => v = SuitType<T>(Next()); private bool TypeEqual<T, TU>() => typeof(T) == typeof(TU); private T SuitType<T>(string s) { if (TypeEqual<T, int>()) ConvertType<T, int>(int.Parse(s)); if (TypeEqual<T, long>()) ConvertType<T, long>(long.Parse(s)); if (TypeEqual<T, double>()) ConvertType<T, double>(double.Parse(s)); if (TypeEqual<T, char>()) ConvertType<T, char>(char.Parse(s)); return ConvertType<T, string>(s); } private T i<T>() => SuitType<T>(String); public string String => Next(); public char Char => NextChar(); public int Int => int.Parse(Next()); public long Long => long.Parse(Next()); public double Double => double.Parse(Next()); public void i<T>(out T v) => Read(out v); public void i<T, TU>(out T t, out TU u) { i(out t); i(out u); } public void i<T, TU, TV>(out T t, out TU u, out TV v) { i(out t, out u); i(out v); } public void i<T, TU, TV, TW>(out T t, out TU u, out TV v, out TW w) { i(out t, out u); i(out v, out w); } public void i<T, TU, TV, TW, TX>(out T t, out TU u, out TV v, out TW w, out TX x) { i(out t, out u, out v); i(out w, out x); } public void i<T, TU, TV, TW, TX, TY>(out T t, out TU u, out TV v, out TW w, out TX x, out TY y) { i(out t, out u, out v); i(out w, out x, out y); } public void ini<T>(out T[] a, int n) { a = new T[n]; for (int i = 0; i < n; ++i) a[i] = i<T>(); } public void ini<T, TU>(out T[] a, out TU[] b, int n) { a = new T[n]; b = new TU[n]; for (int i = 0; i < n; ++i) { a[i] = i<T>(); b[i] = i<TU>(); } } public void ini<T, TU, TV>(out T[] a, out TU[] b, out TV[] c, int n) { a = new T[n]; b = new TU[n]; c = new TV[n]; for (int i = 0; i < n; ++i) { a[i] = i<T>(); b[i] = i<TU>(); c[i] = i<TV>(); } } public void ini<T>(out T[,] a, int h, int w) { a = new T[h, w]; for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) a[i, j] = i<T>(); } #endregion #region OUTPUT private readonly StreamWriter _sw = new StreamWriter(OpenStandardOutput()) { #if DEBUG AutoFlush = true #else AutoFlush = false #endif }; public void Flush() => Console.Out.Flush(); public void o(params Object[] xs) => Print(false, xs); public void o_(params Object[] xs) => Print(true, xs); private void Print(bool isOneLine, params object[] xs) { foreach (var x in xs) { if (x is int[]) PrintArr<int>(isOneLine, x); else if (x is long[]) PrintArr<int>(isOneLine, x); else if (x is double[]) PrintArr<int>(isOneLine, x); else if (x is char[]) PrintArr<int>(isOneLine, x); else if (x is string[]) PrintArr<int>(isOneLine, x); else if (x is bool[]) PrintArr<int>(isOneLine, x); else if (x is int[,]) PrintArr2D(ConvertType<int[,], object>(x)); else if (x is long[,]) PrintArr2D(ConvertType<long[,], object>(x)); else if (x is double[,]) PrintArr2D(ConvertType<double[,], object>(x)); else if (x is char[,]) PrintArr2D(ConvertType<char[,], object>(x)); else if (x is string[,]) PrintArr2D(ConvertType<string[,], object>(x)); else if (x is bool[,]) PrintArr2D(ConvertType<bool[,], object>(x)); else WriteLine(x); } } private void PrintArr2D<T>(T[,] a) { int a0 = a.GetLength(0), a1 = a.GetLength(1); for (int i = 0; i < a0; ++i) { for (int j = 0; j < a1 - 1; ++j) Write(a[i, j] + " "); WriteLine(a[i, a1 - 1]); } } private void PrintArr<T>(bool isOneLine, object xs) { if (isOneLine) PrintArr1D_(ConvertType<T[], object>(xs)); else PrintArr1D(ConvertType<T[], object>(xs)); } private void PrintArr1D<T>(T[] xs) { foreach (var x in xs) WriteLine(x); } private void PrintArr1D_<T>(T[] xs) => WriteLine(string.Join(" ", xs)); public void YN(bool f) => WriteLine(f ? "YES" : "NO"); public void Yn(bool f) => WriteLine(f ? "Yes" : "No"); public void yn(bool f) => WriteLine(f ? "yes" : "no"); #endregion private T ConvertType<T, TU>(TU v) => (T)Convert.ChangeType(v, typeof(T)); public IO() { SetOut(_sw); } } static class Ex { public static void REP(int a, Action<int> act) => FOR(0, a, act); public static void FOR(int a, int b, Action<int> act) => FOR(a, b, 1, act); public static void FOR(int a, int b, int n, Action<int> act) { for (int i = a; i < b; i += n) act(i); } public static void REPEQ(int a, Action<int> act) => FOR(0, a + 1, act); public static void FOREQ(int a, int b, Action<int> act) => FOR(a, b + 1, act); public static void FOREQ(int a, int b, int n, Action<int> act) => FOR(a, b + 1, n, act); public static T MIN<T>(params T[] a) => a.Min(); public static T MAX<T>(params T[] a) => a.Max(); } static class NumEx { public static string toString(this double d) => d.ToString("R"); public static string Pad0<T>(this T s, int n) => s.ToString().PadLeft(n, '0'); public static int RoundOff(this double v, int n) => (int) Round(v, n - 1, MidpointRounding.AwayFromZero); public static int RoundUp(this double v) => (int)Ceiling(v); public static int RoundDown(this double v) => (int)Floor(v); public static bool Odd(this int v) => (v & 1) != 0; public static bool Odd(this long v) => (v & 1) != 0; } static class ArrayEx { public static void SET<T>(this T[] a, T v) { for (int i = 0; i < a.Length; ++i) a[i] = v; } public static void SET<T>(this T[,] a, T v) { for (int i = 0; i < a.GetLength(0); ++i) for (int j = 0; j < a.GetLength(1); ++j) a[i, j] = v; } public static void ITER<T>(this IEnumerable<T> xs, Action<T> act) { foreach (var x in xs) act(x); } } #endregion
[["-", 0, 28, 0, 16, 31, 16, 12, 16, 17, 48], ["-", 0, 28, 0, 16, 31, 16, 12, 16, 12, 203]]
8
2,444
2
using System; using System.Linq; namespace ABC091_A { class Program { static void Main(string[] args) { var n = Console.ReadLine().Split().Select(int.Parse).ToArray(); Console.WriteLine(n[0] + n[1] > n[2] ? "Yes" : "No"); } } }
using System; using System.Linq; namespace ABC091_A { class Program { static void Main(string[] args) { var n = Console.ReadLine().Split().Select(int.Parse).ToArray(); Console.WriteLine(n[0] + n[1] >= n[2] ? "Yes" : "No"); } } }
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 47], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 20]]
8
79
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; namespace VirtualAtCorder { class Program { static void Main(string[] args) { string[] inputs = Console.ReadLine().Split(' '); int aCoin = 0, bCoin = 0, price = 0; aCoin = int.Parse(inputs[0]); bCoin = int.Parse(inputs[0]); price = int.Parse(inputs[0]); string able = (aCoin + bCoin >= price) ? "Yes" : "No"; Console.WriteLine(able); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; namespace VirtualAtCorder { class Program { static void Main(string[] args) { string[] inputs = Console.ReadLine().Split(' '); int aCoin = 0, bCoin = 0, price = 0; aCoin = int.Parse(inputs[0]); bCoin = int.Parse(inputs[1]); price = int.Parse(inputs[2]); string able = (aCoin + bCoin >= price) ? "Yes" : "No"; Console.WriteLine(able); Console.ReadKey(); } } }
[["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203]]
8
150
4
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.CompilerServices; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; namespace ConsoleApp6 { class Program { static void Main(string[] args) { var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)); Console.WriteLine( input.ElementAt(0) + input.ElementAt(1) > input.ElementAt(2) ? "Yes" : "No"); } } }
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.CompilerServices; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; namespace ConsoleApp6 { class Program { static void Main(string[] args) { var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)); Console.WriteLine( input.ElementAt(0) + input.ElementAt(1) >= input.ElementAt(2) ? "Yes" : "No"); } } }
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 47], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 20]]
8
136
2
using System; class Program { static void Main(string[] args) { // 整数の入力 string[] input = Console.ReadLine().Split(' '); int b = int.Parse(input[0]); int c = int.Parse(input[1]); int a = int.Parse(input[2]); //出力 Console.WriteLine((b + c < a ? "No" : "yes")); Console.ReadLine(); } }
using System; class Program { static void Main(string[] args) { // 整数の入力 string[] input = Console.ReadLine().Split(' '); int b = int.Parse(input[0]); int c = int.Parse(input[1]); int a = int.Parse(input[2]); //出力 Console.WriteLine((b + c < a ? "No" : "Yes")); Console.ReadLine(); } }
[["-", 0, 28, 0, 23, 0, 41, 75, 5, 0, 222], ["+", 0, 28, 0, 23, 0, 41, 75, 5, 0, 222]]
8
104
2
using System; using System.Linq; using System.Collections.Generic; using System.Text; using System.Numerics; class Program { static void Main(string[] args) { var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); Console.WriteLine(a[0] + a[1] <= a[2] ? "Yes" : "No"); } }
using System; using System.Linq; using System.Collections.Generic; using System.Text; using System.Numerics; class Program { static void Main(string[] args) { var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); Console.WriteLine(a[0] + a[1] >= a[2] ? "Yes" : "No"); } }
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 20]]
8
97
2
using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Numerics; namespace FertiLib.Contest.B { static class Program { public static void Solve(Scanner cin) { var n = cin.ReadInt(); var s = cin.ReadStringArray(n); var m = cin.ReadInt(); var t = cin.ReadStringArray(m); int ans = 0; for (int i = 0; i < n; i++) { int tmp = 0; tmp += s.Count(x => x == s[i]); tmp -= s.Count(x => x == s[i]); Chmax(ref ans, tmp); } Console.WriteLine(ans); } public static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); var cin = new Scanner(); Solve(cin); Console.Out.Flush(); } public static void YESNO(bool condition) => Console.WriteLine(condition ? "YES" : "NO"); public static void YesNo(bool condition) => Console.WriteLine(condition ? "Yes" : "No"); public static void yesno(bool condition) => Console.WriteLine(condition ? "yes" : "no"); public static bool Chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) >= 0) return false; a = b; return true; } public static bool Chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) <= 0) return false; a = b; return true; } } static class Util { public static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x); } class Scanner { string[] s; int i; char[] separator = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string Read() => ReadString(); public string ReadString() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(separator, StringSplitOptions.RemoveEmptyEntries); if (s.Length == 0) return ReadString(); i = 0; return s[i++]; } public string[] ReadStringArray(int N) { string[] Array = new string[N]; for (int i = 0; i < N; i++) { Array[i] = ReadString(); } return Array; } public int ReadInt() { return int.Parse(ReadString()); } public int[] ReadIntArray(int N, int add = 0) { int[] Array = new int[N]; for (int i = 0; i < N; i++) { Array[i] = ReadInt() + add; } return Array; } public long ReadLong() { return long.Parse(ReadString()); } public long[] ReadLongArray(int N, long add = 0) { long[] Array = new long[N]; for (int i = 0; i < N; i++) { Array[i] = ReadLong() + add; } return Array; } public double ReadDouble() { return double.Parse(ReadString()); } public double[] ReadDoubleArray(int N, double add = 0) { double[] Array = new double[N]; for (int i = 0; i < N; i++) { Array[i] = ReadDouble() + add; } return Array; } public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(), typeof(T1)); public (T1, T2) ReadValue<T1, T2>() { var inputs = ReadStringArray(2); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); return (v1, v2); } public (T1, T2, T3) ReadValue<T1, T2, T3>() { var inputs = ReadStringArray(3); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); return (v1, v2, v3); } public (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>() { var inputs = ReadStringArray(4); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); return (v1, v2, v3, v4); } public (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>() { var inputs = ReadStringArray(5); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); return (v1, v2, v3, v4, v5); } public (T1, T2, T3, T4, T5, T6) ReadValue<T1, T2, T3, T4, T5, T6>() { var inputs = ReadStringArray(6); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); return (v1, v2, v3, v4, v5, v6); } public (T1, T2, T3, T4, T5, T6, T7) ReadValue<T1, T2, T3, T4, T5, T6, T7>() { var inputs = ReadStringArray(7); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7)); return (v1, v2, v3, v4, v5, v6, v7); } public T1[] ReadValueArray<T1>(int N) { var v1 = new T1[N]; for (int i = 0; i < N; i++) { v1[i] = ReadValue<T1>(); } return v1; } public (T1[], T2[]) ReadValueArray<T1, T2>(int N) { var (v1, v2) = (new T1[N], new T2[N]); for (int i = 0; i < N; i++) { var (t1, t2) = ReadValue<T1, T2>(); v1[i] = t1; v2[i] = t2; } return (v1, v2); } public (T1[], T2[], T3[]) ReadValueArray<T1, T2, T3>(int N) { var (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3) = ReadValue<T1, T2, T3>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; } return (v1, v2, v3); } public (T1[], T2[], T3[], T4[]) ReadValueArray<T1, T2, T3, T4>(int N) { var (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4) = ReadValue<T1, T2, T3, T4>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; } return (v1, v2, v3, v4); } public (T1[], T2[], T3[], T4[], T5[]) ReadValueArray<T1, T2, T3, T4, T5>(int N) { var (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5) = ReadValue<T1, T2, T3, T4, T5>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; } return (v1, v2, v3, v4, v5); } public (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray<T1, T2, T3, T4, T5, T6>(int N) { var (v1, v2, v3, v4, v5, v6) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6) = ReadValue<T1, T2, T3, T4, T5, T6>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; } return (v1, v2, v3, v4, v5, v6); } public (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray<T1, T2, T3, T4, T5, T6, T7>(int N) { var (v1, v2, v3, v4, v5, v6, v7) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N], new T7[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6, t7) = ReadValue<T1, T2, T3, T4, T5, T6, T7>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; v7[i] = t7; } return (v1, v2, v3, v4, v5, v6, v7); } } }
using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Numerics; namespace FertiLib.Contest.B { static class Program { public static void Solve(Scanner cin) { var n = cin.ReadInt(); var s = cin.ReadStringArray(n); var m = cin.ReadInt(); var t = cin.ReadStringArray(m); int ans = 0; for (int i = 0; i < n; i++) { int tmp = 0; tmp += s.Count(x => x == s[i]); tmp -= t.Count(x => x == s[i]); Chmax(ref ans, tmp); } Console.WriteLine(ans); } public static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); var cin = new Scanner(); Solve(cin); Console.Out.Flush(); } public static void YESNO(bool condition) => Console.WriteLine(condition ? "YES" : "NO"); public static void YesNo(bool condition) => Console.WriteLine(condition ? "Yes" : "No"); public static void yesno(bool condition) => Console.WriteLine(condition ? "yes" : "no"); public static bool Chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) >= 0) return false; a = b; return true; } public static bool Chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) <= 0) return false; a = b; return true; } } static class Util { public static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x); } class Scanner { string[] s; int i; char[] separator = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string Read() => ReadString(); public string ReadString() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(separator, StringSplitOptions.RemoveEmptyEntries); if (s.Length == 0) return ReadString(); i = 0; return s[i++]; } public string[] ReadStringArray(int N) { string[] Array = new string[N]; for (int i = 0; i < N; i++) { Array[i] = ReadString(); } return Array; } public int ReadInt() { return int.Parse(ReadString()); } public int[] ReadIntArray(int N, int add = 0) { int[] Array = new int[N]; for (int i = 0; i < N; i++) { Array[i] = ReadInt() + add; } return Array; } public long ReadLong() { return long.Parse(ReadString()); } public long[] ReadLongArray(int N, long add = 0) { long[] Array = new long[N]; for (int i = 0; i < N; i++) { Array[i] = ReadLong() + add; } return Array; } public double ReadDouble() { return double.Parse(ReadString()); } public double[] ReadDoubleArray(int N, double add = 0) { double[] Array = new double[N]; for (int i = 0; i < N; i++) { Array[i] = ReadDouble() + add; } return Array; } public T1 ReadValue<T1>() => (T1)Convert.ChangeType(ReadString(), typeof(T1)); public (T1, T2) ReadValue<T1, T2>() { var inputs = ReadStringArray(2); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); return (v1, v2); } public (T1, T2, T3) ReadValue<T1, T2, T3>() { var inputs = ReadStringArray(3); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); return (v1, v2, v3); } public (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>() { var inputs = ReadStringArray(4); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); return (v1, v2, v3, v4); } public (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>() { var inputs = ReadStringArray(5); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); return (v1, v2, v3, v4, v5); } public (T1, T2, T3, T4, T5, T6) ReadValue<T1, T2, T3, T4, T5, T6>() { var inputs = ReadStringArray(6); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); return (v1, v2, v3, v4, v5, v6); } public (T1, T2, T3, T4, T5, T6, T7) ReadValue<T1, T2, T3, T4, T5, T6, T7>() { var inputs = ReadStringArray(7); var v1 = (T1)Convert.ChangeType(inputs[0], typeof(T1)); var v2 = (T2)Convert.ChangeType(inputs[1], typeof(T2)); var v3 = (T3)Convert.ChangeType(inputs[2], typeof(T3)); var v4 = (T4)Convert.ChangeType(inputs[3], typeof(T4)); var v5 = (T5)Convert.ChangeType(inputs[4], typeof(T5)); var v6 = (T6)Convert.ChangeType(inputs[5], typeof(T6)); var v7 = (T7)Convert.ChangeType(inputs[6], typeof(T7)); return (v1, v2, v3, v4, v5, v6, v7); } public T1[] ReadValueArray<T1>(int N) { var v1 = new T1[N]; for (int i = 0; i < N; i++) { v1[i] = ReadValue<T1>(); } return v1; } public (T1[], T2[]) ReadValueArray<T1, T2>(int N) { var (v1, v2) = (new T1[N], new T2[N]); for (int i = 0; i < N; i++) { var (t1, t2) = ReadValue<T1, T2>(); v1[i] = t1; v2[i] = t2; } return (v1, v2); } public (T1[], T2[], T3[]) ReadValueArray<T1, T2, T3>(int N) { var (v1, v2, v3) = (new T1[N], new T2[N], new T3[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3) = ReadValue<T1, T2, T3>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; } return (v1, v2, v3); } public (T1[], T2[], T3[], T4[]) ReadValueArray<T1, T2, T3, T4>(int N) { var (v1, v2, v3, v4) = (new T1[N], new T2[N], new T3[N], new T4[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4) = ReadValue<T1, T2, T3, T4>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; } return (v1, v2, v3, v4); } public (T1[], T2[], T3[], T4[], T5[]) ReadValueArray<T1, T2, T3, T4, T5>(int N) { var (v1, v2, v3, v4, v5) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5) = ReadValue<T1, T2, T3, T4, T5>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; } return (v1, v2, v3, v4, v5); } public (T1[], T2[], T3[], T4[], T5[], T6[]) ReadValueArray<T1, T2, T3, T4, T5, T6>(int N) { var (v1, v2, v3, v4, v5, v6) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6) = ReadValue<T1, T2, T3, T4, T5, T6>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; } return (v1, v2, v3, v4, v5, v6); } public (T1[], T2[], T3[], T4[], T5[], T6[], T7[]) ReadValueArray<T1, T2, T3, T4, T5, T6, T7>(int N) { var (v1, v2, v3, v4, v5, v6, v7) = (new T1[N], new T2[N], new T3[N], new T4[N], new T5[N], new T6[N], new T7[N]); for (int i = 0; i < N; i++) { var (t1, t2, t3, t4, t5, t6, t7) = ReadValue<T1, T2, T3, T4, T5, T6, T7>(); v1[i] = t1; v2[i] = t2; v3[i] = t3; v4[i] = t4; v5[i] = t5; v6[i] = t6; v7[i] = t7; } return (v1, v2, v3, v4, v5, v6, v7); } } }
[["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 22], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 205, 22]]
8
2,729
2
using System; using System.Collections.Generic; using static System.Console; class Program { static void Main() { var dic = new Dictionary<string, int>(); var N = NextInt(); for (var i = 0; i < N; i++) { var s = ReadLine(); if (dic.ContainsKey(s)) { dic[s]++; } else { dic[s] = 1; } } var M = NextInt(); for (var j = 0; j < M; j++) { var t = ReadLine(); if (dic.ContainsKey(t)) { dic[t]++; } } var ans = 0; foreach (var val in dic.Values) { ans = Math.Max(ans, val); } WriteLine(ans); } static int NextInt() { return int.Parse(ReadLine()); } }
using System; using System.Collections.Generic; using static System.Console; class Program { static void Main() { var dic = new Dictionary<string, int>(); var N = NextInt(); for (var i = 0; i < N; i++) { var s = ReadLine(); if (dic.ContainsKey(s)) { dic[s]++; } else { dic[s] = 1; } } var M = NextInt(); for (var j = 0; j < M; j++) { var t = ReadLine(); if (dic.ContainsKey(t)) { dic[t]--; } } var ans = 0; foreach (var val in dic.Values) { ans = Math.Max(ans, val); } WriteLine(ans); } static int NextInt() { return int.Parse(ReadLine()); } }
[["-", 0, 57, 64, 196, 0, 1, 0, 223, 0, 29], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 68]]
8
193
2
using System; class Program { static void Main() { int a = int.Parse(Console.ReadLine()); // int.Parseは文字列を整数に変換。 string[] stringPlus = new string[a]; for (int i = 0; i < a; i++) stringPlus[i] = Console.ReadLine(); // Splitで区切り文字を指定して複数個受け取る。 int b = int.Parse(Console.ReadLine()); // int.Parseは文字列を整数に変換。 string[] stringMinus = new string[b]; for (int i = 0; i < b; i++) stringMinus[i] = Console.ReadLine(); int maxPoint = 0; int point = -1; for (int i = 0; i < a; i++) { point = -1; for (int j = 0; j < a; j++) { if (stringPlus[i] == stringPlus[j]) point++; } for (int j = 0; j < b; j++) { if (stringPlus[i] == stringMinus[j]) point--; } if (point > maxPoint) maxPoint = point; } //出力 Console.WriteLine(maxPoint); // WriteLineをWriteとすると、改行なしで出力。 } }
using System; class Program { static void Main() { int a = int.Parse(Console.ReadLine()); // int.Parseは文字列を整数に変換。 string[] stringPlus = new string[a]; for (int i = 0; i < a; i++) stringPlus[i] = Console.ReadLine(); // Splitで区切り文字を指定して複数個受け取る。 int b = int.Parse(Console.ReadLine()); // int.Parseは文字列を整数に変換。 string[] stringMinus = new string[b]; for (int i = 0; i < b; i++) stringMinus[i] = Console.ReadLine(); int maxPoint = 0; int point = 0; for (int i = 0; i < a; i++) { point = 0; for (int j = 0; j < a; j++) { if (stringPlus[i] == stringPlus[j]) point++; } for (int j = 0; j < b; j++) { if (stringPlus[i] == stringMinus[j]) point--; } if (point > maxPoint) maxPoint = point; } //出力 Console.WriteLine(maxPoint); // WriteLineをWriteとすると、改行なしで出力。 } }
[["-", 0, 198, 0, 200, 0, 212, 0, 241, 0, 33], ["-", 0, 198, 0, 200, 0, 212, 0, 241, 0, 203], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["-", 8, 196, 0, 1, 0, 11, 12, 241, 0, 33], ["-", 8, 196, 0, 1, 0, 11, 12, 241, 0, 203], ["+", 0, 7, 8, 196, 0, 1, 0, 11, 12, 203]]
8
230
6
// Solve C using System; using System.Linq; using System.Collections.Generic; public class Class { static void Main() { int N = Convert.ToInt32(Console.ReadLine()); string[] S = new string[N]; int i = 0; while (i < N) { S[i] = Console.ReadLine(); i++; } int M = Convert.ToInt32(Console.ReadLine()); string[] T = new string[M]; i = 0; while (i < M) { T[i] = Console.ReadLine(); i++; } int a = 0; int b = 0; int points = 0; while (i < N) { a = S.Count(n => n == S[i]); b = T.Count(n => n == S[i]); if (points < a - b) points = a - b; i++; } Console.Write(points); } }
// Solve C using System; using System.Linq; using System.Collections.Generic; public class Class { static void Main() { int N = Convert.ToInt32(Console.ReadLine()); string[] S = new string[N]; int i = 0; while (i < N) { S[i] = Console.ReadLine(); i++; } int M = Convert.ToInt32(Console.ReadLine()); string[] T = new string[M]; i = 0; while (i < M) { T[i] = Console.ReadLine(); i++; } int a = 0; int b = 0; int points = 0; i = 0; while (i < N) { a = S.Count(n => n == S[i]); b = T.Count(n => n == S[i]); if (points < a - b) points = a - b; i++; } Console.Write(points); } }
[["+", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 8, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 0, 195, 8, 196, 0, 1, 0, 11, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35]]
8
210
4
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace AtCoder { public class QuestionA { public static void Main(string[] args) { // 文字列の入力 string s = Console.ReadLine(); long result = 0; if (s.Length == 1) { Console.WriteLine(s); return; } for (int i = 0; i < s.Length; ++i) { if (i == 0) { result += int.Parse(s[i].ToString()) - 1; } else { result += 9; } } var t = digit_sum(int.Parse(s)); Console.WriteLine(Math.Max(result, t)); } private static long digit_sum(long n) { if (n < 10) return n; return digit_sum(n / 10) + n % 10; } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace AtCoder { public class QuestionA { public static void Main(string[] args) { // 文字列の入力 string s = Console.ReadLine(); long result = 0; if (s.Length == 1) { Console.WriteLine(s); return; } for (int i = 0; i < s.Length; ++i) { if (i == 0) { result += int.Parse(s[i].ToString()) - 1; } else { result += 9; } } var t = digit_sum(long.Parse(s)); Console.WriteLine(Math.Max(result, t)); } private static long digit_sum(long n) { if (n < 10) return n; return digit_sum(n / 10) + n % 10; } } }
[["-", 3, 4, 0, 28, 0, 213, 63, 214, 205, 199], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 205, 199]]
8
210
2
using System; using System.Linq; using System.Collections.Generic; using System.IO; namespace atcorder2 { class Program { public static long Read() { return long.Parse(Console.ReadLine()); } public static long[] Reads() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); } public static long gcd(long x, long y) { if (y < x) gcd(y, x); while (y != 0) { var z = x % y; x = y; y = z; } return x; } static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); var n = Read(); var digit = 0; var tmp = n; while (tmp > 0) { tmp /= 10; digit++; } var count = new long[digit + 1]; for (int i = digit; i >= 1; i--) { count[i] = n / (long)Math.Pow(10, digit - 1); n -= count[i] * (long)Math.Pow(10, digit - 1); } Console.WriteLine(count.Sum() == (digit - 1) * 9 + count[digit] ? count.Sum() : (digit - 1) * 9 + count[digit] - 1); Console.Out.Flush(); } } }
using System; using System.Linq; using System.Collections.Generic; using System.IO; namespace atcorder2 { class Program { public static long Read() { return long.Parse(Console.ReadLine()); } public static long[] Reads() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); } public static long gcd(long x, long y) { if (y < x) gcd(y, x); while (y != 0) { var z = x % y; x = y; y = z; } return x; } static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); var n = Read(); var digit = 0; var tmp = n; while (tmp > 0) { tmp /= 10; digit++; } var count = new long[digit + 1]; for (int i = digit; i >= 1; i--) { count[i] = n / (long)Math.Pow(10, i - 1); n -= count[i] * (long)Math.Pow(10, i - 1); } Console.WriteLine(count.Sum() == (digit - 1) * 9 + count[digit] ? count.Sum() : (digit - 1) * 9 + count[digit] - 1); Console.Out.Flush(); } } }
[["-", 51, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["+", 51, 213, 3, 4, 0, 28, 0, 16, 31, 22]]
8
322
4
using System; using System.Collections.Generic; using System.Linq; using static System.Console; using static System.Math; class Program { static void Main() { var N = ReadLine(); var f = true; if (N.Length == 1) { WriteLine(int.Parse(N)); } for (int i = 1; i < N.Length; i++) { if (N[i] != '9') { f = false; } } if (f) { WriteLine(N.Sum(x => x - '0')); return; } WriteLine((N.Length - 1) * 9 + N[0] - '0' - 1); } }
using System; using System.Collections.Generic; using System.Linq; using static System.Console; using static System.Math; class Program { static void Main() { var N = ReadLine(); var f = true; if (N.Length == 1) { WriteLine(int.Parse(N)); return; } for (int i = 1; i < N.Length; i++) { if (N[i] != '9') { f = false; } } if (f) { WriteLine(N.Sum(x => x - '0')); return; } WriteLine((N.Length - 1) * 9 + N[0] - '0' - 1); } }
[["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 35]]
8
153
2
using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Linq; using static MyIO; public class A { public static readonly int FALSE = 0; public static readonly int TRUE = 1; public static void Main() { long N = GetLong(); List<int> digits = new List<int>(64); long tmp = N; while (tmp > 0) { digits.Add((int)(tmp % 10)); tmp /= 10; } digits.Reverse(); int[,] dp = new int[digits.Count + 1, 2]; dp[1, FALSE] = 1; dp[1, TRUE] = digits[0] - 1; for (int i = 1; i < digits.Count; i++) { dp[i + 1, FALSE] = dp[i, FALSE] + digits[i]; dp[i + 1, TRUE] = dp[i, TRUE] + 9; if (digits[i] > 0) dp[i + 1, TRUE] = Math.Max(dp[i + 1, TRUE], dp[i, FALSE] + (digits[i] - 1)); } Console.WriteLine( Math.Max(dp[digits.Count, FALSE], dp[digits.Count, TRUE])); } } public static class MyIO { private static string[] args = null; private static int num = -1; private static int used = -1; private static string getArg() { if (used == num) { args = Console.ReadLine().Split(' '); num = args.Length; used = 0; } return args[used++]; } public static int GetInt() { return int.Parse(getArg()); } public static long GetLong() { return long.Parse(getArg()); } public static double GetDouble() { return double.Parse(getArg()); } public static string GetString() { return getArg(); } }
using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Linq; using static MyIO; public class A { public static readonly int FALSE = 0; public static readonly int TRUE = 1; public static void Main() { long N = GetLong(); List<int> digits = new List<int>(64); long tmp = N; while (tmp > 0) { digits.Add((int)(tmp % 10)); tmp /= 10; } digits.Reverse(); int[,] dp = new int[digits.Count + 1, 2]; dp[1, FALSE] = digits[0]; dp[1, TRUE] = digits[0] - 1; for (int i = 1; i < digits.Count; i++) { dp[i + 1, FALSE] = dp[i, FALSE] + digits[i]; dp[i + 1, TRUE] = dp[i, TRUE] + 9; if (digits[i] > 0) dp[i + 1, TRUE] = Math.Max(dp[i + 1, TRUE], dp[i, FALSE] + (digits[i] - 1)); } Console.WriteLine( Math.Max(dp[digits.Count, FALSE], dp[digits.Count, TRUE])); } } public static class MyIO { private static string[] args = null; private static int num = -1; private static int used = -1; private static string getArg() { if (used == num) { args = Console.ReadLine().Split(' '); num = args.Length; used = 0; } return args[used++]; } public static int GetInt() { return int.Parse(getArg()); } public static long GetLong() { return long.Parse(getArg()); } public static double GetDouble() { return double.Parse(getArg()); } public static string GetString() { return getArg(); } }
[["-", 0, 195, 8, 196, 0, 1, 0, 11, 12, 203], ["+", 8, 196, 0, 1, 0, 11, 12, 204, 205, 22], ["+", 0, 1, 0, 11, 12, 204, 206, 207, 0, 70], ["+", 0, 11, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 1, 0, 11, 12, 204, 206, 207, 0, 73]]
8
437
5
using System; using System.Collections.Generic; namespace Practice { class Program { static void Main(string[] args) { Solve(); } private const int MOD = 1000000007; static void Solve() { var n = Console.ReadLine(); long longN = long.Parse(n); if (1 <= longN && longN <= 9) { Console.WriteLine(longN); return; } int digit = n.Length; // どっか一か所を別な数字に変える var c = new char[digit]; for (int i = 0; i < c.Length; ++i) { c[i] = '9'; } for (int i = 8; i >= 0; i--) { for (int j = 0; j < c.Length; ++j) { c[j] = (char)(i + '0'); long l = long.Parse(new string(c)); if (l <= longN) { int ans = 0; foreach (var cc in c) { ans += (cc - '0'); } Console.WriteLine(ans); return; } else { c[j] = '9'; } } } } #region よく使う便利関数 private static bool isPrime(long x) { if (x == 2) { return true; } if (x < 2 || x % 2 == 0) { return false; } long i = 3; while (i * i <= x) { if (x % i == 0) { return false; } i = i + 2; } return true; } private static long lcm(long x, long y) { return x / gcd(x, y) * y; } private static long gcd(long x, long y) { return y > 0 ? gcd(y, x % y) : x; } private static long pow(long x, long n) { if (n == 0) { return 1; } long res = pow(x * x % MOD, n / 2); if (n % 2 == 1) { res = res * x % MOD; } return res; } private static int ReadAndParseInt() { return int.Parse(Console.ReadLine()); } private static int[] ReadAndParseIntArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); } private static long ReadAndParseLong() { return long.Parse(Console.ReadLine()); } private static long[] ReadAndParseLongArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse); } /// <summary> /// 指定した値以上の先頭のインデクスを返す /// </summary> /// <typeparam name="T">比較する値の型</typeparam> /// <param name="arr">対象の配列(※ソート済みであること)</param> /// <param name="start">開始インデクス [inclusive]</param> /// <param name="end">終了インデクス [exclusive]</param> /// <param name="value">検索する値</param> /// <param name="comparer">比較関数(インターフェイス)</param> /// <returns>指定した値以上の先頭のインデクス</returns> public static int LowerBound<T>(IReadOnlyList<T> arr, int start, int end, T value, IComparer<T> comparer) { int low = start; int high = end; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (comparer.Compare(arr[mid], value) < 0) low = mid + 1; else high = mid; } return low; } //引数省略のオーバーロード public static int LowerBound<T>(IReadOnlyList<T> arr, T value) where T : IComparable { return LowerBound(arr, 0, arr.Count, value, Comparer<T>.Default); } /// <summary> /// 指定した値より大きい先頭のインデクスを返す /// </summary> /// <typeparam name="T">比較する値の型</typeparam> /// <param name="arr">対象の配列(※ソート済みであること)</param> /// <param name="start">開始インデクス [inclusive]</param> /// <param name="end">終了インデクス [exclusive]</param> /// <param name="value">検索する値</param> /// <param name="comparer">比較関数(インターフェイス)</param> /// <returns>指定した値より大きい先頭のインデクス</returns> public static int UpperBound<T>(IReadOnlyList<T> arr, int start, int end, T value, IComparer<T> comparer) { int low = start; int high = end; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (comparer.Compare(arr[mid], value) <= 0) low = mid + 1; else high = mid; } return low; } //引数省略のオーバーロード public static int UpperBound<T>(IReadOnlyList<T> arr, T value) { return UpperBound(arr, 0, arr.Count, value, Comparer<T>.Default); } #endregion } }
using System; using System.Collections.Generic; namespace Practice { class Program { static void Main(string[] args) { Solve(); } private const int MOD = 1000000007; static void Solve() { var n = Console.ReadLine(); long longN = long.Parse(n); if (1 <= longN && longN <= 9) { Console.WriteLine(longN); return; } int digit = n.Length; // どっか一か所を別な数字に変える var c = new char[digit]; for (int i = 0; i < c.Length; ++i) { c[i] = '9'; } for (int i = 9; i >= 0; i--) { for (int j = 0; j < c.Length; ++j) { c[j] = (char)(i + '0'); long l = long.Parse(new string(c)); if (l <= longN) { int ans = 0; foreach (var cc in c) { ans += (cc - '0'); } Console.WriteLine(ans); return; } else { c[j] = '9'; } } } } #region よく使う便利関数 private static bool isPrime(long x) { if (x == 2) { return true; } if (x < 2 || x % 2 == 0) { return false; } long i = 3; while (i * i <= x) { if (x % i == 0) { return false; } i = i + 2; } return true; } private static long lcm(long x, long y) { return x / gcd(x, y) * y; } private static long gcd(long x, long y) { return y > 0 ? gcd(y, x % y) : x; } private static long pow(long x, long n) { if (n == 0) { return 1; } long res = pow(x * x % MOD, n / 2); if (n % 2 == 1) { res = res * x % MOD; } return res; } private static int ReadAndParseInt() { return int.Parse(Console.ReadLine()); } private static int[] ReadAndParseIntArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); } private static long ReadAndParseLong() { return long.Parse(Console.ReadLine()); } private static long[] ReadAndParseLongArr() { return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse); } /// <summary> /// 指定した値以上の先頭のインデクスを返す /// </summary> /// <typeparam name="T">比較する値の型</typeparam> /// <param name="arr">対象の配列(※ソート済みであること)</param> /// <param name="start">開始インデクス [inclusive]</param> /// <param name="end">終了インデクス [exclusive]</param> /// <param name="value">検索する値</param> /// <param name="comparer">比較関数(インターフェイス)</param> /// <returns>指定した値以上の先頭のインデクス</returns> public static int LowerBound<T>(IReadOnlyList<T> arr, int start, int end, T value, IComparer<T> comparer) { int low = start; int high = end; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (comparer.Compare(arr[mid], value) < 0) low = mid + 1; else high = mid; } return low; } //引数省略のオーバーロード public static int LowerBound<T>(IReadOnlyList<T> arr, T value) where T : IComparable { return LowerBound(arr, 0, arr.Count, value, Comparer<T>.Default); } /// <summary> /// 指定した値より大きい先頭のインデクスを返す /// </summary> /// <typeparam name="T">比較する値の型</typeparam> /// <param name="arr">対象の配列(※ソート済みであること)</param> /// <param name="start">開始インデクス [inclusive]</param> /// <param name="end">終了インデクス [exclusive]</param> /// <param name="value">検索する値</param> /// <param name="comparer">比較関数(インターフェイス)</param> /// <returns>指定した値より大きい先頭のインデクス</returns> public static int UpperBound<T>(IReadOnlyList<T> arr, int start, int end, T value, IComparer<T> comparer) { int low = start; int high = end; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (comparer.Compare(arr[mid], value) <= 0) low = mid + 1; else high = mid; } return low; } //引数省略のオーバーロード public static int UpperBound<T>(IReadOnlyList<T> arr, T value) { return UpperBound(arr, 0, arr.Count, value, Comparer<T>.Default); } #endregion } }
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
8
847
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.IO; namespace AtCoder { class Program { private static string Read() { return Console.ReadLine(); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } private static int Sum(long N) { int sum = 0; while (N > 0) { sum += (int)(N % 10); N /= 10; } return sum; } private static int Solve(long N) { int max = Sum(N); for (long n = 10; n < N; n *= 10) { max = Math.Max(Sum(N - N % n - 1), max); } return max; } static void Main(string[] args) { long N = ReadLong(); Console.WriteLine(Solve(N)); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.IO; namespace AtCoder { class Program { private static string Read() { return Console.ReadLine(); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } private static int Sum(long N) { int sum = 0; while (N > 0) { sum += (int)(N % 10); N /= 10; } return sum; } private static int Solve(long N) { int max = Sum(N); for (long n = 1; n < N; n *= 10) { max = Math.Max(Sum(N - N % n - 1), max); } return max; } static void Main(string[] args) { long N = ReadLong(); Console.WriteLine(Solve(N)); } } }
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
8
318
2
using System; using System.Threading; namespace ABC088 { /// <summary> /// A - Infinite Coins /// </summary> class Program { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var A = int.Parse(Console.ReadLine()); float rslt = N % 500; if (rslt - A < 0) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; using System.Threading; namespace ABC088 { /// <summary> /// A - Infinite Coins /// </summary> class Program { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var A = int.Parse(Console.ReadLine()); float rslt = N % 500; if (rslt - A <= 0) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
8
96
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; public class Hello { public static void Main() { // Your code here! int X = int.Parse(Console.ReadLine()); int N = int.Parse(Console.ReadLine()); int a = X / 500; if (a <= N) { System.Console.WriteLine("Yes"); } else { System.Console.WriteLine("No"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; public class Hello { public static void Main() { // Your code here! int X = int.Parse(Console.ReadLine()); int N = int.Parse(Console.ReadLine()); int a = X % 500; if (a <= N) { System.Console.WriteLine("Yes"); } else { System.Console.WriteLine("No"); } } }
[["-", 0, 198, 0, 200, 0, 212, 0, 16, 17, 85], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 109]]
8
109
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtCoder.Abc { class Q088A { public static void Main(string[] args) { var sw = new System.IO.StreamWriter( Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); // 整数の入力 long N = long.Parse(Console.ReadLine()); long A = long.Parse(Console.ReadLine()); string result = "NO"; if (A - (N - (N / 500) * 500) > 0) { result = "YES"; } Console.WriteLine(result); Console.Out.Flush(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtCoder.Abc { class Q088A { public static void Main(string[] args) { var sw = new System.IO.StreamWriter( Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); // 整数の入力 long N = long.Parse(Console.ReadLine()); long A = long.Parse(Console.ReadLine()); string result = "No"; if (A - (N - (N / 500) * 500) >= 0) { result = "Yes"; } Console.WriteLine(result); Console.Out.Flush(); } } }
[["-", 0, 198, 0, 200, 0, 212, 0, 5, 0, 222], ["+", 0, 198, 0, 200, 0, 212, 0, 5, 0, 222], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20], ["-", 64, 196, 0, 1, 0, 11, 12, 5, 0, 222], ["+", 64, 196, 0, 1, 0, 11, 12, 5, 0, 222]]
8
155
6
using System; namespace ABC_088_A_Csharp_ver { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int A = int.Parse(Console.ReadLine()); if (500 % N <= A) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } Console.ReadKey(); } } }
using System; namespace ABC_088_A_Csharp_ver { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int A = int.Parse(Console.ReadLine()); if (N % 500 <= A) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } Console.ReadKey(); } } }
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 203], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203]]
8
87
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC088A { class Program { static void Main(string[] args) { int a, b; a = int.Parse(Console.ReadLine()); b = int.Parse(Console.ReadLine()); if ((a % 500) < b) Console.WriteLine("Yes"); else Console.WriteLine("No"); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC088A { class Program { static void Main(string[] args) { int a, b; a = int.Parse(Console.ReadLine()); b = int.Parse(Console.ReadLine()); if ((a % 500) <= b) Console.WriteLine("Yes"); else Console.WriteLine("No"); Console.ReadKey(); } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
8
112
2
using System; using System.Linq; using System.Collections.Generic; namespace A { class Program { static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); var a = int.Parse(Console.ReadLine()); bool ans = n % a <= a; Console.WriteLine(ans ? "Yes" : "No"); } } }
using System; using System.Linq; using System.Collections.Generic; namespace A { class Program { static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); var a = int.Parse(Console.ReadLine()); bool ans = n % 500 <= a; Console.WriteLine(ans ? "Yes" : "No"); } } }
[["-", 0, 200, 0, 212, 0, 16, 31, 16, 12, 22], ["+", 0, 200, 0, 212, 0, 16, 31, 16, 12, 203]]
8
86
2
using System; class Program { static void Main(string[] args) { // 支払総額N円 string input = Console.ReadLine(); int payTotal = int.Parse(input); // 1円硬貨枚数A input = Console.ReadLine(); int one = int.Parse(input); // 支払総額を500円で割った余りを計算 int surplus = payTotal % 500; if (surplus <= one) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } }
using System; class Program { static void Main(string[] args) { // 支払総額N円 string input = Console.ReadLine(); int payTotal = int.Parse(input); // 1円硬貨枚数A input = Console.ReadLine(); int one = int.Parse(input); // 支払総額を500円で割った余りを計算 int surplus = payTotal % 500; if (surplus <= one) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
94
4
using System; namespace AtCoder.BeginnersSelections { class Test { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int A = int.Parse(Console.ReadLine()); int amari = N % 500; if (amari < A) Console.WriteLine("Yes"); else Console.WriteLine("No"); } } }
using System; namespace AtCoder.BeginnersSelections { class Test { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int A = int.Parse(Console.ReadLine()); int amari = N % 500; if (amari <= A) Console.WriteLine("Yes"); else Console.WriteLine("No"); } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
8
84
2
using System; using System.Linq; public class c { public static void Main() { int N = int.Parse(Console.ReadLine()); int A = int.Parse(Console.ReadLine()); string Ans = "No"; if (N % 500 >= A) Ans = "Yes"; Console.WriteLine(Ans); } }
using System; using System.Linq; public class c { public static void Main() { int N = int.Parse(Console.ReadLine()); int A = int.Parse(Console.ReadLine()); string Ans = "No"; if (N % 500 <= A) Ans = "Yes"; Console.WriteLine(Ans); } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
8
77
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC088 { class ABC088_A { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var A = int.Parse(Console.ReadLine()); Console.WriteLine(N / 500 <= A ? "Yes" : "No"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC088 { class ABC088_A { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var A = int.Parse(Console.ReadLine()); Console.WriteLine(N % 500 <= A ? "Yes" : "No"); } } }
[["-", 0, 28, 0, 41, 15, 16, 31, 16, 17, 85], ["+", 0, 28, 0, 41, 15, 16, 31, 16, 17, 109]]
8
93
2
using System; using System.Collections.Generic; using System.Linq; namespace ziyuutyou { class Program { static void Main(string[] args) { var cash = int.Parse(Console.ReadLine()); var yen = int.Parse(Console.ReadLine()); var money = cash % 500; if (money < yen) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; using System.Collections.Generic; using System.Linq; namespace ziyuutyou { class Program { static void Main(string[] args) { var cash = int.Parse(Console.ReadLine()); var yen = int.Parse(Console.ReadLine()); var money = cash % 500; if (money <= yen) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
8
98
2
using System; using System.Collections; using System.Collections.Generic; using System.Text; public class A { public static void Main() { int N = Int32.Parse(Console.ReadLine()); int A = Int32.Parse(Console.ReadLine()); Console.WriteLine(((N % 500) < A) ? "Yes" : "No"); } }
using System; using System.Collections; using System.Collections.Generic; using System.Text; public class A { public static void Main() { int N = Int32.Parse(Console.ReadLine()); int A = Int32.Parse(Console.ReadLine()); Console.WriteLine(((N % 500) <= A) ? "Yes" : "No"); } }
[["-", 0, 28, 0, 41, 15, 23, 0, 16, 17, 18], ["+", 0, 28, 0, 41, 15, 23, 0, 16, 17, 19]]
8
84
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using static System.Console; using static System.Math; namespace At { class Program { static void Main(string[] args) { var n = ReadInt(); var a = ReadInt(); var x = n % 500; if (a > x) { WriteLine("Yes"); } else { WriteLine("No"); } } private static string Read() { return ReadLine(); } private static string[] Reads() { return (Read().Split()); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using static System.Console; using static System.Math; namespace At { class Program { static void Main(string[] args) { var n = ReadInt(); var a = ReadInt(); var x = n % 500; if (a >= x) { WriteLine("Yes"); } else { WriteLine("No"); } } private static string Read() { return ReadLine(); } private static string[] Reads() { return (Read().Split()); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20]]
8
269
2
using System; using System.Collections.Generic; using System.Linq; namespace ConsoleApp { class Program { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var A = int.Parse(Console.ReadLine()); Console.WriteLine(N % 50 <= A ? "Yes" : "No"); } } }
using System; using System.Collections.Generic; using System.Linq; namespace ConsoleApp { class Program { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var A = int.Parse(Console.ReadLine()); Console.WriteLine(N % 500 <= A ? "Yes" : "No"); } } }
[["-", 0, 28, 0, 41, 15, 16, 31, 16, 12, 203], ["+", 0, 28, 0, 41, 15, 16, 31, 16, 12, 203]]
8
81
2
using System; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; class Program { static void Main() { //入力 // int[] input = Console.ReadLine().Split().Select(i => // int.Parse(i)).ToArray(); string input= Console.ReadLine(); int[] input = new int[2]; for (int a = 0; a < 2; a++) { input[a] = int.Parse(Console.ReadLine()); } // int input =int.Parse(input[0]+""+input[3+1]+""+input[3*2+2]); Console.WriteLine(input[1] % 500 <= input[0] ? "Yes" : "No"); /* //処理速度計測 var sw = new System.Diagnostics.Stopwatch(); sw.Start(); //解法 //処理速度表示 sw.Stop(); TimeSpan ts = sw.Elapsed; Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms"); */ Console.ReadLine(); } }
using System; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; class Program { static void Main() { //入力 // int[] input = Console.ReadLine().Split().Select(i => // int.Parse(i)).ToArray(); string input= Console.ReadLine(); int[] input = new int[2]; for (int a = 0; a < 2; a++) { input[a] = int.Parse(Console.ReadLine()); } // int input =int.Parse(input[0]+""+input[3+1]+""+input[3*2+2]); Console.WriteLine(input[0] % 500 <= input[1] ? "Yes" : "No"); /* //処理速度計測 var sw = new System.Diagnostics.Stopwatch(); sw.Start(); //解法 //処理速度表示 sw.Stop(); TimeSpan ts = sw.Elapsed; Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms"); */ Console.ReadLine(); } }
[["-", 31, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["+", 31, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["-", 15, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 15, 16, 12, 204, 206, 207, 0, 28, 0, 203]]
8
116
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { Solve(); } static void Solve() { Scan sc = new Scan(); var p1 = sc.longarr; long n = p1[0]; var p2 = sc.longarr; long k = p2[0]; n %= 500; if (n - k >= 0) Console.WriteLine("Yes"); else Console.WriteLine("No"); } } class Scan { public string str => Console.ReadLine(); public string[] strarr => str.Split(' '); public long[] longarr => strarr.Select(long.Parse).ToArray(); }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { Solve(); } static void Solve() { Scan sc = new Scan(); var p1 = sc.longarr; long n = p1[0]; var p2 = sc.longarr; long k = p2[0]; n %= 500; if (n - k <= 0) Console.WriteLine("Yes"); else Console.WriteLine("No"); } } class Scan { public string str => Console.ReadLine(); public string[] strarr => str.Split(' '); public long[] longarr => strarr.Select(long.Parse).ToArray(); }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
8
170
2
using System; using System.Linq; class prog { static void Main() { int n = int.Parse(Console.ReadLine()); int a = int.Parse(Console.ReadLine()); Console.WriteLine(a >= n % 100 ? "Yes" : "No"); } }
using System; using System.Linq; class prog { static void Main() { int n = int.Parse(Console.ReadLine()); int a = int.Parse(Console.ReadLine()); Console.WriteLine(a >= n % 500 ? "Yes" : "No"); } }
[["-", 0, 28, 0, 41, 15, 16, 12, 16, 12, 203], ["+", 0, 28, 0, 41, 15, 16, 12, 16, 12, 203]]
8
66
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int a = int.Parse(Console.ReadLine()); int remain = n % 100; if (remain > a) { Console.WriteLine("No"); } else { Console.WriteLine("Yes"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int a = int.Parse(Console.ReadLine()); int remain = n % 500; if (remain > a) { Console.WriteLine("No"); } else { Console.WriteLine("Yes"); } } } }
[["-", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203]]
8
110
2
using System; using System.Collections.Generic; using System.Linq; namespace ConsoleApp3 { class Program { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var A = int.Parse(Console.ReadLine()); var amari = N % 500; var str = "NO"; if (A >= amari) str = "YES"; Console.WriteLine(str); } } }
using System; using System.Collections.Generic; using System.Linq; namespace ConsoleApp3 { class Program { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var A = int.Parse(Console.ReadLine()); var amari = N % 500; var str = "No"; if (A >= amari) str = "Yes"; Console.WriteLine(str); } } }
[["-", 0, 198, 0, 200, 0, 212, 0, 5, 0, 222], ["+", 0, 198, 0, 200, 0, 212, 0, 5, 0, 222], ["-", 0, 57, 64, 1, 0, 11, 12, 5, 0, 222], ["+", 0, 57, 64, 1, 0, 11, 12, 5, 0, 222]]
8
95
4
using System; namespace Sample101 { class Program { static void Main(string[] args) { int daikin = int.Parse(Console.ReadLine()); int ichien = int.Parse(Console.ReadLine()); if (daikin % 500 < ichien) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; namespace Sample101 { class Program { static void Main(string[] args) { int daikin = int.Parse(Console.ReadLine()); int ichien = int.Parse(Console.ReadLine()); if (daikin % 500 <= ichien) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
8
81
2
using System; namespace ABC088_A { class Program { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var A = int.Parse(Console.ReadLine()); Console.WriteLine(N % 500 < A ? "Yes" : "No"); } } }
using System; namespace ABC088_A { class Program { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var A = int.Parse(Console.ReadLine()); Console.WriteLine(N % 500 <= A ? "Yes" : "No"); } } }
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 18], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19]]
8
69
2
using static System.Console; namespace For_Atcoder { class Program { static void Main(string[] args) { int N = int.Parse(ReadLine()); int A = int.Parse(ReadLine()); WriteLine((N % 500) < A ? "Yes" : "No"); } } }
using static System.Console; namespace For_Atcoder { class Program { static void Main(string[] args) { int N = int.Parse(ReadLine()); int A = int.Parse(ReadLine()); WriteLine((N % 500) <= A ? "Yes" : "No"); } } }
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 17, 18], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19]]
8
68
2
using System; using System.Collections.Generic; using System.Linq; namespace Competitive { internal class Solution { public void Run() { int N = Input.ReadInt(); int A = Input.ReadInt(); Console.WriteLine(N / 500 <= A ? "Yes" : "No"); } } internal static class Input { public static int ReadInt() { string line = Console.ReadLine(); return int.Parse(line); } } internal class Program { public static void Main(string[] args) { var s = new Solution(); s.Run(); } } }
using System; using System.Collections.Generic; using System.Linq; namespace Competitive { internal class Solution { public void Run() { int N = Input.ReadInt(); int A = Input.ReadInt(); Console.WriteLine(N % 500 <= A ? "Yes" : "No"); } } internal static class Input { public static int ReadInt() { string line = Console.ReadLine(); return int.Parse(line); } } internal class Program { public static void Main(string[] args) { var s = new Solution(); s.Run(); } } }
[["-", 0, 28, 0, 41, 15, 16, 31, 16, 17, 85], ["+", 0, 28, 0, 41, 15, 16, 31, 16, 17, 109]]
8
130
2
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using static System.Console; using static System.Math; using System.Numerics; //using CS_Contest.Graph; using CS_Contest.Loop; using CS_Contest.Utils; using static Nakov.IO.Cin; using static CS_Contest.IO.IO; namespace CS_Contest { using Li = List<int>; using LLi = List<List<int>>; using Ll = List<long>; using ti3=Tuple<int,int,int>; using ti2=Tuple<int,int>; internal class Program { private static void Main(string[] args) { var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false }; SetOut(sw); new Calc().Solve(); Out.Flush(); } public class Calc { public void Solve() { int N = NextInt(), A = NextInt(); N -= (N / 500) * 500; if (N < A) "Yes".WL(); else "No".WL(); return; } } } } namespace Nakov.IO { using System; using System.Text; using System.Globalization; public static class Cin { public static string NextToken() { StringBuilder tokenChars = new StringBuilder(); bool tokenFinished = false; bool skipWhiteSpaceMode = true; while (!tokenFinished) { int nextChar = Console.Read(); if (nextChar == -1) { tokenFinished = true; } else { char ch = (char)nextChar; if (char.IsWhiteSpace(ch)) { if (!skipWhiteSpaceMode) { tokenFinished = true; if (ch == '\r' && (Environment.NewLine == "\r\n")) { Console.Read(); } } } else { skipWhiteSpaceMode = false; tokenChars.Append(ch); } } } string token = tokenChars.ToString(); return token; } public static int NextInt() { string token = Cin.NextToken(); return int.Parse(token); } public static long NextLong() { string token = Cin.NextToken(); return long.Parse(token); } public static double NextDouble(bool acceptAnyDecimalSeparator = true) { string token = Cin.NextToken(); if (acceptAnyDecimalSeparator) { token = token.Replace(',', '.'); double result = double.Parse(token, CultureInfo.InvariantCulture); return result; } else { double result = double.Parse(token); return result; } } public static decimal NextDecimal(bool acceptAnyDecimalSeparator = true) { string token = Cin.NextToken(); if (acceptAnyDecimalSeparator) { token = token.Replace(',', '.'); decimal result = decimal.Parse(token, CultureInfo.InvariantCulture); return result; } else { decimal result = decimal.Parse(token); return result; } } } } namespace CS_Contest.Loop { public static class Loop { public static void REP(this int n, Action<int> act) { for (var i = 0; i < n; i++) { act(i); } } public static void RREP(this int @n, Action<int> act) { for (var i = n - 1; i >= 0; i--) act(i); } public static void REP(this long n, Action<long> act) { for (var i = 0; i < n; i++) act(i); } public static void FOR(this Tuple<int, int, int> t, Action<int> action) { for (var i = t.Item1; i < t.Item2; i += t.Item3) action(i); } public static void FOR(this Tuple<int, int> t, Action<int> action) => new Tuple<int, int, int>(t.Item1, t.Item2, 1).FOR(action); public static void FOR(this Tuple<long, long, long> t, Action<long> action) { for (var i = t.Item1; i < t.Item2; i += t.Item3) action(i); } public static void FOR(this Tuple<long, long> t, Action<long> act) => new Tuple<long, long, long>(t.Item1, t.Item2, 1).FOR(act); public static void ForeachWith<T>(this IEnumerable<T> ie, Action<int, T> act) { var i = 0; foreach (var item in ie) { act(i, item); i++; } } public static void Foreach<T>(this IEnumerable<T> ie, Action<T> act) { foreach (var item in ie) { act(item); } } } } namespace CS_Contest.IO { using Li = List<int>; using Ll = List<long>; public static class IO { public static void WL(this object obj) => WriteLine(obj); public static void WL(this string obj) => WriteLine(obj); public static void WL<T>(this IEnumerable<T> list) => list.ToList().ForEach(x => x.WL()); public static Li NextIntList() => ReadLine().Split().Select(int.Parse).ToList(); public static Ll NextLongList() => ReadLine().Split().Select(long.Parse).ToList(); public static T Tee<T>(this T t, Func<T, string> formatter = null) { if (formatter == null) formatter = arg => arg.ToString(); formatter(t).WL(); return t; } public static void JoinWL<T>(this IEnumerable<T> @this, string sp = " ") => @this.StringJoin(sp).WL(); public static void W(this object @this) => Write(@this); } } namespace CS_Contest.Utils { using Li=List<int>; using Ll=List<long>; public static class Utils { public static List<T> Repeat<T>(Func<int, T> result, int range) => Enumerable.Range(0, range).Select(result).ToList(); public static bool Within(int x, int y, int lx, int ly) => !(x < 0 || x >= lx || y < 0 || y >= ly); public static void Add<T1, T2>(this List<Tuple<T1, T2>> list, T1 t1, T2 t2) => list.Add(new Tuple<T1, T2>(t1, t2)); public static string StringJoin<T>(this IEnumerable<T> l, string separator = "") => string.Join(separator, l); public static Queue<T> ToQueue<T>(this IEnumerable<T> iEnumerable) { var rt = new Queue<T>(); foreach (var item in iEnumerable) { rt.Enqueue(item); } return rt; } public static void Swap<T>(ref T x, ref T y) { var tmp = x; x = y; y = tmp; } public static Dictionary<TKey, int> CountUp<TKey>(this IEnumerable<TKey> l) { var dic = new Dictionary<TKey, int>(); foreach (var item in l) { if (dic.ContainsKey(item)) dic[item]++; else dic.Add(item, 1); } return dic; } public static int Count<T>(this IEnumerable<T> l, T target) => l.Count(x => x.Equals(target)); public static IEnumerable<T> SkipAt<T>(this IEnumerable<T> @this, int at) { var enumerable = @this as T[] ?? @this.ToArray(); for (var i = 0; i < enumerable.Count(); i++) { if(i==at) continue; yield return enumerable.ElementAt(i); } } } public class Map<TKey, TValue> : Dictionary<TKey, TValue> { public Map() : base() { } public Map(int capacity) : base(capacity) { } public new TValue this[TKey index] { get { TValue v; return this.TryGetValue(index, out v) ? v : base[index] = default(TValue); } set { base[index] = value; } } } public static class MyMath { public static long GCD(long m, long n) { long tmp; if (m < n) { tmp = n; n = m; m = tmp; } while (m % n != 0) { tmp = n; n = m % n; m = tmp; } return n; } public static long LCM(long m, long n) => m * (n / GCD(m, n)); public static long ModValue = (long)1e9 + 7; public static long INF = long.MaxValue; public static long Mod(long x) => x % ModValue; public static long DivMod(long x, long y) => Mod(x * ModPow(y, (long)(1e9 + 5))); public static long[,] CombinationTable(int n) { var rt = new long[n + 1, n + 1]; for (var i = 0; i <= n; i++) { for (var j = 0; j <= i; j++) { if (j == 0 || i == j) rt[i, j] = 1L; else rt[i, j] = (rt[i - 1, j - 1] + rt[i - 1, j]); } } return rt; } public static long ModPow(long x, long n) { long tmp = 1; while (n != 0) { if (n % 2 == 1) { tmp = Mod(tmp * x); } x = Mod(x * x); n /= 2; } return tmp; } public static bool IsPrime(long n) { if (n == 2) return true; if (n < 2 || n % 2 == 0) return false; var i = 3; var sq = (long)Sqrt(n); while (i <= sq) { if (n % i == 0) return false; i += 2; } return true; } public static IEnumerable<int> Primes(int maxnum) { yield return 2; yield return 3; var sieve = new BitArray(maxnum + 1); int squareroot = (int)Math.Sqrt(maxnum); for (int i = 2; i <= squareroot; i++) { if (sieve[i] == false) { for (int n = i * 2; n <= maxnum; n += i) sieve[n] = true; } for (var n = i * i + 1; n <= maxnum && n < (i + 1) * (i + 1); n++) { if (!sieve[n]) yield return n; } } } public static int ManhattanDistance(int x1, int y1, int x2, int y2) => Abs(x2 - x1) + Abs(y2 - y1); public static T Min<T>(params T[] a) where T : IComparable<T> => a.Min(); public static T Max<T>(params T[] a) where T : IComparable<T> => a.Max(); } }
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using static System.Console; using static System.Math; using System.Numerics; //using CS_Contest.Graph; using CS_Contest.Loop; using CS_Contest.Utils; using static Nakov.IO.Cin; using static CS_Contest.IO.IO; namespace CS_Contest { using Li = List<int>; using LLi = List<List<int>>; using Ll = List<long>; using ti3=Tuple<int,int,int>; using ti2=Tuple<int,int>; internal class Program { private static void Main(string[] args) { var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false }; SetOut(sw); new Calc().Solve(); Out.Flush(); } public class Calc { public void Solve() { int N = NextInt(), A = NextInt(); N -= (N / 500) * 500; if (N <= A) "Yes".WL(); else "No".WL(); return; } } } } namespace Nakov.IO { using System; using System.Text; using System.Globalization; public static class Cin { public static string NextToken() { StringBuilder tokenChars = new StringBuilder(); bool tokenFinished = false; bool skipWhiteSpaceMode = true; while (!tokenFinished) { int nextChar = Console.Read(); if (nextChar == -1) { tokenFinished = true; } else { char ch = (char)nextChar; if (char.IsWhiteSpace(ch)) { if (!skipWhiteSpaceMode) { tokenFinished = true; if (ch == '\r' && (Environment.NewLine == "\r\n")) { Console.Read(); } } } else { skipWhiteSpaceMode = false; tokenChars.Append(ch); } } } string token = tokenChars.ToString(); return token; } public static int NextInt() { string token = Cin.NextToken(); return int.Parse(token); } public static long NextLong() { string token = Cin.NextToken(); return long.Parse(token); } public static double NextDouble(bool acceptAnyDecimalSeparator = true) { string token = Cin.NextToken(); if (acceptAnyDecimalSeparator) { token = token.Replace(',', '.'); double result = double.Parse(token, CultureInfo.InvariantCulture); return result; } else { double result = double.Parse(token); return result; } } public static decimal NextDecimal(bool acceptAnyDecimalSeparator = true) { string token = Cin.NextToken(); if (acceptAnyDecimalSeparator) { token = token.Replace(',', '.'); decimal result = decimal.Parse(token, CultureInfo.InvariantCulture); return result; } else { decimal result = decimal.Parse(token); return result; } } } } namespace CS_Contest.Loop { public static class Loop { public static void REP(this int n, Action<int> act) { for (var i = 0; i < n; i++) { act(i); } } public static void RREP(this int @n, Action<int> act) { for (var i = n - 1; i >= 0; i--) act(i); } public static void REP(this long n, Action<long> act) { for (var i = 0; i < n; i++) act(i); } public static void FOR(this Tuple<int, int, int> t, Action<int> action) { for (var i = t.Item1; i < t.Item2; i += t.Item3) action(i); } public static void FOR(this Tuple<int, int> t, Action<int> action) => new Tuple<int, int, int>(t.Item1, t.Item2, 1).FOR(action); public static void FOR(this Tuple<long, long, long> t, Action<long> action) { for (var i = t.Item1; i < t.Item2; i += t.Item3) action(i); } public static void FOR(this Tuple<long, long> t, Action<long> act) => new Tuple<long, long, long>(t.Item1, t.Item2, 1).FOR(act); public static void ForeachWith<T>(this IEnumerable<T> ie, Action<int, T> act) { var i = 0; foreach (var item in ie) { act(i, item); i++; } } public static void Foreach<T>(this IEnumerable<T> ie, Action<T> act) { foreach (var item in ie) { act(item); } } } } namespace CS_Contest.IO { using Li = List<int>; using Ll = List<long>; public static class IO { public static void WL(this object obj) => WriteLine(obj); public static void WL(this string obj) => WriteLine(obj); public static void WL<T>(this IEnumerable<T> list) => list.ToList().ForEach(x => x.WL()); public static Li NextIntList() => ReadLine().Split().Select(int.Parse).ToList(); public static Ll NextLongList() => ReadLine().Split().Select(long.Parse).ToList(); public static T Tee<T>(this T t, Func<T, string> formatter = null) { if (formatter == null) formatter = arg => arg.ToString(); formatter(t).WL(); return t; } public static void JoinWL<T>(this IEnumerable<T> @this, string sp = " ") => @this.StringJoin(sp).WL(); public static void W(this object @this) => Write(@this); } } namespace CS_Contest.Utils { using Li=List<int>; using Ll=List<long>; public static class Utils { public static List<T> Repeat<T>(Func<int, T> result, int range) => Enumerable.Range(0, range).Select(result).ToList(); public static bool Within(int x, int y, int lx, int ly) => !(x < 0 || x >= lx || y < 0 || y >= ly); public static void Add<T1, T2>(this List<Tuple<T1, T2>> list, T1 t1, T2 t2) => list.Add(new Tuple<T1, T2>(t1, t2)); public static string StringJoin<T>(this IEnumerable<T> l, string separator = "") => string.Join(separator, l); public static Queue<T> ToQueue<T>(this IEnumerable<T> iEnumerable) { var rt = new Queue<T>(); foreach (var item in iEnumerable) { rt.Enqueue(item); } return rt; } public static void Swap<T>(ref T x, ref T y) { var tmp = x; x = y; y = tmp; } public static Dictionary<TKey, int> CountUp<TKey>(this IEnumerable<TKey> l) { var dic = new Dictionary<TKey, int>(); foreach (var item in l) { if (dic.ContainsKey(item)) dic[item]++; else dic.Add(item, 1); } return dic; } public static int Count<T>(this IEnumerable<T> l, T target) => l.Count(x => x.Equals(target)); public static IEnumerable<T> SkipAt<T>(this IEnumerable<T> @this, int at) { var enumerable = @this as T[] ?? @this.ToArray(); for (var i = 0; i < enumerable.Count(); i++) { if(i==at) continue; yield return enumerable.ElementAt(i); } } } public class Map<TKey, TValue> : Dictionary<TKey, TValue> { public Map() : base() { } public Map(int capacity) : base(capacity) { } public new TValue this[TKey index] { get { TValue v; return this.TryGetValue(index, out v) ? v : base[index] = default(TValue); } set { base[index] = value; } } } public static class MyMath { public static long GCD(long m, long n) { long tmp; if (m < n) { tmp = n; n = m; m = tmp; } while (m % n != 0) { tmp = n; n = m % n; m = tmp; } return n; } public static long LCM(long m, long n) => m * (n / GCD(m, n)); public static long ModValue = (long)1e9 + 7; public static long INF = long.MaxValue; public static long Mod(long x) => x % ModValue; public static long DivMod(long x, long y) => Mod(x * ModPow(y, (long)(1e9 + 5))); public static long[,] CombinationTable(int n) { var rt = new long[n + 1, n + 1]; for (var i = 0; i <= n; i++) { for (var j = 0; j <= i; j++) { if (j == 0 || i == j) rt[i, j] = 1L; else rt[i, j] = (rt[i - 1, j - 1] + rt[i - 1, j]); } } return rt; } public static long ModPow(long x, long n) { long tmp = 1; while (n != 0) { if (n % 2 == 1) { tmp = Mod(tmp * x); } x = Mod(x * x); n /= 2; } return tmp; } public static bool IsPrime(long n) { if (n == 2) return true; if (n < 2 || n % 2 == 0) return false; var i = 3; var sq = (long)Sqrt(n); while (i <= sq) { if (n % i == 0) return false; i += 2; } return true; } public static IEnumerable<int> Primes(int maxnum) { yield return 2; yield return 3; var sieve = new BitArray(maxnum + 1); int squareroot = (int)Math.Sqrt(maxnum); for (int i = 2; i <= squareroot; i++) { if (sieve[i] == false) { for (int n = i * 2; n <= maxnum; n += i) sieve[n] = true; } for (var n = i * i + 1; n <= maxnum && n < (i + 1) * (i + 1); n++) { if (!sieve[n]) yield return n; } } } public static int ManhattanDistance(int x1, int y1, int x2, int y2) => Abs(x2 - x1) + Abs(y2 - y1); public static T Min<T>(params T[] a) where T : IComparable<T> => a.Min(); public static T Max<T>(params T[] a) where T : IComparable<T> => a.Max(); } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 19]]
8
2,426
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtCoder.Abc { class Question6 { public static void Main(string[] args) { var sw = new System.IO.StreamWriter( Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); // 文字列の入力 // string s = Console.ReadLine(); // 整数の入力 long n = long.Parse(Console.ReadLine()); // 文字列配列の入力 // string[] inputStrArray = Console.ReadLine().Split(' '); // 整数配列の入力 var a = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray(); var list = a.OrderBy(x => x); var sum = a.Sum(x => x); int[] Array = list.ToArray(); long A = 0; int j; for (j = 0; 2 * j + 1 < n; j++) { A += Array[2 * j + 1]; } var result = 2 * A - sum; Console.WriteLine(result); Console.Out.Flush(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtCoder.Abc { class Question6 { public static void Main(string[] args) { var sw = new System.IO.StreamWriter( Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); // 文字列の入力 // string s = Console.ReadLine(); // 整数の入力 long n = long.Parse(Console.ReadLine()); // 文字列配列の入力 // string[] inputStrArray = Console.ReadLine().Split(' '); // 整数配列の入力 var a = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray(); var list = a.OrderByDescending(x => x); var sum = a.Sum(x => x); int[] Array = list.ToArray(); long A = 0; int j; for (j = 0; 2 * j < n; j++) { A += Array[2 * j]; } var result = 2 * A - sum; Console.WriteLine(result); Console.Out.Flush(); } } }
[["-", 0, 200, 0, 212, 0, 213, 63, 214, 141, 22], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 141, 22], ["-", 8, 196, 0, 7, 15, 16, 31, 16, 17, 72], ["-", 8, 196, 0, 7, 15, 16, 31, 16, 12, 203], ["-", 12, 204, 206, 207, 0, 28, 0, 16, 17, 72], ["-", 12, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
8
227
6
using System; class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); string[] s = Console.ReadLine().Split(' '); int[] n = new int[50]; for (int i = 0; i < N; i++) { n[i] = int.Parse(s[i]); } int sum1 = 0; int sum2 = 0; Array.Sort(n); Array.Reverse(n); for (int i = 0; i < N; i++) { if (i % 2 == 0) sum1 += n[i]; else sum2 += n[i]; } Console.WriteLine(sum1 - sum2); } }
using System; class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); string[] s = Console.ReadLine().Split(' '); int[] n = new int[N]; for (int i = 0; i < N; i++) { n[i] = int.Parse(s[i]); } int sum1 = 0; int sum2 = 0; Array.Sort(n); Array.Reverse(n); for (int i = 0; i < N; i++) { if (i % 2 == 0) sum1 += n[i]; else sum2 += n[i]; } Console.WriteLine(sum1 - sum2); } }
[["-", 0, 212, 0, 227, 39, 224, 225, 226, 0, 203], ["+", 0, 212, 0, 227, 39, 224, 225, 226, 0, 22]]
8
164
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC088B { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); string[] str = Console.ReadLine().Split(' '); int[] an = new int[n]; for (int i = 0; i < n; i++) { an[i] = int.Parse(str[i]); } var orderan = from m in an orderby m descending select m; int sumofalice = 0; int sumofbob = 0; int j = 0; foreach (var item in orderan) { if (j % 2 == 0) { sumofalice = +item; } else { sumofbob = +item; } ++j; } Console.WriteLine("{0}", sumofalice - sumofbob); Console.Read(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC088B { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); string[] str = Console.ReadLine().Split(' '); int[] an = new int[n]; for (int i = 0; i < n; i++) { an[i] = int.Parse(str[i]); } var orderan = from m in an orderby m descending select m; int sumofalice = 0; int sumofbob = 0; int j = 0; foreach (var item in orderan) { if (j % 2 == 0) { sumofalice += item; } else { sumofbob += item; } ++j; } Console.WriteLine("{0}", sumofalice - sumofbob); Console.Read(); } } }
[["-", 64, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["-", 64, 196, 0, 1, 0, 11, 12, 241, 0, 72], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 107], ["-", 75, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["-", 75, 196, 0, 1, 0, 11, 12, 241, 0, 72], ["+", 75, 196, 0, 1, 0, 11, 0, 202, 0, 107]]
8
202
6