static void Solve() { Scan sc = new Scan(); write wr = new write(); int n = sc.intarr[0]; var k = sc.intarr; int d = k[0]; int x = k[1]; int ans = x; for (int i = 0; i < n; ++i) { int a = sc.intarr[0]; for (int j = 1; j <= d; j += a) { ans++; } } wr.wri(ans); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); long ans = INF; var x = sc.intarr; int D = x[0]; int G = x[1]; long[] p = new long[D]; long[] c = new long[D]; for (int i = 0; i < D; ++i) { var y = sc.intarr; p[i] = y[0]; c[i] = y[1]; } for (int bit = 0; bit < (1 << D); ++bit) { long sum = 0; long num = 0; for (int i = 0; i < D; ++i) { if (((bit >> i) & 1) == 1) { sum += c[i] + p[i] * 100 * (i + 1); num += p[i]; } } if (sum >= G) { ans = Math.Min(ans, num); } else { for (int i = D - 1; i >= 0; --i) { if (((bit >> i) & 1) == 1) { continue; } for (int k = 0; k < p[i]; ++k) { if (sum >= G) { break; } sum += 100 * (i + 1); ++num; } } ans = Math.Min(ans, num); } } wr.wri(ans); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var k = sc.intarr; int n = k[0]; var s = sc.chararr; bool han = false; foreach (var x in s) { if (x == 'Y') { han = true; } } if (han) { wr.wri("Four"); } else { wr.wri("Three"); } }
//static long GCD(long x,long y) //{ // if (y == 0) return x; // return GCD(y, x % y); //} //static long LCM(long x,long y) //{ // return x * y / GCD(x, y); //} //static int keta(int x) //{ // string s = x.ToString(); // return s[s.Length - 1]-'0'; //} static void Solve() { Scan sc = new Scan(); write wr = new write(); int N = sc.intarr[0]; if (N == 0) { wr.wri(0); return; } string s = ""; while (N != 0) { if (N % 2 != 0) { N = (N - 1) / -2; s = "1" + s; } else { N /= -2; s = "0" + s; } } wr.wri(s); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var N = sc.intarr[0]; if (N <= 104) { wr.wri(0); } else if (N <= 134) { wr.wri(1); } else if (N <= 164) { wr.wri(2); } else if (N <= 188) { wr.wri(3); } else if (N <= 194) { wr.wri(4); } else { wr.wri(5); } }
static void Solve() { Scan sc = new Scan(); write wr = new write(); int N = sc.intarr[0]; int[] dp = new int[N + 1]; dp[0] = 0; for (int i = 1; i <= N; ++i) { dp[i] = INF; } for (int i = 1; i <= N; ++i) { for (int j = 0; j < 12; ++j) { if (i - num[j] >= 0) { dp[i] = Math.Min(dp[i], dp[i - num[j]] + 1); } } } wr.wri(dp[N]); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var p1 = sc.longarr; long n = p1[0]; var a = sc.longarr; Array.Sort(a); Array.Reverse(a); long ans1 = 0, ans2 = 0;; for (int i = 0; i < a.Length; ++i) { if (i % 2 == 0) { ans1 += a[i]; } else { ans2 += a[i]; } } wr.wri(ans1 - ans2); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); int[] X = sc.intarr; int ans1 = -1; int ans2 = 1; for (int i = 0; i <= 100; ++i) { for (int j = 0; j <= 100; ++j) { for (int k = 0; k <= 100; ++k) { for (int l = 0; l <= 100; ++l) { int x = 100 * X[0] * i + 100 * X[1] * j; int y = X[2] * k + X[3] * l; if (x == 0 || x + y > X[5] || x * X[4] < y * 100) { continue; } else if (ans1 * (x + y) <= ans2 * y) { ans1 = y; ans2 = x + y; } } } } } wr.wri(ans2 + " " + ans1); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var ?? = sc.intarr; int a = ?? [0];
static void Solve() { Scan sc = new Scan(); write wr = new write(); int n = sc.intarr[0]; wr.wri((n + 1) / 2); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var X = sc.intarr; wr.wri((X[0] - 1) * (X[1] - 1)); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var x = sc.intarr; wr.wri(x[0] - x[1] + 1); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var x = sc.intarr; wr.wri(x.Max() - x.Min()); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var s = sc.intarr; int n = s[0]; wr.wri(n / 3); }
static void Main(string[] args) { cal c = (int a, int b) => a + b; write w = () => { Console.Write("dsd"); }; w(); }
public void Test() { write writer = WriteMessage; Add adder = AddTwoNumbers; writer("Marcin"); var sum = adder(1, 2); Console.WriteLine(sum); CheckTemperature(TooLowAlert, OptimalAlert, TooHighAlert); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var s = sc.intarr; int a = s[0]; int b = s[1]; wr.wri(Math.Max(Math.Max(a + b, a - b), a * b)); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); int[] s = sc.intarr; int N = s[0]; var A = sc.intarr; wr.wri(Math.Abs(A.Min() - A.Max())); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); string k1 = sc.str; string k2 = sc.str; string k3 = sc.str; wr.wri <string>(k1[0].ToString() + k2[1].ToString() + k3[2].ToString()); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var t = sc.intarr; int h = t[0]; int w = t[1]; bool ans = true; char[,] s = new char[h + 2, w + 2]; for (int i = 0; i < h + 2; ++i) { string ss = ""; if (i != h + 1 && i != 0) { ss = sc.str; } for (int j = 0; j < w + 2; ++j) { if (i == 0 || i == h + 1 || j == 0 || j == w + 1) { s[i, j] = '.'; } else { s[i, j] = ss[j - 1]; } } } for (int i = 1; i < h + 1; ++i) { for (int j = 1; j < w + 1; ++j) { if (s[i, j] == '#' && s[i - 1, j] == '.' && s[i + 1, j] == '.' && s[i, j - 1] == '.' && s[i, j + 1] == '.') { ans = false; } } } if (ans) { wr.wri("Yes"); } else { wr.wri("No"); } }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var s = sc.intarr; int a = s[0]; int b = s[1]; int c = s[2]; int k = sc.intarr[0]; wr.wri(a + b + c - Math.Max(Math.Max(a, b), c) + Math.Max(Math.Max(a, b), c) * Math.Pow(2, k)); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); int a = sc.intarr[0]; int b = sc.intarr[0]; int c = sc.intarr[0]; int d = sc.intarr[0]; wr.wri(Math.Min(a, b) + Math.Min(c, d)); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); bool ac = true; string S = sc.str; if (S[0] != 'A') { ac = false; } bool isC = false; int Ci = -1; for (int i = 2; i < S.Length - 1; ++i) { if (!isC && S[i] == 'C') { isC = true; Ci = i; } else if (isC && S[i] == 'C') { ac = false; } } if (!isC) { ac = false; } for (int i = 0; i < S.Length; ++i) { if (i != 0 && i != Ci) { if (S[i] < 'a') { ac = false; } } } if (ac) { wr.wri("AC"); } else { wr.wri("WA"); } }
public void test() { Add adder = AddNumbers; var sum = adder(3, 4); Console.WriteLine(sum); write wrtier = writeMessage; wrtier("daniel"); CheckTemperatures(TooLowAlert, OptimalAlert, TooHighAlert); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var k = sc.intarr; int n = k[0]; int m = 0, a = 0, r = 0, c = 0, h = 0; int[] k1 = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 2 }; int[] k2 = { 1, 1, 1, 2, 2, 3, 2, 2, 3, 3 }; int[] k3 = { 2, 3, 4, 3, 4, 4, 3, 4, 4, 4 }; for (int i = 0; i < n; ++i) { string s = sc.str; if (s[0] == 'M') { m++; } if (s[0] == 'A') { a++; } if (s[0] == 'R') { r++; } if (s[0] == 'C') { c++; } if (s[0] == 'H') { h++; } } long ans = 0; long[] d = { m, a, r, c, h }; for (int i = 0; i < 10; ++i) { ans += d[k1[i]] * d[k2[i]] * d[k3[i]]; } wr.wri(ans); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); int n = sc.intarr[0]; if (n % 3 == 0) { wr.wri("YES"); } else { wr.wri("NO"); } }
static void Solve() { Scan sc = new Scan(); write wr = new write(); int n = sc.intarr[0]; if (n <= 999) { wr.wri("ABC"); } else { wr.wri("ABD"); } }
static void Solve() { Scan sc = new Scan(); write wr = new write(); int n = sc.intarr[0]; if (n % digitsum(n) == 0) { wr.wri("Yes"); } else { wr.wri("No"); } }
static void Solve() { Scan sc = new Scan(); write wr = new write(); int N = sc.intarr[0]; var a = sc.longarr; long ans = 0; for (int i = 0; i < N; ++i) { ans += a[i] - 1; } wr.wri(ans); }
static void Solve() { Scan sc = new Scan(); write wr = new write(); var s = sc.longarr; if (s[2] <= s[0] + s[1]) { wr.wri("Yes"); } else { wr.wri("No"); } }
public locktype() { this.writeField = new write(); }