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; using System.Collections.Generic; using System.IO; using System.Linq; namespace C { public class Program { static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); Solve(); Console.Out.Flush(); } public static void Solve() { var nk = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray(); var ai = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray(); var n = nk[0]; var k = nk[1]; Console.WriteLine((n - k + 1) / (k - 1) + 1); } } }
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; namespace C { public class Program { static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); Solve(); Console.Out.Flush(); } public static void Solve() { var nk = Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray(); var ai = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray(); var n = nk[0]; var k = nk[1]; Console.WriteLine(Math.Ceiling((n - 1) / (k - 1))); } } }
[["-", 205, 213, 3, 4, 0, 28, 0, 214, 205, 199], ["+", 205, 213, 3, 4, 0, 28, 0, 214, 205, 199], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 205, 22], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 0, 131], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["+", 3, 4, 0, 28, 0, 16, 31, 23, 0, 24], ["-", 31, 16, 31, 23, 0, 16, 31, 16, 12, 22], ["-", 0, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203], ["+", 3, 4, 0, 28, 0, 213, 3, 4, 0, 25]]
8
189
11
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading.Tasks; using System.Globalization; using System.Collections; namespace Atcoder { class Pair : IComparable { public int x; public int y; public Pair(int X, int Y) { x = X; y = Y; } public int CompareTo(object obj) { Pair kore = (Pair)obj; if (x != kore.x) { return x.CompareTo(kore.x); } else { return y.CompareTo(kore.y); } } public static bool operator <=(Pair p1, Pair p2) { if (p1.x != p2.x) { return p1.x <= p2.x; } else { return p1.y <= p2.y; } } public static bool operator >=(Pair p1, Pair p2) { if (p1.x != p2.x) { return p1.x >= p2.x; } else { return p1.y >= p2.y; } } } class Program { public static List<Pair>[ , ] pairs; public static int[,] ans; static void Main(string[] args) { long mod = 1000000007; StreamScanner scan = new StreamScanner(System.Console.OpenStandardInput()); int n = scan.Integer(); int k = scan.Integer(); Console.WriteLine(n / (k - 1)); } static int binary_search<T>(T key, T[] moto, Func<int, T, T[], bool> isok) { int ng = -1; int ok = moto.Length; while (Math.Abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (isok(mid, key, moto)) { ok = mid; } else { ng = mid; } } return ok; } static int binary_search(int key, int[] moto) { int ng = -1; int ok = moto.Length; while (Math.Abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (isOK(mid, key, moto)) { ok = mid; } else { ng = mid; } } return ok; } static bool isOK(int index, int key, int[] moto) { return moto[index] > key; } public static int bitCount(int k) { uint i = (uint)k; i = i - ((i >> 1) & 0x55555555); i = (i & 0x33333333) + ((i >> 2) & 0x33333333); i = (i + (i >> 4)) & 0x0f0f0f0f; i = i + (i >> 8); i = i + (i >> 16); return (int)i & 0x3f; } static int check(long moto, long tai) { if (tai % moto != 0) { return 0; } while (tai > 1) { if (tai % moto == 0) { tai /= moto; } else if (tai > moto) { tai %= moto; } else { tai -= moto; } } if (tai == 1) { return 1; } else { return 0; } } static bool NextPermutation(int[] array) { var size = array.Length; var ok = false; // array[i]<array[i+1]を満たす最大のiを求める int i = size - 2; for (; 0 <= i; i--) { if (array[i] < array[i + 1]) { ok = true; break; } } //全ての要素が降順の場合、NextPermutationは存在しない if (ok == false) return false; // array[i]<array[j]を満たす最大のjを求める int j = size - 1; for (;; j--) { if (array[i] < array[j]) break; } // iとjの要素をswapする var tmp = array[i]; array[i] = array[j]; array[j] = tmp; // i以降の要素を反転させる Array.Reverse(array, i + 1, size - (i + 1)); return true; } static List<int[]> GetAllPermutation(int N) { var res = new List<int[]>(); var array = Enumerable.Range(0, N).ToArray(); do { var copy = new int[N]; array.CopyTo(copy, 0); res.Add(copy); } while (NextPermutation(array)); return res; } static List<int[]> GetAllPermutation(int[] array) { var size = array.Length; var res = new List<int[]>(); do { var copy = new int[size]; array.CopyTo(copy, 0); res.Add(copy); } while (NextPermutation(array)); return res; } static long Syakutori( int[] a, long k) //しゃくとり法モデル:連続部分列に含まれるすべての要素の値の和がK以上 { long sum = 0; int right = 0; long ans = 0; for (int left = 0; left < a.Length; left++) { while (right < a.Length && sum < k) { sum += a[right]; right++; } if (k <= sum) { ans += a.Length - right + 1; } if (left == right) { right++; } else { sum -= a[left]; } } return ans; } static int[] zalgo(String s) { int n = s.Length; int[] ret = new int[n]; ret[0] = n; int i = 1, j = 0; while (i < n) { while (i + j < n && s[j] == s[i + j]) ++j; ret[i] = j; if (j == 0) { ++i; continue; } int k = 1; while (i + k < n && k + ret[k] < j) { ret[i + k] = ret[k]; ++k; } i += k; j -= k; } return ret; } static int gcd(int a, int b) { if (a % b == 0) { return b; } return gcd(b, a % b); } static long gcd(long a, long b) { if (a % b == 0) { return b; } return gcd(b, a % b); } public static List<long> factorialMemo = new List<long>() { 1 }; static long fact(int x) { for (int i = factorialMemo.Count; i <= x; i++) factorialMemo.Add(factorialMemo.Last() * i); return factorialMemo[x]; } static int[] yousogotoplus(int[] a, int[] b) { int[] c = new int[a.Length]; for (int i = 0; i < a.Length; i++) { c[i] = a[i] + b[i]; } return c; } static int[] yousogotoplus(int[] a, int[,] b, int l) { int[] c = new int[a.Length]; for (int i = 0; i < a.Length; i++) { c[i] = a[i] + b[l, i]; } return c; } static int[] yousogotoplus(int[,] a, int l) { int[] c = new int[a.GetLength(1)]; for (int i = 0; i < a.GetLength(1); i++) { c[i] = a[l, i]; } return c; } static int nibutan(int med, int[] a) // med以上が何個あるか { int mae = 0; int ato = a.Length; while (true) { if (ato - mae <= 1) { return mae; } int mid = (mae + ato) / 2; if (a[mid] > med) { ato = mid; } if (a[mid] <= med) { mae = mid; } } } static long DivideWith(long m, long n, List<long> primes) { while (m % n == 0) { primes.Add(n); m = m / n; } return m; } static long[] SoinsuBunkai(long num) { if (num == 1) return new long[] { 1 }; List<long> primes = new List<long>(); long n = DivideWith(num, 2, primes); n = DivideWith(n, 3, primes); n = DivideWith(n, 5, primes); long i = 0; while (n > 1) { int[] ps = { 7, 11, 13, 17, 19, 23, 29, 31 }; foreach (var p in ps) { // 30m+2, 30m+3, 30m+4, 30m+5, 30m+6、30m+8... は割る必要はない。 n = DivideWith(n, i + p, primes); if (n == 1) break; } i += 30; } return primes.ToArray(); } public static int h; public static int w; public static int BFS(int height, int width, char[,] map) { int[] dx = new int[] { -1, 0, 0, 1 }; int[] dy = new int[] { 0, 1, -1, 0 }; bool[,] visited = new bool[h, w]; int[,] len = new int[h, w]; var queue = new Queue<Tuple<int, int>>(); queue.Enqueue(new Tuple<int, int>(height, width)); int max = 0; visited[height, width] = true; while (queue.Count > 0) { var now = queue.Dequeue(); for (int i = 0; i < 4; i++) { int ny = now.Item1 + dy[i]; int nx = now.Item2 + dx[i]; if (ny >= h || ny < 0 || nx >= w || nx < 0) continue; if (visited[ny, nx] || map[ny, nx] == '#') continue; visited[ny, nx] = true; len[ny, nx] = len[now.Item1, now.Item2] + 1; max = Math.Max(max, len[ny, nx]); queue.Enqueue(new Tuple<int, int>(ny, nx)); } } return max; } } public class StreamScanner { public StreamScanner(Stream stream) { str = stream; } private readonly Stream str; private readonly byte[] buf = new byte[1024]; private int len, ptr; public bool isEof = false; public bool IsEndOfStream { get { return isEof; } } private byte read() { if (isEof) throw new EndOfStreamException(); if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } } return buf[ptr++]; } public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; } public char[] Char(int n) { char[] kore = new char[n]; for (int i = 0; i < n; i++) { kore[i] = Char(); } return kore; } public string Scan() { var sb = new StringBuilder(); for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b); return sb.ToString(); } public long Long() { long ret = 0; byte b = 0; var ng = false; do b = read(); while (b != '-' && (b < '0' || '9' < b)); if (b == '-') { ng = true; b = read(); } for (; true; b = read()) { if (b < '0' || '9' < b) return ng ? -ret : ret; else ret = ret * 10 + b - '0'; } } public long[] Long(long n) { long[] kore = new long[n]; for (int i = 0; i < n; i++) { kore[i] = Long(); } return kore; } public Mlong[] MLong(long n) { Mlong[] kore = new Mlong[n]; for (int i = 0; i < n; i++) { kore[i] = Long(); } return kore; } public long[,] Long(long h, long w) { long[,] kore = new long[h, w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { kore[i, j] = Long(); } } return kore; } public int Integer() { return (int)Long(); } public Mint[] MInteger(long n) { Mint[] kore = new Mint[n]; for (int i = 0; i < n; i++) { kore[i] = Integer(); } return kore; } public int[] Integer(long n) { int[] kore = new int[n]; for (int i = 0; i < n; i++) { kore[i] = (int)Long(); } return kore; } public int[,] Integer(long h, long w) { int[,] kore = new int[h, w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { kore[i, j] = (int)Long(); } } return kore; } public int[] StringToInt(int n) { char[] s = Scan().ToCharArray(); int[] kore = new int[n]; for (int i = 0; i < n; i++) { kore[i] = s[i] - '0'; } return kore; } public int[,] StringToInt(int h, int w) { int[,] kore = new int[h, w]; for (int i = 0; i < h; i++) { char[] s = Scan().ToCharArray(); for (int j = 0; j < w; j++) { kore[i, j] = s[j] - '0'; } } return kore; } public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); } } public class UnionFind { public int[] data; public UnionFind(int size) { data = new int[size]; for (int i = 0; i < size; i++) data[i] = -1; } public bool Unite(int x, int y) { x = Root(x); y = Root(y); if (x != y) { if (data[y] < data[x]) { var tmp = y; y = x; x = tmp; } data[x] += data[y]; data[y] = x; } return x != y; } public bool IsSameGroup(int x, int y) { return Root(x) == Root(y); } public int Root(int x) { return data[x] < 0 ? x : data[x] = Root(data[x]); } } public class Mlong : IComparable { private static long mod = 1000000007; public long num; public Mlong(long num) { this.num = num; } public override int GetHashCode() { return num.GetHashCode(); } public override bool Equals(object obj) { return num.Equals(obj); } public static Mlong operator +(Mlong x, Mlong y) { return new Mlong((x.num + y.num) % mod); } public static Mlong operator -(Mlong x, Mlong y) { return new Mlong((x.num - y.num + mod) % mod); } public static Mlong operator *(Mlong x, Mlong y) { return new Mlong((long)(((1L * x.num) * y.num) % mod)); } public Mlong hutujyo(Mlong x) { return new Mlong(num / x.num); } static long GetInverse(long a) { long div, p = mod, x1 = 1, y1 = 0, x2 = 0, y2 = 1; while (true) { if (p == 1) return x2 + mod; div = a / p; x1 -= x2 * div; y1 -= y2 * div; a %= p; if (a == 1) return x1 + mod; div = p / a; x2 -= x1 * div; y2 -= y1 * div; p %= a; } } public Mlong modjyo(Mlong x) { return num * GetInverse(x.num) % mod; } public static implicit operator Mlong(long x) { return new Mlong(x); } public static Mlong operator %(Mlong x, Mlong y) { return new Mlong(x.num % y.num); } public static explicit operator long(Mlong x) { return x.num; } public static bool operator ==(Mlong x, Mlong y) { return x.num == y.num; } public static bool operator !=(Mlong x, Mlong y) { return x.num != y.num; } public static bool operator<(Mlong x, Mlong y) { return x.num < y.num; } public static bool operator>(Mlong x, Mlong y) { return x.num > y.num; } public static bool operator <=(Mlong x, Mlong y) { return x.num <= y.num; } public static bool operator >=(Mlong x, Mlong y) { return x.num >= y.num; } public Mlong Pow(Mlong n) { Mlong pow = this; Mlong res = 1; while (n > 0) { if (n % 2 == 1) { res *= pow; } pow *= pow; n.hutujyo(2); } /* if (n == 1) { return this % mod; } if (n % 2 == 1) { return (this * Pow(n - 1)) % mod; } Mint buf = Pow(n.hutujyo(2)); return (buf * buf) % mod;*/ return res; } public static Mlong Pow(Mlong a, Mlong n) { return a.Pow(n); } public static List<Mlong> factorialMemo = new List<Mlong>() { 1 }; static Mlong Factorial(int x) { for (int i = factorialMemo.Count; i <= x; i++) factorialMemo.Add(factorialMemo.Last() * i); return factorialMemo[x]; } public static Mlong Comb(Mlong n, Mlong a) { Mlong buf1 = 1; Mlong buf2 = 1; for (long i = 0; i < a.num; i++) { buf1 *= n - i; buf2 *= (i + 1); } return buf1.modjyo(buf2); } public static Mlong Comb(int n, int r) { return Factorial(n).modjyo(Factorial(r)).modjyo(Factorial(n - r)); } public static void WriteLine(Mlong x) { Console.WriteLine(x.num); } public int CompareTo(object obj) { Mlong kore = (Mlong)obj; return num.CompareTo(kore.num); } } public class Mint : IComparable { public static int mod = 1000000007; public int num; public Mint(int Num) { num = Num; } public override int GetHashCode() { return num.GetHashCode(); } public override bool Equals(object obj) { return num.Equals(obj); } public static Mint operator +(Mint x, Mint y) { return new Mint((x.num + y.num) % mod); } public static Mint operator -(Mint x, Mint y) { return new Mint((x.num - y.num + mod) % mod); } public static Mint operator *(Mint x, Mint y) { return new Mint((int)(((1L * x.num) * y.num) % mod)); } public Mint hutujyo(Mint x) { return new Mint(num / x.num); } static int GetInverse(long a) { long div, p = mod, x1 = 1, y1 = 0, x2 = 0, y2 = 1; while (true) { if (p == 1) return (int)(x2 + mod); div = a / p; x1 -= x2 * div; y1 -= y2 * div; a %= p; if (a == 1) return (int)(x1 + mod); div = p / a; x2 -= x1 * div; y2 -= y1 * div; p %= a; } } public Mint modjyo(Mint x) { return num * GetInverse(x.num) % mod; } /* public Mint modjyo(Mint x) { return num * x.Pow(mod - 2); }*/ public static implicit operator Mint(int x) { return new Mint(x); } public static Mint[] Toarray(int[] x) { Mint[] buf = new Mint[x.Length]; for (int i = 0; i < x.Length; i++) { buf[i] = x[i]; } return buf; } public static explicit operator int(Mint x) { return x.num; } public static Mint operator %(Mint x, Mint y) { return new Mint(x.num % y.num); } public static bool operator ==(Mint x, Mint y) { return x.num == y.num; } public static bool operator !=(Mint x, Mint y) { return x.num != y.num; } public static bool operator<(Mint x, Mint y) { return x.num < y.num; } public static bool operator>(Mint x, Mint y) { return x.num > y.num; } public static bool operator <=(Mint x, Mint y) { return x.num <= y.num; } public static bool operator >=(Mint x, Mint y) { return x.num >= y.num; } public Mint Pow(Mint n) { Mint pow = this; Mint res = 1; while (n > 0) { if (n % 2 == 1) { res *= pow; } pow *= pow; n.hutujyo(2); } /* if (n == 1) { return this % mod; } if (n % 2 == 1) { return (this * Pow(n - 1)) % mod; } Mint buf = Pow(n.hutujyo(2)); return (buf * buf) % mod;*/ return res; } public static Mint Pow(Mint a, Mint n) { return a.Pow(n); } public static List<Mint> factorialMemo = new List<Mint>() { 1 }; static Mint Factorial(int x) { for (int i = factorialMemo.Count; i <= x; i++) factorialMemo.Add(factorialMemo.Last() * i); return factorialMemo[x]; } public static Mint Comb(int n, int r) { return Factorial(n).modjyo(Factorial(r)).modjyo(Factorial(n - r)); } public static void WriteLine(Mint x) { Console.WriteLine(x.num); } public int CompareTo(object obj) { Mint kore = (Mint)obj; return num.CompareTo(kore.num); } } public class PriorityQueue<T> : IEnumerable<T> { private readonly List<T> _data = new List<T>(); private readonly IComparer<T> _comparer; private readonly bool _isDescending; public PriorityQueue(IComparer<T> comparer, bool isDescending = true) { _comparer = comparer; _isDescending = isDescending; } public PriorityQueue(Comparison<T> comparison, bool isDescending = true) : this(Comparer<T>.Create(comparison), isDescending) {} public PriorityQueue(bool isDescending = true) : this(Comparer<T>.Default, isDescending) {} public void Enqueue(T item) { _data.Add(item); var childIndex = _data.Count - 1; while (childIndex > 0) { var parentIndex = (childIndex - 1) / 2; if (Compare(_data[childIndex], _data[parentIndex]) >= 0) break; Swap(childIndex, parentIndex); childIndex = parentIndex; } } public T Dequeue() { var lastIndex = _data.Count - 1; var firstItem = _data[0]; _data[0] = _data[lastIndex]; _data.RemoveAt(lastIndex--); var parentIndex = 0; while (true) { var childIndex = parentIndex * 2 + 1; if (childIndex > lastIndex) break; var rightChild = childIndex + 1; if (rightChild <= lastIndex && Compare(_data[rightChild], _data[childIndex]) < 0) childIndex = rightChild; if (Compare(_data[parentIndex], _data[childIndex]) <= 0) break; Swap(parentIndex, childIndex); parentIndex = childIndex; } return firstItem; } public T Peek() { return _data[0]; } private void Swap(int a, int b) { var tmp = _data[a]; _data[a] = _data[b]; _data[b] = tmp; } private int Compare(T a, T b) { return _isDescending ? _comparer.Compare(b, a) : _comparer.Compare(a, b); } public int Count => _data.Count; public IEnumerator<T> GetEnumerator() { return _data.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } public class Tree { public Node[] Nodes; public List<int[]> hen; public class Node { public int? parent = null; public List<int[]> children = new List<int[]>(); public int parentcolor = -1; } public Tree(int kosu) { Nodes = new Node[kosu]; for (int i = 0; i < Nodes.Length; i++) { Nodes[i] = new Node(); } hen = new List<int[]>(); } public void Connect(int oya, int ko, int id) { hen.Add(new int[] { oya, ko, 0 }); Nodes[oya].children.Add(new int[] { ko, id }); Nodes[ko].parent = oya; } } /// <summary> /// Self-Balancing Binary Search Tree /// (using Randamized BST) /// </summary> public class SB_BinarySearchTree<T> where T : IComparable { public class Node { public T Value; public Node LChild; public Node RChild; public int Count; // size of the sub tree public Node(T v) { Value = v; Count = 1; } } static Random _rnd = new Random(); public static int Count(Node t) { return t == null ? 0 : t.Count; } static Node Update(Node t) { t.Count = Count(t.LChild) + Count(t.RChild) + 1; return t; } public static Node Merge(Node l, Node r) { if (l == null || r == null) return l == null ? r : l; if ((double)Count(l) / (double)(Count(l) + Count(r)) > _rnd.NextDouble()) { l.RChild = Merge(l.RChild, r); return Update(l); } else { r.LChild = Merge(l, r.LChild); return Update(r); } } /// <summary> /// split as [0, k), [k, n) /// </summary> public static Tuple<Node, Node> Split(Node t, int k) { if (t == null) return new Tuple<Node, Node>(null, null); if (k <= Count(t.LChild)) { var s = Split(t.LChild, k); t.LChild = s.Item2; return new Tuple<Node, Node>(s.Item1, Update(t)); } else { var s = Split(t.RChild, k - Count(t.LChild) - 1); t.RChild = s.Item1; return new Tuple<Node, Node>(Update(t), s.Item2); } } public static Node Remove(Node t, T v) { if (Find(t, v) == null) return t; return RemoveAt(t, LowerBound(t, v)); } public static Node RemoveAt(Node t, int k) { var s = Split(t, k); var s2 = Split(s.Item2, 1); return Merge(s.Item1, s2.Item2); } public static bool Contains(Node t, T v) { return Find(t, v) != null; } public static Node Find(Node t, T v) { while (t != null) { var cmp = t.Value.CompareTo(v); if (cmp > 0) t = t.LChild; else if (cmp < 0) t = t.RChild; else break; } return t; } public static Node FindByIndex(Node t, int idx) { if (t == null) return null; var currentIdx = Count(t) - Count(t.RChild) - 1; while (t != null) { if (currentIdx == idx) return t; if (currentIdx > idx) { t = t.LChild; currentIdx -= (Count(t == null ? null : t.RChild) + 1); } else { t = t.RChild; currentIdx += (Count(t == null ? null : t.LChild) + 1); } } return null; } public static int UpperBound(Node t, T v) { var torg = t; if (t == null) return -1; var ret = Int32.MaxValue; var idx = Count(t) - Count(t.RChild) - 1; while (t != null) { var cmp = t.Value.CompareTo(v); if (cmp > 0) { ret = Math.Min(ret, idx); t = t.LChild; idx -= (Count(t == null ? null : t.RChild) + 1); } else if (cmp <= 0) { t = t.RChild; idx += (Count(t == null ? null : t.LChild) + 1); } } return ret == Int32.MaxValue ? Count(torg) : ret; } public static int LowerBound(Node t, T v) { var torg = t; if (t == null) return -1; var idx = Count(t) - Count(t.RChild) - 1; var ret = Int32.MaxValue; while (t != null) { var cmp = t.Value.CompareTo(v); if (cmp >= 0) { if (cmp == 0) ret = Math.Min(ret, idx); t = t.LChild; if (t == null) ret = Math.Min(ret, idx); idx -= t == null ? 0 : (Count(t.RChild) + 1); } else if (cmp < 0) { t = t.RChild; idx += (Count(t == null ? null : t.LChild) + 1); if (t == null) return idx; } } // return ret; return ret == Int32.MaxValue ? Count(torg) : ret; } public static Node Insert(Node t, T v) { var ub = LowerBound(t, v); return InsertByIdx(t, ub, v); } static Node InsertByIdx(Node t, int k, T v) { var s = Split(t, k); return Merge(Merge(s.Item1, new Node(v)), s.Item2); } public static IEnumerable<T> Enumerate(Node t) { var ret = new List<T>(); Enumerate(t, ret); return ret; } static void Enumerate(Node t, List<T> ret) { if (t == null) return; Enumerate(t.LChild, ret); ret.Add(t.Value); Enumerate(t.RChild, ret); } } /// <summary> /// C-like set /// </summary> public class Set<T> where T : IComparable { protected SB_BinarySearchTree<T>.Node _root; public T this[int idx] { get { return ElementAt(idx); } } public int Count() { return SB_BinarySearchTree<T>.Count(_root); } public virtual void Insert(T v) { if (_root == null) _root = new SB_BinarySearchTree<T>.Node(v); else { if (SB_BinarySearchTree<T>.Find(_root, v) != null) return; _root = SB_BinarySearchTree<T>.Insert(_root, v); } } public void Clear() { _root = null; } public void Remove(T v) { _root = SB_BinarySearchTree<T>.Remove(_root, v); } public bool Contains(T v) { return SB_BinarySearchTree<T>.Contains(_root, v); } public T ElementAt(int k) { var node = SB_BinarySearchTree<T>.FindByIndex(_root, k); if (node == null) throw new IndexOutOfRangeException(); return node.Value; } public int Count(T v) { return SB_BinarySearchTree<T>.UpperBound(_root, v) - SB_BinarySearchTree<T>.LowerBound(_root, v); } public int LowerBound(T v) { return SB_BinarySearchTree<T>.LowerBound(_root, v); } public int UpperBound(T v) { return SB_BinarySearchTree<T>.UpperBound(_root, v); } public Tuple<int, int> EqualRange(T v) { if (!Contains(v)) return new Tuple<int, int>(-1, -1); return new Tuple<int, int>(SB_BinarySearchTree<T>.LowerBound(_root, v), SB_BinarySearchTree<T>.UpperBound(_root, v) - 1); } public List<T> ToList() { return new List<T>(SB_BinarySearchTree<T>.Enumerate(_root)); } } /// <summary> /// C-like multiset /// </summary> public class MultiSet<T> : Set<T> where T : IComparable { public override void Insert(T v) { if (_root == null) _root = new SB_BinarySearchTree<T>.Node(v); else _root = SB_BinarySearchTree<T>.Insert(_root, v); } } public class RollingHashSlow { public const long B = (long)1e5 + 7; public const long MOD = (long)1e9 + 7; public string S { get; set; } public int N { get; set; } public long[] Power { get; set; } public long[] Hash { get; set; } public RollingHashSlow(string s) { this.S = s; this.N = s.Length; // B^nを計算しておく this.Power = new long[this.N + 1]; this.Power[0] = 1; for (int i = 0; i < N; i++) { this.Power[i + 1] = (this.Power[i] * B) % MOD; } // ハッシュを前計算する this.Hash = new long[this.N + 1]; for (int i = 0; i < N; i++) { this.Hash[i + 1] = (this.Hash[i] * B + S[i]) % MOD; } } // S[l, r) のハッシュ値を求める public long Get(int l, int r) { var hash = this.Hash[r] - (this.Hash[l] * this.Power[r - l] % MOD); if (hash < 0) hash += MOD; return hash; } } class RollingHashFast { public const ulong B = (ulong)1e9 + 7; public string S { get; set; } public int N { get; set; } public ulong[] Power { get; set; } public ulong[] Hash { get; set; } public RollingHashFast(string s) { this.S = s; this.N = s.Length; // B^nを計算しておく this.Power = new ulong[this.N + 1]; this.Power[0] = 1; for (int i = 0; i < N; i++) { this.Power[i + 1] = this.Power[i] * B; } // ハッシュを前計算する this.Hash = new ulong[this.N + 1]; for (int i = 0; i < N; i++) { this.Hash[i + 1] = this.Hash[i] * B + S[i]; } } // [l, r) のハッシュ値を求める public ulong Get(int l, int r) { var hash = this.Hash[r] - (this.Hash[l] * this.Power[r - l]); return hash; } } class Segtree<T> { int n; T[] tree; Func<T, T, T> f; T exnum; public Segtree(int m, Func<T, T, T> f, T ex) { this.f = f; this.exnum = ex; n = 1; while (n < m) n <<= 1; tree = new T[(n << 1) - 1]; for (int i = 0; i < tree.Length; i++) tree[i] = ex; } public Segtree(int m, T ini, Func<T, T, T> f, T ex) : this(m, f, ex) { for (int i = 0; i < m; ++i) tree[i + n - 1] = ini; all_update(); } public void assign_without_update(int j, T x) { tree[j + n - 1] = x; } public void update(int j, T x) { int i = j + n - 1; tree[i] = x; while (i > 0) { i = (i - 1) >> 1; tree[i] = f(tree[(i << 1) + 1], tree[(i << 1) + 2]); } } public void all_update() { for (int i = n - 2; i >= 0; i--) tree[i] = f(tree[(i << 1) + 1], tree[(i << 1) + 2]); } public T look(int i) { return tree[i + n - 1]; } // [s, t) public T run(int s, int t) { return query(s, t, 0, 0, n); } T query(int s, int t, int k, int l, int r) { if (r <= s || t <= l) return exnum; if (s <= l && r <= t) return tree[k]; return f(query(s, t, (k << 1) + 1, l, (l + r) >> 1), query(s, t, (k + 1) << 1, (l + r) >> 1, r)); } } }
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading.Tasks; using System.Globalization; using System.Collections; namespace Atcoder { class Pair : IComparable { public int x; public int y; public Pair(int X, int Y) { x = X; y = Y; } public int CompareTo(object obj) { Pair kore = (Pair)obj; if (x != kore.x) { return x.CompareTo(kore.x); } else { return y.CompareTo(kore.y); } } public static bool operator <=(Pair p1, Pair p2) { if (p1.x != p2.x) { return p1.x <= p2.x; } else { return p1.y <= p2.y; } } public static bool operator >=(Pair p1, Pair p2) { if (p1.x != p2.x) { return p1.x >= p2.x; } else { return p1.y >= p2.y; } } } class Program { public static List<Pair>[ , ] pairs; public static int[,] ans; static void Main(string[] args) { long mod = 1000000007; StreamScanner scan = new StreamScanner(System.Console.OpenStandardInput()); int n = scan.Integer(); int k = scan.Integer(); Console.WriteLine(Math.Ceiling((n - 1) * 1.0 / (k - 1))); } static int binary_search<T>(T key, T[] moto, Func<int, T, T[], bool> isok) { int ng = -1; int ok = moto.Length; while (Math.Abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (isok(mid, key, moto)) { ok = mid; } else { ng = mid; } } return ok; } static int binary_search(int key, int[] moto) { int ng = -1; int ok = moto.Length; while (Math.Abs(ok - ng) > 1) { int mid = (ok + ng) / 2; if (isOK(mid, key, moto)) { ok = mid; } else { ng = mid; } } return ok; } static bool isOK(int index, int key, int[] moto) { return moto[index] > key; } public static int bitCount(int k) { uint i = (uint)k; i = i - ((i >> 1) & 0x55555555); i = (i & 0x33333333) + ((i >> 2) & 0x33333333); i = (i + (i >> 4)) & 0x0f0f0f0f; i = i + (i >> 8); i = i + (i >> 16); return (int)i & 0x3f; } static int check(long moto, long tai) { if (tai % moto != 0) { return 0; } while (tai > 1) { if (tai % moto == 0) { tai /= moto; } else if (tai > moto) { tai %= moto; } else { tai -= moto; } } if (tai == 1) { return 1; } else { return 0; } } static bool NextPermutation(int[] array) { var size = array.Length; var ok = false; // array[i]<array[i+1]を満たす最大のiを求める int i = size - 2; for (; 0 <= i; i--) { if (array[i] < array[i + 1]) { ok = true; break; } } //全ての要素が降順の場合、NextPermutationは存在しない if (ok == false) return false; // array[i]<array[j]を満たす最大のjを求める int j = size - 1; for (;; j--) { if (array[i] < array[j]) break; } // iとjの要素をswapする var tmp = array[i]; array[i] = array[j]; array[j] = tmp; // i以降の要素を反転させる Array.Reverse(array, i + 1, size - (i + 1)); return true; } static List<int[]> GetAllPermutation(int N) { var res = new List<int[]>(); var array = Enumerable.Range(0, N).ToArray(); do { var copy = new int[N]; array.CopyTo(copy, 0); res.Add(copy); } while (NextPermutation(array)); return res; } static List<int[]> GetAllPermutation(int[] array) { var size = array.Length; var res = new List<int[]>(); do { var copy = new int[size]; array.CopyTo(copy, 0); res.Add(copy); } while (NextPermutation(array)); return res; } static long Syakutori( int[] a, long k) //しゃくとり法モデル:連続部分列に含まれるすべての要素の値の和がK以上 { long sum = 0; int right = 0; long ans = 0; for (int left = 0; left < a.Length; left++) { while (right < a.Length && sum < k) { sum += a[right]; right++; } if (k <= sum) { ans += a.Length - right + 1; } if (left == right) { right++; } else { sum -= a[left]; } } return ans; } static int[] zalgo(String s) { int n = s.Length; int[] ret = new int[n]; ret[0] = n; int i = 1, j = 0; while (i < n) { while (i + j < n && s[j] == s[i + j]) ++j; ret[i] = j; if (j == 0) { ++i; continue; } int k = 1; while (i + k < n && k + ret[k] < j) { ret[i + k] = ret[k]; ++k; } i += k; j -= k; } return ret; } static int gcd(int a, int b) { if (a % b == 0) { return b; } return gcd(b, a % b); } static long gcd(long a, long b) { if (a % b == 0) { return b; } return gcd(b, a % b); } public static List<long> factorialMemo = new List<long>() { 1 }; static long fact(int x) { for (int i = factorialMemo.Count; i <= x; i++) factorialMemo.Add(factorialMemo.Last() * i); return factorialMemo[x]; } static int[] yousogotoplus(int[] a, int[] b) { int[] c = new int[a.Length]; for (int i = 0; i < a.Length; i++) { c[i] = a[i] + b[i]; } return c; } static int[] yousogotoplus(int[] a, int[,] b, int l) { int[] c = new int[a.Length]; for (int i = 0; i < a.Length; i++) { c[i] = a[i] + b[l, i]; } return c; } static int[] yousogotoplus(int[,] a, int l) { int[] c = new int[a.GetLength(1)]; for (int i = 0; i < a.GetLength(1); i++) { c[i] = a[l, i]; } return c; } static int nibutan(int med, int[] a) // med以上が何個あるか { int mae = 0; int ato = a.Length; while (true) { if (ato - mae <= 1) { return mae; } int mid = (mae + ato) / 2; if (a[mid] > med) { ato = mid; } if (a[mid] <= med) { mae = mid; } } } static long DivideWith(long m, long n, List<long> primes) { while (m % n == 0) { primes.Add(n); m = m / n; } return m; } static long[] SoinsuBunkai(long num) { if (num == 1) return new long[] { 1 }; List<long> primes = new List<long>(); long n = DivideWith(num, 2, primes); n = DivideWith(n, 3, primes); n = DivideWith(n, 5, primes); long i = 0; while (n > 1) { int[] ps = { 7, 11, 13, 17, 19, 23, 29, 31 }; foreach (var p in ps) { // 30m+2, 30m+3, 30m+4, 30m+5, 30m+6、30m+8... は割る必要はない。 n = DivideWith(n, i + p, primes); if (n == 1) break; } i += 30; } return primes.ToArray(); } public static int h; public static int w; public static int BFS(int height, int width, char[,] map) { int[] dx = new int[] { -1, 0, 0, 1 }; int[] dy = new int[] { 0, 1, -1, 0 }; bool[,] visited = new bool[h, w]; int[,] len = new int[h, w]; var queue = new Queue<Tuple<int, int>>(); queue.Enqueue(new Tuple<int, int>(height, width)); int max = 0; visited[height, width] = true; while (queue.Count > 0) { var now = queue.Dequeue(); for (int i = 0; i < 4; i++) { int ny = now.Item1 + dy[i]; int nx = now.Item2 + dx[i]; if (ny >= h || ny < 0 || nx >= w || nx < 0) continue; if (visited[ny, nx] || map[ny, nx] == '#') continue; visited[ny, nx] = true; len[ny, nx] = len[now.Item1, now.Item2] + 1; max = Math.Max(max, len[ny, nx]); queue.Enqueue(new Tuple<int, int>(ny, nx)); } } return max; } } public class StreamScanner { public StreamScanner(Stream stream) { str = stream; } private readonly Stream str; private readonly byte[] buf = new byte[1024]; private int len, ptr; public bool isEof = false; public bool IsEndOfStream { get { return isEof; } } private byte read() { if (isEof) throw new EndOfStreamException(); if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } } return buf[ptr++]; } public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; } public char[] Char(int n) { char[] kore = new char[n]; for (int i = 0; i < n; i++) { kore[i] = Char(); } return kore; } public string Scan() { var sb = new StringBuilder(); for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b); return sb.ToString(); } public long Long() { long ret = 0; byte b = 0; var ng = false; do b = read(); while (b != '-' && (b < '0' || '9' < b)); if (b == '-') { ng = true; b = read(); } for (; true; b = read()) { if (b < '0' || '9' < b) return ng ? -ret : ret; else ret = ret * 10 + b - '0'; } } public long[] Long(long n) { long[] kore = new long[n]; for (int i = 0; i < n; i++) { kore[i] = Long(); } return kore; } public Mlong[] MLong(long n) { Mlong[] kore = new Mlong[n]; for (int i = 0; i < n; i++) { kore[i] = Long(); } return kore; } public long[,] Long(long h, long w) { long[,] kore = new long[h, w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { kore[i, j] = Long(); } } return kore; } public int Integer() { return (int)Long(); } public Mint[] MInteger(long n) { Mint[] kore = new Mint[n]; for (int i = 0; i < n; i++) { kore[i] = Integer(); } return kore; } public int[] Integer(long n) { int[] kore = new int[n]; for (int i = 0; i < n; i++) { kore[i] = (int)Long(); } return kore; } public int[,] Integer(long h, long w) { int[,] kore = new int[h, w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { kore[i, j] = (int)Long(); } } return kore; } public int[] StringToInt(int n) { char[] s = Scan().ToCharArray(); int[] kore = new int[n]; for (int i = 0; i < n; i++) { kore[i] = s[i] - '0'; } return kore; } public int[,] StringToInt(int h, int w) { int[,] kore = new int[h, w]; for (int i = 0; i < h; i++) { char[] s = Scan().ToCharArray(); for (int j = 0; j < w; j++) { kore[i, j] = s[j] - '0'; } } return kore; } public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); } } public class UnionFind { public int[] data; public UnionFind(int size) { data = new int[size]; for (int i = 0; i < size; i++) data[i] = -1; } public bool Unite(int x, int y) { x = Root(x); y = Root(y); if (x != y) { if (data[y] < data[x]) { var tmp = y; y = x; x = tmp; } data[x] += data[y]; data[y] = x; } return x != y; } public bool IsSameGroup(int x, int y) { return Root(x) == Root(y); } public int Root(int x) { return data[x] < 0 ? x : data[x] = Root(data[x]); } } public class Mlong : IComparable { private static long mod = 1000000007; public long num; public Mlong(long num) { this.num = num; } public override int GetHashCode() { return num.GetHashCode(); } public override bool Equals(object obj) { return num.Equals(obj); } public static Mlong operator +(Mlong x, Mlong y) { return new Mlong((x.num + y.num) % mod); } public static Mlong operator -(Mlong x, Mlong y) { return new Mlong((x.num - y.num + mod) % mod); } public static Mlong operator *(Mlong x, Mlong y) { return new Mlong((long)(((1L * x.num) * y.num) % mod)); } public Mlong hutujyo(Mlong x) { return new Mlong(num / x.num); } static long GetInverse(long a) { long div, p = mod, x1 = 1, y1 = 0, x2 = 0, y2 = 1; while (true) { if (p == 1) return x2 + mod; div = a / p; x1 -= x2 * div; y1 -= y2 * div; a %= p; if (a == 1) return x1 + mod; div = p / a; x2 -= x1 * div; y2 -= y1 * div; p %= a; } } public Mlong modjyo(Mlong x) { return num * GetInverse(x.num) % mod; } public static implicit operator Mlong(long x) { return new Mlong(x); } public static Mlong operator %(Mlong x, Mlong y) { return new Mlong(x.num % y.num); } public static explicit operator long(Mlong x) { return x.num; } public static bool operator ==(Mlong x, Mlong y) { return x.num == y.num; } public static bool operator !=(Mlong x, Mlong y) { return x.num != y.num; } public static bool operator<(Mlong x, Mlong y) { return x.num < y.num; } public static bool operator>(Mlong x, Mlong y) { return x.num > y.num; } public static bool operator <=(Mlong x, Mlong y) { return x.num <= y.num; } public static bool operator >=(Mlong x, Mlong y) { return x.num >= y.num; } public Mlong Pow(Mlong n) { Mlong pow = this; Mlong res = 1; while (n > 0) { if (n % 2 == 1) { res *= pow; } pow *= pow; n.hutujyo(2); } /* if (n == 1) { return this % mod; } if (n % 2 == 1) { return (this * Pow(n - 1)) % mod; } Mint buf = Pow(n.hutujyo(2)); return (buf * buf) % mod;*/ return res; } public static Mlong Pow(Mlong a, Mlong n) { return a.Pow(n); } public static List<Mlong> factorialMemo = new List<Mlong>() { 1 }; static Mlong Factorial(int x) { for (int i = factorialMemo.Count; i <= x; i++) factorialMemo.Add(factorialMemo.Last() * i); return factorialMemo[x]; } public static Mlong Comb(Mlong n, Mlong a) { Mlong buf1 = 1; Mlong buf2 = 1; for (long i = 0; i < a.num; i++) { buf1 *= n - i; buf2 *= (i + 1); } return buf1.modjyo(buf2); } public static Mlong Comb(int n, int r) { return Factorial(n).modjyo(Factorial(r)).modjyo(Factorial(n - r)); } public static void WriteLine(Mlong x) { Console.WriteLine(x.num); } public int CompareTo(object obj) { Mlong kore = (Mlong)obj; return num.CompareTo(kore.num); } } public class Mint : IComparable { public static int mod = 1000000007; public int num; public Mint(int Num) { num = Num; } public override int GetHashCode() { return num.GetHashCode(); } public override bool Equals(object obj) { return num.Equals(obj); } public static Mint operator +(Mint x, Mint y) { return new Mint((x.num + y.num) % mod); } public static Mint operator -(Mint x, Mint y) { return new Mint((x.num - y.num + mod) % mod); } public static Mint operator *(Mint x, Mint y) { return new Mint((int)(((1L * x.num) * y.num) % mod)); } public Mint hutujyo(Mint x) { return new Mint(num / x.num); } static int GetInverse(long a) { long div, p = mod, x1 = 1, y1 = 0, x2 = 0, y2 = 1; while (true) { if (p == 1) return (int)(x2 + mod); div = a / p; x1 -= x2 * div; y1 -= y2 * div; a %= p; if (a == 1) return (int)(x1 + mod); div = p / a; x2 -= x1 * div; y2 -= y1 * div; p %= a; } } public Mint modjyo(Mint x) { return num * GetInverse(x.num) % mod; } /* public Mint modjyo(Mint x) { return num * x.Pow(mod - 2); }*/ public static implicit operator Mint(int x) { return new Mint(x); } public static Mint[] Toarray(int[] x) { Mint[] buf = new Mint[x.Length]; for (int i = 0; i < x.Length; i++) { buf[i] = x[i]; } return buf; } public static explicit operator int(Mint x) { return x.num; } public static Mint operator %(Mint x, Mint y) { return new Mint(x.num % y.num); } public static bool operator ==(Mint x, Mint y) { return x.num == y.num; } public static bool operator !=(Mint x, Mint y) { return x.num != y.num; } public static bool operator<(Mint x, Mint y) { return x.num < y.num; } public static bool operator>(Mint x, Mint y) { return x.num > y.num; } public static bool operator <=(Mint x, Mint y) { return x.num <= y.num; } public static bool operator >=(Mint x, Mint y) { return x.num >= y.num; } public Mint Pow(Mint n) { Mint pow = this; Mint res = 1; while (n > 0) { if (n % 2 == 1) { res *= pow; } pow *= pow; n.hutujyo(2); } /* if (n == 1) { return this % mod; } if (n % 2 == 1) { return (this * Pow(n - 1)) % mod; } Mint buf = Pow(n.hutujyo(2)); return (buf * buf) % mod;*/ return res; } public static Mint Pow(Mint a, Mint n) { return a.Pow(n); } public static List<Mint> factorialMemo = new List<Mint>() { 1 }; static Mint Factorial(int x) { for (int i = factorialMemo.Count; i <= x; i++) factorialMemo.Add(factorialMemo.Last() * i); return factorialMemo[x]; } public static Mint Comb(int n, int r) { return Factorial(n).modjyo(Factorial(r)).modjyo(Factorial(n - r)); } public static void WriteLine(Mint x) { Console.WriteLine(x.num); } public int CompareTo(object obj) { Mint kore = (Mint)obj; return num.CompareTo(kore.num); } } public class PriorityQueue<T> : IEnumerable<T> { private readonly List<T> _data = new List<T>(); private readonly IComparer<T> _comparer; private readonly bool _isDescending; public PriorityQueue(IComparer<T> comparer, bool isDescending = true) { _comparer = comparer; _isDescending = isDescending; } public PriorityQueue(Comparison<T> comparison, bool isDescending = true) : this(Comparer<T>.Create(comparison), isDescending) {} public PriorityQueue(bool isDescending = true) : this(Comparer<T>.Default, isDescending) {} public void Enqueue(T item) { _data.Add(item); var childIndex = _data.Count - 1; while (childIndex > 0) { var parentIndex = (childIndex - 1) / 2; if (Compare(_data[childIndex], _data[parentIndex]) >= 0) break; Swap(childIndex, parentIndex); childIndex = parentIndex; } } public T Dequeue() { var lastIndex = _data.Count - 1; var firstItem = _data[0]; _data[0] = _data[lastIndex]; _data.RemoveAt(lastIndex--); var parentIndex = 0; while (true) { var childIndex = parentIndex * 2 + 1; if (childIndex > lastIndex) break; var rightChild = childIndex + 1; if (rightChild <= lastIndex && Compare(_data[rightChild], _data[childIndex]) < 0) childIndex = rightChild; if (Compare(_data[parentIndex], _data[childIndex]) <= 0) break; Swap(parentIndex, childIndex); parentIndex = childIndex; } return firstItem; } public T Peek() { return _data[0]; } private void Swap(int a, int b) { var tmp = _data[a]; _data[a] = _data[b]; _data[b] = tmp; } private int Compare(T a, T b) { return _isDescending ? _comparer.Compare(b, a) : _comparer.Compare(a, b); } public int Count => _data.Count; public IEnumerator<T> GetEnumerator() { return _data.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } public class Tree { public Node[] Nodes; public List<int[]> hen; public class Node { public int? parent = null; public List<int[]> children = new List<int[]>(); public int parentcolor = -1; } public Tree(int kosu) { Nodes = new Node[kosu]; for (int i = 0; i < Nodes.Length; i++) { Nodes[i] = new Node(); } hen = new List<int[]>(); } public void Connect(int oya, int ko, int id) { hen.Add(new int[] { oya, ko, 0 }); Nodes[oya].children.Add(new int[] { ko, id }); Nodes[ko].parent = oya; } } /// <summary> /// Self-Balancing Binary Search Tree /// (using Randamized BST) /// </summary> public class SB_BinarySearchTree<T> where T : IComparable { public class Node { public T Value; public Node LChild; public Node RChild; public int Count; // size of the sub tree public Node(T v) { Value = v; Count = 1; } } static Random _rnd = new Random(); public static int Count(Node t) { return t == null ? 0 : t.Count; } static Node Update(Node t) { t.Count = Count(t.LChild) + Count(t.RChild) + 1; return t; } public static Node Merge(Node l, Node r) { if (l == null || r == null) return l == null ? r : l; if ((double)Count(l) / (double)(Count(l) + Count(r)) > _rnd.NextDouble()) { l.RChild = Merge(l.RChild, r); return Update(l); } else { r.LChild = Merge(l, r.LChild); return Update(r); } } /// <summary> /// split as [0, k), [k, n) /// </summary> public static Tuple<Node, Node> Split(Node t, int k) { if (t == null) return new Tuple<Node, Node>(null, null); if (k <= Count(t.LChild)) { var s = Split(t.LChild, k); t.LChild = s.Item2; return new Tuple<Node, Node>(s.Item1, Update(t)); } else { var s = Split(t.RChild, k - Count(t.LChild) - 1); t.RChild = s.Item1; return new Tuple<Node, Node>(Update(t), s.Item2); } } public static Node Remove(Node t, T v) { if (Find(t, v) == null) return t; return RemoveAt(t, LowerBound(t, v)); } public static Node RemoveAt(Node t, int k) { var s = Split(t, k); var s2 = Split(s.Item2, 1); return Merge(s.Item1, s2.Item2); } public static bool Contains(Node t, T v) { return Find(t, v) != null; } public static Node Find(Node t, T v) { while (t != null) { var cmp = t.Value.CompareTo(v); if (cmp > 0) t = t.LChild; else if (cmp < 0) t = t.RChild; else break; } return t; } public static Node FindByIndex(Node t, int idx) { if (t == null) return null; var currentIdx = Count(t) - Count(t.RChild) - 1; while (t != null) { if (currentIdx == idx) return t; if (currentIdx > idx) { t = t.LChild; currentIdx -= (Count(t == null ? null : t.RChild) + 1); } else { t = t.RChild; currentIdx += (Count(t == null ? null : t.LChild) + 1); } } return null; } public static int UpperBound(Node t, T v) { var torg = t; if (t == null) return -1; var ret = Int32.MaxValue; var idx = Count(t) - Count(t.RChild) - 1; while (t != null) { var cmp = t.Value.CompareTo(v); if (cmp > 0) { ret = Math.Min(ret, idx); t = t.LChild; idx -= (Count(t == null ? null : t.RChild) + 1); } else if (cmp <= 0) { t = t.RChild; idx += (Count(t == null ? null : t.LChild) + 1); } } return ret == Int32.MaxValue ? Count(torg) : ret; } public static int LowerBound(Node t, T v) { var torg = t; if (t == null) return -1; var idx = Count(t) - Count(t.RChild) - 1; var ret = Int32.MaxValue; while (t != null) { var cmp = t.Value.CompareTo(v); if (cmp >= 0) { if (cmp == 0) ret = Math.Min(ret, idx); t = t.LChild; if (t == null) ret = Math.Min(ret, idx); idx -= t == null ? 0 : (Count(t.RChild) + 1); } else if (cmp < 0) { t = t.RChild; idx += (Count(t == null ? null : t.LChild) + 1); if (t == null) return idx; } } // return ret; return ret == Int32.MaxValue ? Count(torg) : ret; } public static Node Insert(Node t, T v) { var ub = LowerBound(t, v); return InsertByIdx(t, ub, v); } static Node InsertByIdx(Node t, int k, T v) { var s = Split(t, k); return Merge(Merge(s.Item1, new Node(v)), s.Item2); } public static IEnumerable<T> Enumerate(Node t) { var ret = new List<T>(); Enumerate(t, ret); return ret; } static void Enumerate(Node t, List<T> ret) { if (t == null) return; Enumerate(t.LChild, ret); ret.Add(t.Value); Enumerate(t.RChild, ret); } } /// <summary> /// C-like set /// </summary> public class Set<T> where T : IComparable { protected SB_BinarySearchTree<T>.Node _root; public T this[int idx] { get { return ElementAt(idx); } } public int Count() { return SB_BinarySearchTree<T>.Count(_root); } public virtual void Insert(T v) { if (_root == null) _root = new SB_BinarySearchTree<T>.Node(v); else { if (SB_BinarySearchTree<T>.Find(_root, v) != null) return; _root = SB_BinarySearchTree<T>.Insert(_root, v); } } public void Clear() { _root = null; } public void Remove(T v) { _root = SB_BinarySearchTree<T>.Remove(_root, v); } public bool Contains(T v) { return SB_BinarySearchTree<T>.Contains(_root, v); } public T ElementAt(int k) { var node = SB_BinarySearchTree<T>.FindByIndex(_root, k); if (node == null) throw new IndexOutOfRangeException(); return node.Value; } public int Count(T v) { return SB_BinarySearchTree<T>.UpperBound(_root, v) - SB_BinarySearchTree<T>.LowerBound(_root, v); } public int LowerBound(T v) { return SB_BinarySearchTree<T>.LowerBound(_root, v); } public int UpperBound(T v) { return SB_BinarySearchTree<T>.UpperBound(_root, v); } public Tuple<int, int> EqualRange(T v) { if (!Contains(v)) return new Tuple<int, int>(-1, -1); return new Tuple<int, int>(SB_BinarySearchTree<T>.LowerBound(_root, v), SB_BinarySearchTree<T>.UpperBound(_root, v) - 1); } public List<T> ToList() { return new List<T>(SB_BinarySearchTree<T>.Enumerate(_root)); } } /// <summary> /// C-like multiset /// </summary> public class MultiSet<T> : Set<T> where T : IComparable { public override void Insert(T v) { if (_root == null) _root = new SB_BinarySearchTree<T>.Node(v); else _root = SB_BinarySearchTree<T>.Insert(_root, v); } } public class RollingHashSlow { public const long B = (long)1e5 + 7; public const long MOD = (long)1e9 + 7; public string S { get; set; } public int N { get; set; } public long[] Power { get; set; } public long[] Hash { get; set; } public RollingHashSlow(string s) { this.S = s; this.N = s.Length; // B^nを計算しておく this.Power = new long[this.N + 1]; this.Power[0] = 1; for (int i = 0; i < N; i++) { this.Power[i + 1] = (this.Power[i] * B) % MOD; } // ハッシュを前計算する this.Hash = new long[this.N + 1]; for (int i = 0; i < N; i++) { this.Hash[i + 1] = (this.Hash[i] * B + S[i]) % MOD; } } // S[l, r) のハッシュ値を求める public long Get(int l, int r) { var hash = this.Hash[r] - (this.Hash[l] * this.Power[r - l] % MOD); if (hash < 0) hash += MOD; return hash; } } class RollingHashFast { public const ulong B = (ulong)1e9 + 7; public string S { get; set; } public int N { get; set; } public ulong[] Power { get; set; } public ulong[] Hash { get; set; } public RollingHashFast(string s) { this.S = s; this.N = s.Length; // B^nを計算しておく this.Power = new ulong[this.N + 1]; this.Power[0] = 1; for (int i = 0; i < N; i++) { this.Power[i + 1] = this.Power[i] * B; } // ハッシュを前計算する this.Hash = new ulong[this.N + 1]; for (int i = 0; i < N; i++) { this.Hash[i + 1] = this.Hash[i] * B + S[i]; } } // [l, r) のハッシュ値を求める public ulong Get(int l, int r) { var hash = this.Hash[r] - (this.Hash[l] * this.Power[r - l]); return hash; } } class Segtree<T> { int n; T[] tree; Func<T, T, T> f; T exnum; public Segtree(int m, Func<T, T, T> f, T ex) { this.f = f; this.exnum = ex; n = 1; while (n < m) n <<= 1; tree = new T[(n << 1) - 1]; for (int i = 0; i < tree.Length; i++) tree[i] = ex; } public Segtree(int m, T ini, Func<T, T, T> f, T ex) : this(m, f, ex) { for (int i = 0; i < m; ++i) tree[i + n - 1] = ini; all_update(); } public void assign_without_update(int j, T x) { tree[j + n - 1] = x; } public void update(int j, T x) { int i = j + n - 1; tree[i] = x; while (i > 0) { i = (i - 1) >> 1; tree[i] = f(tree[(i << 1) + 1], tree[(i << 1) + 2]); } } public void all_update() { for (int i = n - 2; i >= 0; i--) tree[i] = f(tree[(i << 1) + 1], tree[(i << 1) + 2]); } public T look(int i) { return tree[i + n - 1]; } // [s, t) public T run(int s, int t) { return query(s, t, 0, 0, n); } T query(int s, int t, int k, int l, int r) { if (r <= s || t <= l) return exnum; if (s <= l && r <= t) return tree[k]; return f(query(s, t, (k << 1) + 1, l, (l + r) >> 1), query(s, t, (k + 1) << 1, (l + r) >> 1, r)); } } }
[["+", 3, 4, 0, 28, 0, 213, 63, 214, 205, 22], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 0, 131], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["+", 3, 4, 0, 28, 0, 213, 3, 4, 0, 24], ["+", 0, 28, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 12, 203], ["+", 0, 28, 0, 16, 31, 16, 31, 23, 0, 25], ["+", 3, 4, 0, 28, 0, 16, 31, 16, 17, 48], ["+", 3, 4, 0, 28, 0, 16, 31, 16, 12, 250], ["+", 3, 4, 0, 28, 0, 16, 12, 23, 0, 25]]
8
8,167
11
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; namespace MyProject { class Program { static void Main(string[] args) { #if Local var sw = new Stopwatch(); sw.Start(); Console.SetIn(new StreamReader("input.in")); #endif var solver = new Solver(); solver.Solve(); #if Local Console.WriteLine($"{sw.ElapsedMilliseconds}ms"); #endif } } class Solver { public void Solve() { var line1 = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray(); var N = line1[0]; var K = line1[1]; var A = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray(); var index = Array.FindIndex(A, 0, A.Length, elem => elem == 1); var left = (int)Math.Ceiling((index - 0) / (double)(K - 1)); var amari = (index - 0) % (double)(K - 1); var right = (int)Math.Ceiling((Math.Max(0, N - 1 - index - amari)) / (double)(K - 1)); var answer = left + right; Console.WriteLine(answer); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; namespace MyProject { class Program { static void Main(string[] args) { #if Local var sw = new Stopwatch(); sw.Start(); Console.SetIn(new StreamReader("input.in")); #endif var solver = new Solver(); solver.Solve(); #if Local Console.WriteLine($"{sw.ElapsedMilliseconds}ms"); #endif } } class Solver { public void Solve() { var line1 = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray(); var N = line1[0]; var K = line1[1]; var A = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray(); var index = Array.FindIndex(A, 0, A.Length, elem => elem == 1); var left = (int)Math.Ceiling((index - 0) / (double)(K - 1)); var amari = left * (K - 1) - index; var right = (int)Math.Ceiling((Math.Max(0, N - 1 - index - amari)) / (double)(K - 1)); var answer = left + right; Console.WriteLine(answer); } } }
[["-", 0, 200, 0, 212, 0, 16, 31, 23, 0, 24], ["-", 0, 212, 0, 16, 31, 23, 0, 16, 31, 22], ["-", 0, 212, 0, 16, 31, 23, 0, 16, 17, 33], ["-", 0, 212, 0, 16, 31, 23, 0, 16, 12, 203], ["-", 0, 200, 0, 212, 0, 16, 31, 23, 0, 25], ["-", 0, 198, 0, 200, 0, 212, 0, 16, 17, 109], ["-", 0, 200, 0, 212, 0, 16, 12, 74, 0, 24], ["-", 0, 200, 0, 212, 0, 16, 12, 74, 39, 199], ["-", 0, 200, 0, 212, 0, 16, 12, 74, 0, 25], ["+", 0, 200, 0, 212, 0, 16, 31, 16, 31, 22], ["+", 0, 200, 0, 212, 0, 16, 31, 16, 17, 48], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 33], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 22]]
8
311
13
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ProgrammingContest { class Writer : IDisposable { private readonly System.IO.TextWriter writer; private StringBuilder sb; private readonly 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 readonly Queue<string> buffer; private readonly char[] sep; private readonly 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 = ".."; private readonly char dirSep = System.IO.Path.DirectorySeparatorChar; private readonly string inFilePath = string.Empty; private readonly 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 D = sc.NextInt; int N = sc.NextInt; if (D == 0) { wr.WriteLine(N); } else { int foo = 100 * (D == 2 ? 100 : 1); wr.WriteLine(foo * N); } } 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 readonly System.IO.TextWriter writer; private StringBuilder sb; private readonly 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 readonly Queue<string> buffer; private readonly char[] sep; private readonly 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 = ".."; private readonly char dirSep = System.IO.Path.DirectorySeparatorChar; private readonly string inFilePath = string.Empty; private readonly 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 D = sc.NextInt; int N = sc.NextInt; N += N == 100 ? 1 : 0; if (D == 0) { wr.WriteLine(N); } else { int foo = 100 * (D == 2 ? 100 : 1); wr.WriteLine(foo * N); } } private bool IsReactive { get; } = false; // TODO: reactive check !! } }
[["+", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 8, 196, 0, 1, 0, 11, 0, 202, 0, 107], ["+", 0, 1, 0, 11, 12, 41, 15, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 41, 15, 16, 17, 60], ["+", 0, 1, 0, 11, 12, 41, 15, 16, 12, 203], ["+", 8, 196, 0, 1, 0, 11, 12, 41, 0, 101], ["+", 8, 196, 0, 1, 0, 11, 12, 41, 64, 203], ["+", 8, 196, 0, 1, 0, 11, 12, 41, 0, 102], ["+", 8, 196, 0, 1, 0, 11, 12, 41, 75, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35]]
8
1,286
10
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using static Ha2ne2Util.Cin; using static Ha2ne2Util.Util; using static System.Console; using static System.Math; using System.Collections; using Pair = System.Tuple<long, long>; /// <summary> /// https://atcoder.jp/contests/abc101 /// 2020/02/03 /// </summary> namespace ABC101 { public class Program { public static void Main(string[] args) { // A(); 3m // B(); 11m C(); // D(); } public static void D() {} public static void C() { long N = rl; long K = rl; long[] A = rla; if (N <= K) { Console.WriteLine("1"); return; } long ans = N / (K - 1); if (N % (K - 1) != 0) ans++; Console.WriteLine(ans); } public static void B() { long N = rl; long n = N; long res = 0; while (n != 0) { res += n % 10; n /= 10; } string ans = (N % res == 0) ? "Yes" : "No"; Console.WriteLine(ans); } public static void A() { string s = ReadString(); long ans = 0; foreach (var c in s) { if (c == '+') ans++; if (c == '-') ans--; } Console.WriteLine(ans); } } } namespace Ha2ne2Util { public static class Cin { private static string[] Tokens { get; set; } private static int Pointer { get; set; } public static string Next() { if (Tokens == null || Tokens.Length <= Pointer) { Tokens = Console.ReadLine().Split(' '); Pointer = 0; } return Tokens[Pointer++]; } public static int ReadInt() { return int.Parse(Next()); } public static long rl => ReadLong(); public static long[] rla => ReadLongArray(); public static double rd => ReadDouble(); public static double[] rda => ReadDoubleArray(); public static long ReadLong() { return long.Parse(Next()); } public static double ReadDouble() { return double.Parse(Next()); } public static int[] ReadIntArray() { Tokens = null; return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); } public static long[] ReadLongArray() { Tokens = null; return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse); } public static double[] ReadDoubleArray() { Tokens = null; return Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse); } public static void ReadArrays(out long[] a, out long[] b, long N) { a = new long[N]; b = new long[N]; for (int i = 0; i < N; i++) { a[i] = ReadLong(); b[i] = ReadLong(); } } public static void ReadArrays(out long[] a, out long[] b, out long[] c, long N) { a = new long[N]; b = new long[N]; c = new long[N]; for (int i = 0; i < N; i++) { a[i] = ReadLong(); b[i] = ReadLong(); c[i] = ReadLong(); } } public static int[][] ReadIntTable(int n) { Tokens = null; int[][] ret = new int [n][]; for (int i = 0; i < n; i++) { ret[i] = ReadIntArray(); } return ret; } public static long[][] ReadLongTable(long n) { Tokens = null; long[][] ret = new long [n][]; for (long i = 0; i < n; i++) { ret[i] = ReadLongArray(); } return ret; } public static string ReadString() { return Next(); } /// <summary> /// "00101001010"という様な入力をintの配列にして返す /// </summary> /// <returns></returns> public static int[] ReadIntArrayFromBinaryString() { Tokens = null; return Array.ConvertAll(Console.ReadLine().ToArray(), c => int.Parse(c.ToString())); } /// <summary> /// "00101001010"という様な入力をboolの配列にして返す /// </summary> /// <returns></returns> public static bool[] ReadBoolArrayFromBinaryString() { Tokens = null; return Console.ReadLine().Select(c => c == '1').ToArray(); } } /// <summary> /// ユーティリティー /// </summary> public static class Util { // 10^17 public static readonly long INF = (long)1e17; public static IEnumerable<int> Range(int end) { for (int i = 0; i < end; i++) { yield return i; } } public static IEnumerable<int> Range(int from, int end) { for (int i = from; i < end; i++) { yield return i; } } public static IEnumerable<int> Range(int from, int end, int step) { for (int i = from; i < end; i += step) { yield return i; } } /// <summary> /// ソートをして結果を返します。 /// 破壊的関数です。 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="array"></param> /// <returns></returns> public static T[] Sort<T>(T[] array) { Array.Sort<T>(array); return array; } /// <summary> /// 降順ソートをして結果を返します。 /// 破壊的関数です。 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="array"></param> /// <returns></returns> public static T[] SortDecend<T>(T[] array) { Array.Sort<T>(array); Array.Reverse(array); return array; } /// <summary> /// Rubyにあるようなやつ /// ex) 5.Times(i => Console.WriteLine(i)); /// </summary> /// <param name="times"></param> /// <param name="action"></param> public static void Times(this int times, Action<int> action) { for (int i = 0; i < times; i++) { action(i); } } /// <summary> /// 引数aと引数bの値を入れ替えます /// </summary> /// <typeparam name="T"></typeparam> /// <param name="a"></param> /// <param name="b"></param> public static void Swap<T>(ref T a, ref T b) { T _a = a; a = b; b = _a; } /// <summary> /// Console.WriteLineの自動フラッシュをしないようにする /// </summary> public static void DontAutoFlush() { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); } public static void Flush() { Console.Out.Flush(); } /// <summary> /// 先頭と末尾に要素を増やした新しい配列を返します。 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="array"></param> /// <returns></returns> public static T[] AddHeadAndTail<T>(T[] array) { int len = array.Length; T[] res = new T[len + 2]; Array.Copy(array, 0, res, 1, len); return res; } /// <summary> /// 昇順ソート済みの配列を2分探索します。 /// 要素が見つからなかった場合はnより大きい数値の中で最小の数値のインデックスを返す。 /// </summary> /// <param name="array"></param> /// <param name="n"></param> /// <returns></returns> public static int BinarySearch(long[] array, long n) { int left = 0; int right = array.Length - 1; while (left <= right) { int mid = (right - left) / 2 + left; if (array[mid] == n) { return mid; } else if (n < array[mid]) { right = mid - 1; } else { left = mid + 1; } } return left; } public static int GCD(int a, int b) { return (b == 0) ? a : GCD(b, a % b); } public static int[] GetDivisor(int n) { double sqrt = Math.Sqrt(n); List<int> divisor = new List<int>(); for (int i = 1; i <= sqrt; i++) { if (n % i == 0) { divisor.Add(i); int tmp = n / i; if (tmp != i) { divisor.Add(tmp); } } } return Sort(divisor.ToArray()); } public static int[] LongToBinaryArray(long n) { List<int> lst = new List<int>(); while (n > 0) { int amari = (int)(n % 2); lst.Add(amari); n /= 2; } return lst.ToArray(); } public static long BinaryArrayToLong(int[] binaryArray) { long result = 0; long b = 1; int len = binaryArray.Length; for (int i = 0; i < len; i++) { result += binaryArray[i] * b; b *= 2; } return result; } public static void Deconstruct<T>(this T[] items, out T t0) { t0 = items.Length > 0 ? items[0] : default(T); } public static void Deconstruct<T>(this T[] items, out T t0, out T t1) { if (items.Length < 2) throw new ArgumentException(); t0 = items[0]; t1 = items[1]; } public static void Deconstruct<T>(this T[] items, out T t0, out T t1, out T t2) { if (items.Length < 3) throw new ArgumentException(); t0 = items[0]; t1 = items[1]; t2 = items[2]; } public static void Deconstruct<T>(this T[] items, out T t0, out T t1, out T t2, out T t3) { if (items.Length < 4) throw new ArgumentException(); t0 = items[0]; t1 = items[1]; t2 = items[2]; t3 = items[3]; } public static void ArrayInitialize<T>(T[,] array, T value) { int len0 = array.GetLength(0); int len1 = array.GetLength(1); for (int i = 0; i < len0; i++) { for (int j = 0; j < len1; j++) { array[i, j] = value; } } } public static void ChMax(ref long a, long b) { if (a < b) a = b; } public static void ChMin(ref long a, long b) { if (a > b) a = b; } public readonly static int MOD = 1000000007; public static long ModAdd(long a, long b) { long res = a + b; if (res >= MOD) return res % MOD; return res; } public static long ModMul(long a, long b) { long res = a * b; if (res >= MOD) return res % MOD; return res; } public static void ModAddEqual(ref long a, long b) { a += b; if (a >= MOD) a %= MOD; } public static T MinBy<T>(this IEnumerable<T> source, Func<T, long> conv) { T min = source.First(); long minValue = conv(min); foreach (T x in source.Skip(1)) { long n = conv(x); if (n < minValue) { min = x; } } return min; } public static T MaxBy<T>(this IEnumerable<T> source, Func<T, long> conv) { T min = source.First(); long maxValue = conv(min); foreach (T x in source.Skip(1)) { long n = conv(x); if (maxValue < n) { min = x; } } return min; } public static void FillArray<T>(T[] array, T value) { int max = array.Length; for (int i = 0; i < max; i++) { array[i] = value; } } public static void FillArray<T>(T[,] array, T value) { int max0 = array.GetLength(0); int max1 = array.GetLength(1); for (int i = 0; i < max0; i++) { for (int j = 0; j < max1; j++) { array[i, j] = value; } } } public static void FillArray<T>(T[,,] array, T value) { int max0 = array.GetLength(0); int max1 = array.GetLength(1); int max2 = array.GetLength(2); for (int i = 0; i < max0; i++) { for (int j = 0; j < max1; j++) { for (int k = 0; k < max2; k++) { array[i, j, k] = value; } } } } } /// <summary> /// HashSetにTupleを入れた時の、等値性判定方法の指定に使います。 /// HashSetのコンストラクタに渡して使います。 /// EqualsとGetHashCodeを提供します。 /// </summary> /// <typeparam name="T"></typeparam> public class EqualityComparer<T> : IEqualityComparer<T> { private Func<T, T, bool> _equals; private Func<T, int> _getHashCode; public EqualityComparer(Func<T, T, bool> equals, Func<T, int> getHashCode) { _equals = equals; _getHashCode = getHashCode; } public bool Equals(T x, T y) { return _equals(x, y); } public int GetHashCode(T obj) { return _getHashCode(obj); } } /// <summary> /// UnionFindTree /// </summary> public class UnionFindTree { public int[] Node; public UnionFindTree(int N) { Node = new int[N]; for (int i = 0; i < N; i++) { Node[i] = -1; } } public bool IsSameGroup(int x, int y) { return GetRoot(x) == GetRoot(y); } public bool Merge(int x, int y) { int xr = GetRoot(x); int yr = GetRoot(y); if (xr == yr) return false; // xが、大きなグループを示すようにSwapする(値が小さい方が大きなグループ) if (Node[xr] > Node[yr]) Swap(ref xr, ref yr); // グループの数を合算する Node[xr] += Node[yr]; // 根を張り替える Node[yr] = xr; return true; } public int Size(int x) { return -Node[GetRoot(x)]; } public int GetRoot(int n) { if (Node[n] < 0) { return n; } else { // 根を張りなおす。 Node[n] = GetRoot(Node[n]); return Node[n]; } } } /// <summary> /// PriorityQueue /// </summary> /// <typeparam name="T"></typeparam> public class PriorityQueue<T> { private Comparison<T> _comparison = null; private int _type = 0; private T[] _heap; private int _sz = 0; private int _count = 0; /// <summary> /// Priority queue /// </summary> /// <param name="maxSize">max size</param> /// <param name="type">0: asc, 1:desc</param> public PriorityQueue(int maxSize, int type = 0) { _heap = new T[maxSize]; _type = type; } public PriorityQueue(int maxSize, Comparison<T> comparison) { _heap = new T[maxSize]; _comparison = comparison; } private int Compare(T x, T y) { return _comparison(x, y); // if (_comparison != null) return _comparison(x, y); // return _type == 0 ? x.CompareTo(y) : y.CompareTo(x); } public void Push(T x) { _count++; // node number var i = _sz++; while (i > 0) { // parent node number var p = (i - 1) / 2; if (Compare(_heap[p], x) <= 0) break; _heap[i] = _heap[p]; i = p; } _heap[i] = x; } public T Pop() { _count--; T ret = _heap[0]; T x = _heap[--_sz]; int i = 0; while (i * 2 + 1 < _sz) { // children int a = i * 2 + 1; int b = i * 2 + 2; if (b < _sz && Compare(_heap[b], _heap[a]) < 0) a = b; if (Compare(_heap[a], x) >= 0) break; _heap[i] = _heap[a]; i = a; } _heap[i] = x; return ret; } public int Count() { return _count; } public T Peek() { return _heap[0]; } public bool Contains(T x) { for (int i = 0; i < _sz; i++) if (x.Equals(_heap[i])) return true; return false; } public void Clear() { while (this.Count() > 0) this.Pop(); } public IEnumerator<T> GetEnumerator() { var ret = new List<T>(); while (this.Count() > 0) { ret.Add(this.Pop()); } foreach (var r in ret) { this.Push(r); yield return r; } } public T[] ToArray() { T[] array = new T[_sz]; int i = 0; foreach (var r in this) { array[i++] = r; } return array; } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using static Ha2ne2Util.Cin; using static Ha2ne2Util.Util; using static System.Console; using static System.Math; using System.Collections; using Pair = System.Tuple<long, long>; /// <summary> /// https://atcoder.jp/contests/abc101 /// 2020/02/03 /// </summary> namespace ABC101 { public class Program { public static void Main(string[] args) { // A(); 3m // B(); 11m C(); // D(); } public static void D() {} public static void C() { long N = rl; long K = rl; long[] A = rla; if (N <= K) { Console.WriteLine("1"); return; } N -= K; long ans = 1; ans += N / (K - 1); if (N % (K - 1) != 0) ans++; Console.WriteLine(ans); } public static void B() { long N = rl; long n = N; long res = 0; while (n != 0) { res += n % 10; n /= 10; } string ans = (N % res == 0) ? "Yes" : "No"; Console.WriteLine(ans); } public static void A() { string s = ReadString(); long ans = 0; foreach (var c in s) { if (c == '+') ans++; if (c == '-') ans--; } Console.WriteLine(ans); } } } namespace Ha2ne2Util { public static class Cin { private static string[] Tokens { get; set; } private static int Pointer { get; set; } public static string Next() { if (Tokens == null || Tokens.Length <= Pointer) { Tokens = Console.ReadLine().Split(' '); Pointer = 0; } return Tokens[Pointer++]; } public static int ReadInt() { return int.Parse(Next()); } public static long rl => ReadLong(); public static long[] rla => ReadLongArray(); public static double rd => ReadDouble(); public static double[] rda => ReadDoubleArray(); public static long ReadLong() { return long.Parse(Next()); } public static double ReadDouble() { return double.Parse(Next()); } public static int[] ReadIntArray() { Tokens = null; return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); } public static long[] ReadLongArray() { Tokens = null; return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse); } public static double[] ReadDoubleArray() { Tokens = null; return Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse); } public static void ReadArrays(out long[] a, out long[] b, long N) { a = new long[N]; b = new long[N]; for (int i = 0; i < N; i++) { a[i] = ReadLong(); b[i] = ReadLong(); } } public static void ReadArrays(out long[] a, out long[] b, out long[] c, long N) { a = new long[N]; b = new long[N]; c = new long[N]; for (int i = 0; i < N; i++) { a[i] = ReadLong(); b[i] = ReadLong(); c[i] = ReadLong(); } } public static int[][] ReadIntTable(int n) { Tokens = null; int[][] ret = new int [n][]; for (int i = 0; i < n; i++) { ret[i] = ReadIntArray(); } return ret; } public static long[][] ReadLongTable(long n) { Tokens = null; long[][] ret = new long [n][]; for (long i = 0; i < n; i++) { ret[i] = ReadLongArray(); } return ret; } public static string ReadString() { return Next(); } /// <summary> /// "00101001010"という様な入力をintの配列にして返す /// </summary> /// <returns></returns> public static int[] ReadIntArrayFromBinaryString() { Tokens = null; return Array.ConvertAll(Console.ReadLine().ToArray(), c => int.Parse(c.ToString())); } /// <summary> /// "00101001010"という様な入力をboolの配列にして返す /// </summary> /// <returns></returns> public static bool[] ReadBoolArrayFromBinaryString() { Tokens = null; return Console.ReadLine().Select(c => c == '1').ToArray(); } } /// <summary> /// ユーティリティー /// </summary> public static class Util { // 10^17 public static readonly long INF = (long)1e17; public static IEnumerable<int> Range(int end) { for (int i = 0; i < end; i++) { yield return i; } } public static IEnumerable<int> Range(int from, int end) { for (int i = from; i < end; i++) { yield return i; } } public static IEnumerable<int> Range(int from, int end, int step) { for (int i = from; i < end; i += step) { yield return i; } } /// <summary> /// ソートをして結果を返します。 /// 破壊的関数です。 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="array"></param> /// <returns></returns> public static T[] Sort<T>(T[] array) { Array.Sort<T>(array); return array; } /// <summary> /// 降順ソートをして結果を返します。 /// 破壊的関数です。 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="array"></param> /// <returns></returns> public static T[] SortDecend<T>(T[] array) { Array.Sort<T>(array); Array.Reverse(array); return array; } /// <summary> /// Rubyにあるようなやつ /// ex) 5.Times(i => Console.WriteLine(i)); /// </summary> /// <param name="times"></param> /// <param name="action"></param> public static void Times(this int times, Action<int> action) { for (int i = 0; i < times; i++) { action(i); } } /// <summary> /// 引数aと引数bの値を入れ替えます /// </summary> /// <typeparam name="T"></typeparam> /// <param name="a"></param> /// <param name="b"></param> public static void Swap<T>(ref T a, ref T b) { T _a = a; a = b; b = _a; } /// <summary> /// Console.WriteLineの自動フラッシュをしないようにする /// </summary> public static void DontAutoFlush() { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); } public static void Flush() { Console.Out.Flush(); } /// <summary> /// 先頭と末尾に要素を増やした新しい配列を返します。 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="array"></param> /// <returns></returns> public static T[] AddHeadAndTail<T>(T[] array) { int len = array.Length; T[] res = new T[len + 2]; Array.Copy(array, 0, res, 1, len); return res; } /// <summary> /// 昇順ソート済みの配列を2分探索します。 /// 要素が見つからなかった場合はnより大きい数値の中で最小の数値のインデックスを返す。 /// </summary> /// <param name="array"></param> /// <param name="n"></param> /// <returns></returns> public static int BinarySearch(long[] array, long n) { int left = 0; int right = array.Length - 1; while (left <= right) { int mid = (right - left) / 2 + left; if (array[mid] == n) { return mid; } else if (n < array[mid]) { right = mid - 1; } else { left = mid + 1; } } return left; } public static int GCD(int a, int b) { return (b == 0) ? a : GCD(b, a % b); } public static int[] GetDivisor(int n) { double sqrt = Math.Sqrt(n); List<int> divisor = new List<int>(); for (int i = 1; i <= sqrt; i++) { if (n % i == 0) { divisor.Add(i); int tmp = n / i; if (tmp != i) { divisor.Add(tmp); } } } return Sort(divisor.ToArray()); } public static int[] LongToBinaryArray(long n) { List<int> lst = new List<int>(); while (n > 0) { int amari = (int)(n % 2); lst.Add(amari); n /= 2; } return lst.ToArray(); } public static long BinaryArrayToLong(int[] binaryArray) { long result = 0; long b = 1; int len = binaryArray.Length; for (int i = 0; i < len; i++) { result += binaryArray[i] * b; b *= 2; } return result; } public static void Deconstruct<T>(this T[] items, out T t0) { t0 = items.Length > 0 ? items[0] : default(T); } public static void Deconstruct<T>(this T[] items, out T t0, out T t1) { if (items.Length < 2) throw new ArgumentException(); t0 = items[0]; t1 = items[1]; } public static void Deconstruct<T>(this T[] items, out T t0, out T t1, out T t2) { if (items.Length < 3) throw new ArgumentException(); t0 = items[0]; t1 = items[1]; t2 = items[2]; } public static void Deconstruct<T>(this T[] items, out T t0, out T t1, out T t2, out T t3) { if (items.Length < 4) throw new ArgumentException(); t0 = items[0]; t1 = items[1]; t2 = items[2]; t3 = items[3]; } public static void ArrayInitialize<T>(T[,] array, T value) { int len0 = array.GetLength(0); int len1 = array.GetLength(1); for (int i = 0; i < len0; i++) { for (int j = 0; j < len1; j++) { array[i, j] = value; } } } public static void ChMax(ref long a, long b) { if (a < b) a = b; } public static void ChMin(ref long a, long b) { if (a > b) a = b; } public readonly static int MOD = 1000000007; public static long ModAdd(long a, long b) { long res = a + b; if (res >= MOD) return res % MOD; return res; } public static long ModMul(long a, long b) { long res = a * b; if (res >= MOD) return res % MOD; return res; } public static void ModAddEqual(ref long a, long b) { a += b; if (a >= MOD) a %= MOD; } public static T MinBy<T>(this IEnumerable<T> source, Func<T, long> conv) { T min = source.First(); long minValue = conv(min); foreach (T x in source.Skip(1)) { long n = conv(x); if (n < minValue) { min = x; } } return min; } public static T MaxBy<T>(this IEnumerable<T> source, Func<T, long> conv) { T min = source.First(); long maxValue = conv(min); foreach (T x in source.Skip(1)) { long n = conv(x); if (maxValue < n) { min = x; } } return min; } public static void FillArray<T>(T[] array, T value) { int max = array.Length; for (int i = 0; i < max; i++) { array[i] = value; } } public static void FillArray<T>(T[,] array, T value) { int max0 = array.GetLength(0); int max1 = array.GetLength(1); for (int i = 0; i < max0; i++) { for (int j = 0; j < max1; j++) { array[i, j] = value; } } } public static void FillArray<T>(T[,,] array, T value) { int max0 = array.GetLength(0); int max1 = array.GetLength(1); int max2 = array.GetLength(2); for (int i = 0; i < max0; i++) { for (int j = 0; j < max1; j++) { for (int k = 0; k < max2; k++) { array[i, j, k] = value; } } } } } /// <summary> /// HashSetにTupleを入れた時の、等値性判定方法の指定に使います。 /// HashSetのコンストラクタに渡して使います。 /// EqualsとGetHashCodeを提供します。 /// </summary> /// <typeparam name="T"></typeparam> public class EqualityComparer<T> : IEqualityComparer<T> { private Func<T, T, bool> _equals; private Func<T, int> _getHashCode; public EqualityComparer(Func<T, T, bool> equals, Func<T, int> getHashCode) { _equals = equals; _getHashCode = getHashCode; } public bool Equals(T x, T y) { return _equals(x, y); } public int GetHashCode(T obj) { return _getHashCode(obj); } } /// <summary> /// UnionFindTree /// </summary> public class UnionFindTree { public int[] Node; public UnionFindTree(int N) { Node = new int[N]; for (int i = 0; i < N; i++) { Node[i] = -1; } } public bool IsSameGroup(int x, int y) { return GetRoot(x) == GetRoot(y); } public bool Merge(int x, int y) { int xr = GetRoot(x); int yr = GetRoot(y); if (xr == yr) return false; // xが、大きなグループを示すようにSwapする(値が小さい方が大きなグループ) if (Node[xr] > Node[yr]) Swap(ref xr, ref yr); // グループの数を合算する Node[xr] += Node[yr]; // 根を張り替える Node[yr] = xr; return true; } public int Size(int x) { return -Node[GetRoot(x)]; } public int GetRoot(int n) { if (Node[n] < 0) { return n; } else { // 根を張りなおす。 Node[n] = GetRoot(Node[n]); return Node[n]; } } } /// <summary> /// PriorityQueue /// </summary> /// <typeparam name="T"></typeparam> public class PriorityQueue<T> { private Comparison<T> _comparison = null; private int _type = 0; private T[] _heap; private int _sz = 0; private int _count = 0; /// <summary> /// Priority queue /// </summary> /// <param name="maxSize">max size</param> /// <param name="type">0: asc, 1:desc</param> public PriorityQueue(int maxSize, int type = 0) { _heap = new T[maxSize]; _type = type; } public PriorityQueue(int maxSize, Comparison<T> comparison) { _heap = new T[maxSize]; _comparison = comparison; } private int Compare(T x, T y) { return _comparison(x, y); // if (_comparison != null) return _comparison(x, y); // return _type == 0 ? x.CompareTo(y) : y.CompareTo(x); } public void Push(T x) { _count++; // node number var i = _sz++; while (i > 0) { // parent node number var p = (i - 1) / 2; if (Compare(_heap[p], x) <= 0) break; _heap[i] = _heap[p]; i = p; } _heap[i] = x; } public T Pop() { _count--; T ret = _heap[0]; T x = _heap[--_sz]; int i = 0; while (i * 2 + 1 < _sz) { // children int a = i * 2 + 1; int b = i * 2 + 2; if (b < _sz && Compare(_heap[b], _heap[a]) < 0) a = b; if (Compare(_heap[a], x) >= 0) break; _heap[i] = _heap[a]; i = a; } _heap[i] = x; return ret; } public int Count() { return _count; } public T Peek() { return _heap[0]; } public bool Contains(T x) { for (int i = 0; i < _sz; i++) if (x.Equals(_heap[i])) return true; return false; } public void Clear() { while (this.Count() > 0) this.Pop(); } public IEnumerator<T> GetEnumerator() { var ret = new List<T>(); while (this.Count() > 0) { ret.Add(this.Pop()); } foreach (var r in ret) { this.Push(r); yield return r; } } public T[] ToArray() { T[] array = new T[_sz]; int i = 0; foreach (var r in this) { array[i++] = r; } return array; } } }
[["+", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 8, 196, 0, 1, 0, 11, 0, 202, 0, 110], ["+", 0, 195, 8, 196, 0, 1, 0, 11, 12, 22], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["+", 8, 196, 0, 1, 0, 11, 0, 202, 0, 107]]
8
3,457
8
using System; using System.Collections.Generic; using System.Linq; class Program { static int d, n; static int ans; static int Main() { string[] nyu = Console.ReadLine().Split(' '); d = int.Parse(nyu[0]); n = int.Parse(nyu[1]); if (d < 1) { ans = n; } else { ans = n * (int)Math.Pow(100, d); } Console.WriteLine("{0}", ans); return 0; } }
using System; using System.Collections.Generic; using System.Linq; class Program { static int d, n; static int ans; static int Main() { string[] nyu = Console.ReadLine().Split(' '); d = int.Parse(nyu[0]); n = int.Parse(nyu[1]); if (n == 100) n++; if (d < 1) { ans = n; } else { ans = n * (int)Math.Pow(100, d); } Console.WriteLine("{0}", ans); return 0; } }
[["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 22], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24]]
8
123
9
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace test { class Program { static void Main(string[] args) { var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); var D = input[0]; var N = input[1]; var tmp = 0; if (D == 0) tmp = 1; else if (D == 1) tmp = 100; else if (D == 2) tmp = 10000; var ans = 0; ans = tmp * N; if (D == 0 && N == 100) ans++; Console.WriteLine(ans); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace test { class Program { static void Main(string[] args) { var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); var D = input[0]; var N = input[1]; var tmp = 0; if (D == 0) tmp = 1; else if (D == 1) tmp = 100; else if (D == 2) tmp = 10000; var ans = 0; if (N == 100) { ans = tmp * (N + 1); } else { ans = tmp * N; } Console.WriteLine(ans); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["-", 8, 196, 0, 1, 0, 11, 12, 16, 12, 22], ["-", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 60], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 60], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 12, 203], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 203], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 45], ["-", 8, 196, 0, 57, 64, 1, 0, 223, 0, 29], ["+", 75, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 75, 196, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 75, 196, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 75, 196, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 46]]
8
162
28
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp27 { class Program { static void Main(string[] args) { var st = Console.ReadLine().Split().Select(int.Parse).ToArray(); int N = st[0]; int K = st[1]; var A = Console.ReadLine().Split().Select(int.Parse).ToArray(); int index_1 = Array.IndexOf(A, 1); Console.WriteLine(Math.Ceiling((double)index_1 / (K - 1)) + Math.Ceiling((double)(N - index_1 - 1) / (K - 1))); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp27 { class Program { static void Main(string[] args) { var st = Console.ReadLine().Split().Select(int.Parse).ToArray(); int N = st[0]; int K = st[1]; var A = Console.ReadLine().Split().Select(int.Parse).ToArray(); int index_1 = Array.IndexOf(A, 1); if (N <= K) { Console.WriteLine(1); } else { Console.WriteLine(Math.Ceiling((double)(N - 1) / (K - 1))); } } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 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, 12, 22], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["-", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["-", 0, 28, 0, 16, 31, 213, 63, 214, 205, 22], ["-", 0, 28, 0, 16, 31, 213, 63, 214, 0, 131], ["-", 0, 28, 0, 16, 31, 213, 63, 214, 141, 22], ["-", 0, 28, 0, 16, 31, 213, 3, 4, 0, 24], ["-", 3, 4, 0, 28, 0, 16, 31, 74, 0, 24], ["-", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["-", 3, 4, 0, 28, 0, 16, 31, 74, 0, 25], ["-", 3, 4, 0, 28, 0, 16, 31, 74, 51, 22], ["-", 31, 213, 3, 4, 0, 28, 0, 16, 17, 85], ["-", 0, 28, 0, 16, 12, 23, 0, 16, 31, 22], ["-", 0, 28, 0, 16, 12, 23, 0, 16, 17, 33], ["-", 0, 28, 0, 16, 31, 213, 3, 4, 0, 25], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 75, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["+", 75, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["+", 75, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 75, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["-", 31, 74, 51, 23, 0, 16, 31, 16, 12, 22], ["-", 0, 16, 31, 74, 51, 23, 0, 16, 17, 33], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 46]]
8
165
32
using System; using System.Collections.Generic; class Program { #region library static int n = 0; static int m = 0; static int r = 0; static int c = 0; static int x = 0; static int y = 0; static int[] arr; static string s = ""; static string[] ss; static string alpha = "abcdefghijklmnopqrstuvwxyz"; static long sum = 0; static long cnt = 0; static long max = -1; static long min = 2147483647; static bool flg = false; static bool flg2 = false; static char[,] map; static int[,] imap; static string rl() { return Console.ReadLine(); } static string[] rls() { return Console.ReadLine().Split(); } static void wl(object obj = null) { Console.WriteLine(obj); } static void w(object obj) { Console.Write(obj); } static int Int(string s) { return int.Parse(s); } static long Max(long a, long b) { return Math.Max(a, b); } static long Min(long a, long b) { return Math.Min(a, b); } static long Abs(long a) { return Math.Abs(a); } static void yes() { wl("YES"); } static void no() { wl("NO"); } static void Sum() { wl(sum); } static void Cnt() { wl(cnt); } static void setarray(int num = -1) { arr = new int[n]; if (num == -1) ss = rls(); for (int i = 0; i < n; i++) { if (num == -1) arr[i] = Int(ss[i]); else arr[i] = num; } } static void setmap(char def = '@') { if (r == 0 && c == 0) { ss = rls(); r = Int(ss[0]); c = Int(ss[1]); } map = new char[r, c]; for (int i = 0; i < r; i++) { if (def == '@') s = rl(); for (int j = 0; j < c; j++) { map[i, j] = (def == '@') ? s[j] : def; } } } static void setimap(int def = -1) { if (r == 0 && c == 0) { ss = rls(); r = Int(ss[0]); c = Int(ss[1]); } imap = new int[r, c]; for (int i = 0; i < r; i++) { if (def == -1) s = rl(); for (int j = 0; j < c; j++) { imap[i, j] = (def == -1) ? Int(s[j].ToString()) : def; } } } #endregion static void Main(string[] args) { ss = rls(); n = Int(ss[0]); int k = Int(ss[1]); wl(n / --k); } }
using System; using System.Collections.Generic; class Program { #region library static int n = 0; static int m = 0; static int r = 0; static int c = 0; static int x = 0; static int y = 0; static int[] arr; static string s = ""; static string[] ss; static string alpha = "abcdefghijklmnopqrstuvwxyz"; static long sum = 0; static long cnt = 0; static long max = -1; static long min = 2147483647; static bool flg = false; static bool flg2 = false; static char[,] map; static int[,] imap; static string rl() { return Console.ReadLine(); } static string[] rls() { return Console.ReadLine().Split(); } static void wl(object obj = null) { Console.WriteLine(obj); } static void w(object obj) { Console.Write(obj); } static int Int(string s) { return int.Parse(s); } static long Max(long a, long b) { return Math.Max(a, b); } static long Min(long a, long b) { return Math.Min(a, b); } static long Abs(long a) { return Math.Abs(a); } static void yes() { wl("YES"); } static void no() { wl("NO"); } static void Sum() { wl(sum); } static void Cnt() { wl(cnt); } static void setarray(int num = -1) { arr = new int[n]; if (num == -1) ss = rls(); for (int i = 0; i < n; i++) { if (num == -1) arr[i] = Int(ss[i]); else arr[i] = num; } } static void setmap(char def = '@') { if (r == 0 && c == 0) { ss = rls(); r = Int(ss[0]); c = Int(ss[1]); } map = new char[r, c]; for (int i = 0; i < r; i++) { if (def == '@') s = rl(); for (int j = 0; j < c; j++) { map[i, j] = (def == '@') ? s[j] : def; } } } static void setimap(int def = -1) { if (r == 0 && c == 0) { ss = rls(); r = Int(ss[0]); c = Int(ss[1]); } imap = new int[r, c]; for (int i = 0; i < r; i++) { if (def == -1) s = rl(); for (int j = 0; j < c; j++) { imap[i, j] = (def == -1) ? Int(s[j].ToString()) : def; } } } #endregion static void Main(string[] args) { ss = rls(); n = Int(ss[0]); int k = Int(ss[1]); n--; k--; int ans = n / k; if (n % k > 0) ans++; wl(ans); } }
[["-", 0, 195, 8, 196, 0, 1, 0, 213, 63, 22], ["-", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 85], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 1, 0, 223, 0, 68], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 31, 22], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 85], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 22], ["+", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 22], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 1, 0, 213, 63, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
8
716
27
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Numerics; namespace AtCoder { class Program { static void Main(string[] args) { var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); var result = Math.Pow(100, vals[0]) * vals[1]; Console.WriteLine((int)result); } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Numerics; namespace AtCoder { class Program { static void Main(string[] args) { var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); if (vals[1] == 100) vals[1]++; var result = Math.Pow(100, vals[0]) * vals[1]; Console.WriteLine((int)result); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 8, 196, 0, 57, 15, 16, 31, 204, 205, 22], ["+", 0, 57, 15, 16, 31, 204, 206, 207, 0, 70], ["+", 15, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 57, 15, 16, 31, 204, 206, 207, 0, 73], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 57, 64, 1, 0, 223, 0, 204, 205, 22], ["+", 64, 1, 0, 223, 0, 204, 206, 207, 0, 70], ["+", 0, 223, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 64, 1, 0, 223, 0, 204, 206, 207, 0, 73], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35]]
8
118
15
using System; namespace atcorder { class MainClass { public static void Main(string[] args) { atcorder.Ringo_s_Favorite_Numbers.Run(); } } public class Ringo_s_Favorite_Numbers { public Ringo_s_Favorite_Numbers() {} public static int Pow(int a, int b) { int k = 1; for (int i = 0; i < b; i++) k *= a; return k; } public static void Run() { int D, N; string s = Console.ReadLine(); D = int.Parse(s.Split(' ')[0]); N = int.Parse(s.Split(' ')[1]); Console.WriteLine(Pow(100, D) * N); } } }
using System; namespace atcorder { class MainClass { public static void Main(string[] args) { atcorder.Ringo_s_Favorite_Numbers.Run(); } } public class Ringo_s_Favorite_Numbers { public Ringo_s_Favorite_Numbers() {} public static int Pow(int a, int b) { int k = 1; for (int i = 0; i < b; i++) k *= a; return k; } public static void Run() { int D, N; string s = Console.ReadLine(); D = int.Parse(s.Split(' ')[0]); N = int.Parse(s.Split(' ')[1]); if (N == 100) N = 101; Console.WriteLine(Pow(100, D) * N); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 0, 202, 0, 32], ["+", 8, 196, 0, 57, 64, 1, 0, 11, 12, 203], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35]]
8
155
10
using System; namespace _99_2 { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(' '); int a = int.Parse(str[0]); int b = int.Parse(str[1]); Console.WriteLine((b - a + 1) * b / 2 - a / 2); } } }
using System; namespace _99_2 { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(' '); int a = int.Parse(str[0]); int b = int.Parse(str[1]); Console.WriteLine(((1 + b - a) * (b - a) / 2) - b); } } }
[["+", 31, 23, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 31, 203], ["+", 31, 16, 31, 23, 0, 16, 31, 16, 17, 72], ["-", 31, 16, 31, 16, 31, 23, 0, 16, 17, 72], ["-", 31, 16, 31, 16, 31, 23, 0, 16, 12, 203], ["+", 31, 23, 0, 16, 31, 16, 12, 23, 0, 24], ["-", 3, 4, 0, 28, 0, 16, 31, 16, 17, 85], ["-", 3, 4, 0, 28, 0, 16, 31, 16, 12, 203], ["+", 31, 23, 0, 16, 31, 16, 12, 23, 0, 25], ["+", 3, 4, 0, 28, 0, 16, 31, 23, 0, 25], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
8
87
12
using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { var p = Console.ReadLine().Split(' '); long D = long.Parse(p[0]); long N = long.Parse(p[1]); long basen = (long)Math.Pow(100, D); long num = basen * N; Console.WriteLine(num); } }
using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { var p = Console.ReadLine().Split(' '); long D = long.Parse(p[0]); long N = long.Parse(p[1]); long basen = (long)Math.Pow(100, D); long num = basen * N; if (N == 100) { num = basen * (N + 1); } Console.WriteLine(num); } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 64, 196, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 64, 196, 0, 1, 0, 11, 12, 16, 17, 48], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 203], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
8
101
18
using System; namespace ABC100_2 { class Program { static void Main(string[] args) { string[] a = Console.ReadLine().Split(); int D = Int32.Parse(a[0]); int N = Int32.Parse(a[1]); Console.WriteLine(Math.Pow(100, D) * N); } } }
using System; namespace ABC100_2 { class Program { static void Main(string[] args) { string[] a = Console.ReadLine().Split(); int D = Int32.Parse(a[0]); int N = Int32.Parse(a[1]); if (N == 100) N++; Console.WriteLine(Math.Pow(100, D) * N); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 22], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35]]
8
79
9
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection.Emit; using System.Text; using static System.Console; using static System.Math; //using CS_Contest.Graph; using CS_Contest.Loop; using CS_Contest.Utils; using static Nakov.IO.Cin; using static CS_Contest.IO.IO; using static CS_Contest.Utils.MyMath; 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() { // ABC099 int a = NextInt(), b = NextInt(); var range = new Li(); var next = 1; for (int i = 2; i <= 999; i++) { range.Add(next); next += i; } for (int i = 0; i < range.Count - 1; i++) { if (range[i] > a && range[i + 1] > b&&range[i]-a==range[i+1]-b) { (range[i] - a).WL(); return; } } 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 { [DebuggerStepThrough] 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 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); } } } public class Generate { public static IEnumerable<int> Seq(int e) => Seq(0, e, 1); public static IEnumerable<int> Seq(int s, int e) => Seq(s, e, 1); public static IEnumerable<int> Seq(int s, int e, int a) { while (s != e) { yield return s; s += a; } } public static List<T> Repeat<T>(Func<int, T> result, int range) => Enumerable.Range(0, range).Select(result).ToList(); } } 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 Li NextIntList(int n) => Enumerable.Repeat(0, n).Select(x => ReadLine()).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); public static T[,] GetBox<T>(int h, int w, Func<int, int, T> getFunc) { var rt = new T[h, w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { rt[i, j] = getFunc(i, j); } } return rt; } } } namespace CS_Contest.Utils { using Li = List<int>; using Ll = List<long>; [DebuggerStepThrough] public static class Utils { public static bool AnyOf<T>(this T @this, params T[] these) where T:IComparable { return these.Contains(@this); } 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 List<Tuple<TKey, TValue>> ToTupleList<TKey, TValue>(this Map<TKey, TValue> @this) => @this.Select(x => Tuple.Create(x.Key, x.Value)).ToList(); public static Map<TKey, int> CountUp<TKey>(this IEnumerable<TKey> l) { var dic = new Map<TKey, int>(); foreach (var item in l) { dic[item]++; } 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 static int LowerBound<T>(this List<T> @this, T x) where T : IComparable { int lb = -1, ub = @this.Count; while (ub - lb > 1) { int mid = (ub + lb) >> 1; if (@this[mid].CompareTo(x) >= 0) ub = mid; else lb = mid; } return ub; } public static int UpperBound<T>(this List<T> @this, T x) where T : IComparable { int lb = -1, ub = @this.Count; while (ub - lb > 1) { int mid = (ub + lb) >> 1; if (@this[mid].CompareTo(x) > 0) ub = mid; else lb = mid; } return ub; } } 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 T EMin<T>(params T[] a) where T : IComparable<T> => a.Min(); public static T EMax<T>(params T[] a) where T : IComparable<T> => a.Max(); } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection.Emit; using System.Text; using static System.Console; using static System.Math; //using CS_Contest.Graph; using CS_Contest.Loop; using CS_Contest.Utils; using static Nakov.IO.Cin; using static CS_Contest.IO.IO; using static CS_Contest.Utils.MyMath; 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() { // ABC099 int a = NextInt(), b = NextInt(); var range = new Li(); var next = 1; for (int i = 2; i <= 999; i++) { range.Add(next); next += i; } range.Add(next); for (int i = 0; i < range.Count - 1; i++) { if (range[i] > a && range[i + 1] > b && range[i] - a == range[i + 1] - b) { (range[i] - a).WL(); return; } } 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 { [DebuggerStepThrough] 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 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); } } } public class Generate { public static IEnumerable<int> Seq(int e) => Seq(0, e, 1); public static IEnumerable<int> Seq(int s, int e) => Seq(s, e, 1); public static IEnumerable<int> Seq(int s, int e, int a) { while (s != e) { yield return s; s += a; } } public static List<T> Repeat<T>(Func<int, T> result, int range) => Enumerable.Range(0, range).Select(result).ToList(); } } 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 Li NextIntList(int n) => Enumerable.Repeat(0, n).Select(x => ReadLine()).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); public static T[,] GetBox<T>(int h, int w, Func<int, int, T> getFunc) { var rt = new T[h, w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { rt[i, j] = getFunc(i, j); } } return rt; } } } namespace CS_Contest.Utils { using Li = List<int>; using Ll = List<long>; [DebuggerStepThrough] public static class Utils { public static bool AnyOf<T>(this T @this, params T[] these) where T:IComparable { return these.Contains(@this); } 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 List<Tuple<TKey, TValue>> ToTupleList<TKey, TValue>(this Map<TKey, TValue> @this) => @this.Select(x => Tuple.Create(x.Key, x.Value)).ToList(); public static Map<TKey, int> CountUp<TKey>(this IEnumerable<TKey> l) { var dic = new Map<TKey, int>(); foreach (var item in l) { dic[item]++; } 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 static int LowerBound<T>(this List<T> @this, T x) where T : IComparable { int lb = -1, ub = @this.Count; while (ub - lb > 1) { int mid = (ub + lb) >> 1; if (@this[mid].CompareTo(x) >= 0) ub = mid; else lb = mid; } return ub; } public static int UpperBound<T>(this List<T> @this, T x) where T : IComparable { int lb = -1, ub = @this.Count; while (ub - lb > 1) { int mid = (ub + lb) >> 1; if (@this[mid].CompareTo(x) > 0) ub = mid; else lb = mid; } return ub; } } 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 T EMin<T>(params T[] a) where T : IComparable<T> => a.Min(); public static T EMax<T>(params T[] a) where T : IComparable<T> => a.Max(); } }
[["+", 8, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35]]
8
2,125
7
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace AtCoder.ABC100.B { class Program { static void Main() { var sc = new Scanner(); var d = sc.Nextint(); var n = sc.Nextint(); Console.WriteLine(Math.Pow(100, d) * n); } } class Scanner { string[] s; long 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 long NextLong() { return long.Parse(Next()); } public long[] ArrayLong(int N, long add = 0) { long[] Array = new long[N]; for (long i = 0; i < N; i++) { Array[i] = NextLong() + add; } return Array; } public double NextDouble() { return double.Parse(Next()); } public double[] ArrayDouble(long N, double add = 0) { double[] Array = new double[N]; for (long i = 0; i < N; i++) { Array[i] = NextDouble() + add; } return Array; } public decimal NextDecimal() { return decimal.Parse(Next()); } public decimal[] ArrayDecimal(long N, decimal add = 0) { decimal[] Array = new decimal[N]; for (long i = 0; i < N; i++) { Array[i] = NextDecimal(); } return Array; } } }
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace AtCoder.ABC100.B { class Program { static void Main() { var sc = new Scanner(); var d = sc.Nextint(); var n = sc.Nextint(); if (n != 100) Console.WriteLine((int)Math.Pow(100, d) * n); else Console.WriteLine((int)Math.Pow(100, d) * (n + 1)); } } class Scanner { string[] s; long 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 long NextLong() { return long.Parse(Next()); } public long[] ArrayLong(int N, long add = 0) { long[] Array = new long[N]; for (long i = 0; i < N; i++) { Array[i] = NextLong() + add; } return Array; } public double NextDouble() { return double.Parse(Next()); } public double[] ArrayDouble(long N, double add = 0) { double[] Array = new double[N]; for (long i = 0; i < N; i++) { Array[i] = NextDouble() + add; } return Array; } public decimal NextDecimal() { return decimal.Parse(Next()); } public decimal[] ArrayDecimal(long N, decimal add = 0) { decimal[] Array = new decimal[N]; for (long i = 0; i < N; i++) { Array[i] = NextDecimal(); } return Array; } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 79], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 25], ["+", 0, 57, 64, 1, 0, 213, 3, 4, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["+", 0, 57, 75, 1, 0, 213, 63, 214, 205, 22], ["+", 0, 57, 75, 1, 0, 213, 63, 214, 0, 131], ["+", 0, 57, 75, 1, 0, 213, 63, 214, 141, 22], ["+", 0, 57, 75, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 16, 31, 74, 51, 213, 63, 214, 205, 22], ["+", 0, 16, 31, 74, 51, 213, 63, 214, 0, 131], ["+", 0, 16, 31, 74, 51, 213, 63, 214, 141, 22], ["+", 0, 16, 31, 74, 51, 213, 3, 4, 0, 24], ["+", 31, 74, 51, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 16, 31, 74, 51, 213, 3, 4, 0, 21], ["+", 31, 74, 51, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 16, 31, 74, 51, 213, 3, 4, 0, 25], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 48], ["+", 3, 4, 0, 28, 0, 16, 12, 23, 0, 24], ["+", 0, 28, 0, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 28, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 28, 0, 16, 12, 23, 0, 16, 12, 203], ["+", 3, 4, 0, 28, 0, 16, 12, 23, 0, 25]]
8
520
33
using System; public class Hello { public static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var d = int.Parse(line[0]); var n = int.Parse(line[1]); int a; if (d == 0) a = 1; else if (d == 1) a = 100; else a = 10000; var ret = n * a; Console.WriteLine(ret); } }
using System; public class Hello { public static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var d = int.Parse(line[0]); var n = int.Parse(line[1]); int a; if (d == 0) a = 1; else if (d == 1) a = 100; else a = 10000; var ret = n * a; if (n == 100) ret = 101 * a; Console.WriteLine(ret); } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 0, 202, 0, 32], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 203], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 48], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35]]
8
107
12
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Competitive { internal class Solution { public int D, N; public void Run() { { var line = Input.ReadIntArray(); D = line[0]; N = line[1]; } int ret = 1; for (int i = 0; i < D; i++) ret *= 100; ret *= N; Console.WriteLine(ret); } } // libs ---------- // common ---------- internal static class Input { public static string ReadString() { string line = Console.ReadLine(); return line; } public static int ReadInt() { string line = Console.ReadLine(); return int.Parse(line); } public static int[] ReadIntArray() { string line = Console.ReadLine(); return line.Split(' ').Select(int.Parse).ToArray(); } public static long ReadLong() { string line = Console.ReadLine(); return long.Parse(line); } public static long[] ReadLongArray() { string line = Console.ReadLine(); return line.Split(' ').Select(long.Parse).ToArray(); } public static double[] ReadDoubleArray() { string line = Console.ReadLine(); return line.Split(' ').Select(double.Parse).ToArray(); } } internal class Program { public static void Main(string[] args) { var s = new Solution(); s.Run(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Competitive { internal class Solution { public int D, N; public void Run() { { var line = Input.ReadIntArray(); D = line[0]; N = line[1]; } int ret = 1; for (int i = 0; i < D; i++) ret *= 100; if (N == 100) ret *= 101; else ret *= N; Console.WriteLine(ret); } } // libs ---------- // common ---------- internal static class Input { public static string ReadString() { string line = Console.ReadLine(); return line; } public static int ReadInt() { string line = Console.ReadLine(); return int.Parse(line); } public static int[] ReadIntArray() { string line = Console.ReadLine(); return line.Split(' ').Select(int.Parse).ToArray(); } public static long ReadLong() { string line = Console.ReadLine(); return long.Parse(line); } public static long[] ReadLongArray() { string line = Console.ReadLine(); return line.Split(' ').Select(long.Parse).ToArray(); } public static double[] ReadDoubleArray() { string line = Console.ReadLine(); return line.Split(' ').Select(double.Parse).ToArray(); } } internal class Program { public static void Main(string[] args) { var s = new Solution(); s.Run(); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 57, 64, 1, 0, 11, 0, 202, 0, 108], ["+", 8, 196, 0, 57, 64, 1, 0, 11, 12, 203], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["+", 8, 196, 0, 57, 75, 1, 0, 11, 31, 22]]
8
330
11
using System; using System.IO; using System.Collections.Generic; namespace ABC099B { public class Program { void Solve(StreamScanner ss, StreamWriter sw) { //--------------------------------- var A = ss.Next(int.Parse); var B = ss.Next(int.Parse); for (var i = 1; i < 1000; i++) for (var j = 1; j < 1000; j++) { var west = i * (i + 1) / 2; var east = j * (j + 1) / 2; if (west - A > 0 && west - A == east - B) { sw.WriteLine(west - A); return; } } //--------------------------------- } static void Main() { var ss = new StreamScanner(new StreamReader(Console.OpenStandardInput())); var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; new Program().Solve(ss, sw); sw.Flush(); } static readonly Func<string, string> String = s => s; } public class StreamScanner { static readonly char[] Sep = { ' ' }; readonly Queue<string> buffer = new Queue<string>(); readonly TextReader textReader; public StreamScanner(TextReader textReader) { this.textReader = textReader; } public T Next<T>(Func<string, T> parser) { if (buffer.Count != 0) return parser(buffer.Dequeue()); var nextStrings = textReader.ReadLine().Split(Sep, StringSplitOptions.RemoveEmptyEntries); foreach (var nextString in nextStrings) buffer.Enqueue(nextString); return Next(parser); } public T[] Next<T>(Func<string, T> parser, int x) { var ret = new T[x]; for (var i = 0; i < x; ++i) ret[i] = Next(parser); return ret; } public T[][] Next<T>(Func<string, T> parser, int x, int y) { var ret = new T[y][]; for (var i = 0; i < y; ++i) ret[i] = Next(parser, x); return ret; } } }
using System; using System.IO; using System.Collections.Generic; namespace ABC099B { public class Program { void Solve(StreamScanner ss, StreamWriter sw) { //--------------------------------- var A = ss.Next(int.Parse); var B = ss.Next(int.Parse); for (var i = 1; i < 999; i++) { var l = i * (i + 1) / 2; var r = (i + 1) * (i + 2) / 2; if (l - A > 0 && l - A == r - B) { sw.WriteLine(l - A); return; } } //--------------------------------- } static void Main() { var ss = new StreamScanner(new StreamReader(Console.OpenStandardInput())); var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; new Program().Solve(ss, sw); sw.Flush(); } static readonly Func<string, string> String = s => s; } public class StreamScanner { static readonly char[] Sep = { ' ' }; readonly Queue<string> buffer = new Queue<string>(); readonly TextReader textReader; public StreamScanner(TextReader textReader) { this.textReader = textReader; } public T Next<T>(Func<string, T> parser) { if (buffer.Count != 0) return parser(buffer.Dequeue()); var nextStrings = textReader.ReadLine().Split(Sep, StringSplitOptions.RemoveEmptyEntries); foreach (var nextString in nextStrings) buffer.Enqueue(nextString); return Next(parser); } public T[] Next<T>(Func<string, T> parser, int x) { var ret = new T[x]; for (var i = 0; i < x; ++i) ret[i] = Next(parser); return ret; } public T[][] Next<T>(Func<string, T> parser, int x, int y) { var ret = new T[y][]; for (var i = 0; i < y; ++i) ret[i] = Next(parser, x); return ret; } } }
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["-", 0, 195, 8, 196, 0, 7, 8, 7, 0, 88], ["-", 0, 195, 8, 196, 0, 7, 8, 7, 0, 24], ["-", 0, 7, 8, 7, 10, 198, 39, 216, 0, 217], ["-", 0, 7, 8, 7, 10, 198, 0, 200, 141, 22], ["-", 8, 7, 10, 198, 0, 200, 0, 212, 0, 32], ["-", 8, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["-", 0, 195, 8, 196, 0, 7, 8, 7, 0, 35], ["-", 8, 196, 0, 7, 8, 7, 15, 16, 31, 22], ["-", 8, 196, 0, 7, 8, 7, 15, 16, 17, 18], ["-", 8, 196, 0, 7, 8, 7, 15, 16, 12, 203], ["-", 8, 196, 0, 7, 8, 7, 26, 223, 0, 22], ["-", 8, 196, 0, 7, 8, 7, 26, 223, 0, 29], ["-", 0, 195, 8, 196, 0, 7, 8, 7, 0, 25], ["-", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["-", 0, 200, 0, 212, 0, 16, 31, 16, 31, 22], ["-", 0, 200, 0, 212, 0, 16, 31, 16, 17, 48], ["-", 0, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 212, 0, 16, 31, 16, 31, 23, 0, 25], ["+", 0, 200, 0, 212, 0, 16, 31, 16, 17, 48], ["+", 0, 212, 0, 16, 31, 16, 12, 23, 0, 24], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 16, 31, 16, 12, 23, 0, 16, 12, 203], ["-", 0, 57, 15, 16, 31, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 16, 31, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 16, 12, 16, 31, 16, 31, 22], ["+", 0, 57, 15, 16, 12, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 16, 12, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 16, 12, 16, 12, 16, 31, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22]]
8
469
38
using System; using System.Linq; class Program { static void Main(string[] args) { var array = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); var D = array[0]; var N = array[1]; Console.WriteLine(N * Math.Pow(100, D)); } }
using System; using System.Linq; class Program { static void Main(string[] args) { var array = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); var D = array[0]; var N = array[1] == 100 ? 101 : array[1]; Console.WriteLine(N * Math.Pow(100, D)); } }
[["+", 0, 200, 0, 212, 0, 41, 15, 16, 17, 60], ["+", 0, 200, 0, 212, 0, 41, 15, 16, 12, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 41, 0, 101], ["+", 0, 198, 0, 200, 0, 212, 0, 41, 64, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 41, 0, 102], ["+", 0, 200, 0, 212, 0, 41, 75, 204, 205, 22], ["+", 0, 212, 0, 41, 75, 204, 206, 207, 0, 70], ["+", 0, 41, 75, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 212, 0, 41, 75, 204, 206, 207, 0, 73]]
8
87
9
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtCoder { static class Program { static void Main() { Solve(); Console.ReadKey(); } static void Solve() { var N = GetInt(); List<int> a = new List<int>(); for (int i = 1; Math.Pow(6, i) <= N; i++) { a.Add((int)Math.Pow(6, i)); } for (int i = 1; Math.Pow(9, i) <= N; i++) { a.Add((int)Math.Pow(9, i)); } a = a.OrderBy(o => o).ToList(); var dp = Enumerable.Repeat(99999999999, N + 1).ToArray(); dp[0] = 0; for (int i = 1; i < N + 1; i++) { for (int j = 0; j < a.Count && 0 <= i - a[j]; j++) { dp[i] = Math.Min(dp[i - 1] + 1, dp[i - a[j]] + 1); } } var ans = dp[N]; Console.WriteLine(ans); } static public string GetStr() { return Console.ReadLine(); } static public int GetInt() { return int.Parse(Console.ReadLine()); } static public long GetLong() { return long.Parse(Console.ReadLine()); } static public string[] GetStrArray() { return Console.ReadLine().Split(' '); } static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); } static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); } static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); } static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } } static string yesno(this bool b) { return b ? "yes" : "no"; } static string YesNo(this bool b) { return b ? "Yes" : "No"; } static string YESNO(this bool b) { return b ? "YES" : "NO"; } static bool eq<T, U>() => typeof(T).Equals(typeof(U)); static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T)); static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s)) : eq<T, long>() ? ct<T, long>(long.Parse(s)) : eq<T, double>() ? ct<T, double>(double.Parse(s)) : eq<T, char>() ? ct<T, char>(s[0]) : ct<T, string>(s); static void Multi<T>(out T a) => a = cv<T>(GetStr()); static void Multi<T, U>(out T a, out U b) { var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); } static void Multi<T, U, V>(out T a, out U b, out V c) { var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtCoder { static class Program { static void Main() { Solve(); Console.ReadKey(); } static void Solve() { var N = GetInt(); List<int> a = new List<int>(); for (int i = 1; Math.Pow(6, i) <= N; i++) { a.Add((int)Math.Pow(6, i)); } for (int i = 1; Math.Pow(9, i) <= N; i++) { a.Add((int)Math.Pow(9, i)); } a = a.OrderBy(o => o).ToList(); var dp = Enumerable.Repeat(99999999999, N + 1).ToArray(); dp[0] = 0; for (int i = 1; i < N + 1; i++) { dp[i] = dp[i - 1] + 1; for (int j = 0; j < a.Count && 0 <= i - a[j]; j++) { dp[i] = Math.Min(dp[i], dp[i - a[j]] + 1); } } var ans = dp[N]; Console.WriteLine(ans); } static public string GetStr() { return Console.ReadLine(); } static public int GetInt() { return int.Parse(Console.ReadLine()); } static public long GetLong() { return long.Parse(Console.ReadLine()); } static public string[] GetStrArray() { return Console.ReadLine().Split(' '); } static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); } static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); } static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); } static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } } static string yesno(this bool b) { return b ? "yes" : "no"; } static string YesNo(this bool b) { return b ? "Yes" : "No"; } static string YESNO(this bool b) { return b ? "YES" : "NO"; } static bool eq<T, U>() => typeof(T).Equals(typeof(U)); static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T)); static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s)) : eq<T, long>() ? ct<T, long>(long.Parse(s)) : eq<T, double>() ? ct<T, double>(double.Parse(s)) : eq<T, char>() ? ct<T, char>(s[0]) : ct<T, string>(s); static void Multi<T>(out T a) => a = cv<T>(GetStr()); static void Multi<T, U>(out T a, out U b) { var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); } static void Multi<T, U, V>(out T a, out U b, out V c) { var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); } } }
[["+", 8, 196, 0, 1, 0, 11, 31, 204, 205, 22], ["+", 0, 1, 0, 11, 31, 204, 206, 207, 0, 70], ["+", 0, 11, 31, 204, 206, 207, 0, 28, 0, 22], ["+", 0, 1, 0, 11, 31, 204, 206, 207, 0, 73], ["+", 8, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 0, 1, 0, 11, 12, 16, 31, 204, 205, 22], ["+", 0, 11, 12, 16, 31, 204, 206, 207, 0, 70], ["+", 31, 204, 206, 207, 0, 28, 0, 16, 31, 22], ["+", 31, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 31, 204, 206, 207, 0, 28, 0, 16, 12, 203], ["+", 0, 11, 12, 16, 31, 204, 206, 207, 0, 73], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 12, 203], ["+", 8, 196, 0, 7, 8, 196, 0, 1, 0, 35], ["-", 31, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["-", 31, 204, 206, 207, 0, 28, 0, 16, 12, 203], ["-", 12, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["-", 12, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
8
890
18
using System; class RingosFavoriteNumbers { static void Main(string[] args) { var dn = Console.ReadLine().Split(' '); var d = int.Parse(dn[0]); var n = int.Parse(dn[1]); var result = n * (int)Math.Pow(100, d); Console.WriteLine(result); } }
using System; class RingosFavoriteNumbers { static void Main(string[] args) { var dn = Console.ReadLine().Split(' '); var d = int.Parse(dn[0]); var n = int.Parse(dn[1]); if (n == 100) { n = 101; } var result = n * (int)Math.Pow(100, d); Console.WriteLine(result); } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 203], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
8
84
12
using System; using System.Linq; using System.Collections.Generic; using System.Collections; namespace Algorithm { class Program { static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); var dp = Enumerable.Repeat(int.MaxValue, n + 1).ToArray(); dp[0] = 0; for (var i = 1; i <= n; i++) { if (i % 6 != 0 && i % 9 != 0) dp[i] = dp[i - 1] + 1; else { var six = 6; var multiple = 1; while (i - six >= 0) { dp[i] = Math.Min(dp[i], dp[i - six] + 1); six = (int)Math.Pow(6, ++multiple); } var nine = 9; multiple = 1; while (i - nine >= 0) { dp[i] = Math.Min(dp[i], dp[i - nine] + 1); nine = (int)Math.Pow(9, ++multiple); } } } Console.WriteLine(dp[n]); } } }
using System; using System.Linq; using System.Collections.Generic; using System.Collections; namespace Algorithm { class Program { static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); var dp = Enumerable.Repeat(int.MaxValue, n + 1).ToArray(); dp[0] = 0; for (var i = 1; i <= n; i++) { dp[i] = dp[i - 1] + 1; var six = 6; var multiple = 1; while (i - six >= 0) { dp[i] = Math.Min(dp[i], dp[i - six] + 1); six = (int)Math.Pow(6, ++multiple); } var nine = 9; multiple = 1; while (i - nine >= 0) { dp[i] = Math.Min(dp[i], dp[i - nine] + 1); nine = (int)Math.Pow(9, ++multiple); } } Console.WriteLine(dp[n]); } } }
[["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 24], ["-", 0, 57, 15, 16, 31, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 16, 31, 16, 31, 16, 17, 109], ["-", 0, 57, 15, 16, 31, 16, 31, 16, 12, 203], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 79], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203], ["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 98], ["-", 0, 57, 15, 16, 12, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 16, 12, 16, 31, 16, 17, 109], ["-", 0, 57, 15, 16, 12, 16, 31, 16, 12, 203], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 79], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 12, 203], ["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 25], ["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 196, 0, 45], ["-", 0, 57, 75, 196, 0, 52, 8, 196, 0, 46]]
8
254
17
using System; using System.IO; using System.Collections.Generic; namespace ABC100B { public class Program { void Solve(StreamScanner ss, StreamWriter sw) { //--------------------------------- var D = ss.Next(int.Parse); var N = ss.Next(int.Parse); if (D == 0 && N == 100) sw.WriteLine(101); sw.WriteLine((int)Math.Pow(100, D) * N); //--------------------------------- } static void Main() { var ss = new StreamScanner(new StreamReader(Console.OpenStandardInput())); var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; new Program().Solve(ss, sw); sw.Flush(); } static readonly Func<string, string> String = s => s; } public class StreamScanner { static readonly char[] Sep = { ' ' }; readonly Queue<string> buffer = new Queue<string>(); readonly TextReader textReader; public StreamScanner(TextReader textReader) { this.textReader = textReader; } public T Next<T>(Func<string, T> parser) { if (buffer.Count != 0) return parser(buffer.Dequeue()); var nextStrings = textReader.ReadLine().Split(Sep, StringSplitOptions.RemoveEmptyEntries); foreach (var nextString in nextStrings) buffer.Enqueue(nextString); return Next(parser); } public T[] Next<T>(Func<string, T> parser, int x) { var ret = new T[x]; for (var i = 0; i < x; ++i) ret[i] = Next(parser); return ret; } public T[][] Next<T>(Func<string, T> parser, int x, int y) { var ret = new T[y][]; for (var i = 0; i < y; ++i) ret[i] = Next(parser, x); return ret; } } }
using System; using System.IO; using System.Collections.Generic; namespace ABC100B { public class Program { void Solve(StreamScanner ss, StreamWriter sw) { //--------------------------------- var D = ss.Next(int.Parse); var N = ss.Next(int.Parse); if (N == 100) N++; sw.WriteLine((int)Math.Pow(100, D) * N); //--------------------------------- } static void Main() { var ss = new StreamScanner(new StreamReader(Console.OpenStandardInput())); var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; new Program().Solve(ss, sw); sw.Flush(); } static readonly Func<string, string> String = s => s; } public class StreamScanner { static readonly char[] Sep = { ' ' }; readonly Queue<string> buffer = new Queue<string>(); readonly TextReader textReader; public StreamScanner(TextReader textReader) { this.textReader = textReader; } public T Next<T>(Func<string, T> parser) { if (buffer.Count != 0) return parser(buffer.Dequeue()); var nextStrings = textReader.ReadLine().Split(Sep, StringSplitOptions.RemoveEmptyEntries); foreach (var nextString in nextStrings) buffer.Enqueue(nextString); return Next(parser); } public T[] Next<T>(Func<string, T> parser, int x) { var ret = new T[x]; for (var i = 0; i < x; ++i) ret[i] = Next(parser); return ret; } public T[][] Next<T>(Func<string, T> parser, int x, int y) { var ret = new T[y][]; for (var i = 0; i < y; ++i) ret[i] = Next(parser, x); return ret; } } }
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 60], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["-", 0, 57, 64, 1, 0, 213, 63, 214, 205, 22], ["-", 0, 57, 64, 1, 0, 213, 63, 214, 0, 131], ["-", 0, 57, 64, 1, 0, 213, 63, 214, 141, 22], ["-", 0, 57, 64, 1, 0, 213, 3, 4, 0, 24], ["-", 64, 1, 0, 213, 3, 4, 0, 28, 0, 203], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 22], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 29]]
8
420
12
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.IO; using System.Text; using System.Diagnostics; using static util; using P = pair<int, int>; using Binary = System.Func<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.BinaryExpression>; using Unary = System.Func<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.UnaryExpression>; class Program { static StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; static Scan sc = new Scan(); const int M = 1000000007; // const int M = 998244353; const long LM = (long)1e18; const double eps = 1e-11; static readonly int[] dd = { 0, 1, 0, -1, 0 }; const string dstring = "RDLU"; static void Main() { int n = sc.Int; int ans = 0; for (int i = 0; i < n; i++) { int a = sc.Int; while ((a & 1) == 0) { ++ans; a >>= 1; } } Prt(ans); sw.Flush(); } static void DBG(string a) => Console.WriteLine(a); static void DBG<T>(IEnumerable<T> a) => DBG(string.Join(" ", a)); static void DBG(params object[] a) => DBG(string.Join(" ", a)); static void Prt(string a) => sw.WriteLine(a); static void Prt<T>(IEnumerable<T> a) => Prt(string.Join(" ", a)); static void Prt(params object[] a) => Prt(string.Join(" ", a)); } class pair<T, U> : IComparable<pair<T, U>> where T : IComparable<T> where U : IComparable<U> { public T v1; public U v2; public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; } public int CompareTo(pair<T, U> a) => v1.CompareTo(a.v1) != 0 ? v1.CompareTo(a.v1) : v2.CompareTo(a.v2); public override string ToString() => v1 + " " + v2; } static class util { public static pair<T, T> make_pair<T>(this IList<T> l) where T : IComparable<T> => make_pair(l[0], l[1]); public static pair<T, U> make_pair<T, U>(T v1, U v2) where T : IComparable<T> where U : IComparable<U> => new pair<T, U>(v1, v2); public static T sqr<T>(T a) => Operator<T>.Multiply(a, a); public static T Max<T>(params T[] a) => a.Max(); public static T Min<T>(params T[] a) => a.Min(); public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w; public static void swap<T>(ref T a, ref T b) { var t = a; a = b; b = t; } public static void swap<T>(this IList<T> a, int i, int j) { var t = a[i]; a[i] = a[j]; a[j] = t; } public static T[] copy<T>(this IList<T> a) { var ret = new T[a.Count]; for (int i = 0; i < a.Count; i++) ret[i] = a[i]; return ret; } } static class Operator<T> { static readonly ParameterExpression x = Expression.Parameter(typeof(T), "x"); static readonly ParameterExpression y = Expression.Parameter(typeof(T), "y"); public static readonly Func<T, T, T> Add = Lambda(Expression.Add); public static readonly Func<T, T, T> Subtract = Lambda(Expression.Subtract); public static readonly Func<T, T, T> Multiply = Lambda(Expression.Multiply); public static readonly Func<T, T, T> Divide = Lambda(Expression.Divide); public static readonly Func<T, T> Plus = Lambda(Expression.UnaryPlus); public static readonly Func<T, T> Negate = Lambda(Expression.Negate); public static Func<T, T, T> Lambda(Binary op) => Expression.Lambda<Func<T, T, T>>(op(x, y), x, y).Compile(); public static Func<T, T> Lambda(Unary op) => Expression.Lambda<Func<T, T>>(op(x), x).Compile(); } class Scan { public int Int => int.Parse(Str); public long Long => long.Parse(Str); public double Double => double.Parse(Str); public string Str => Console.ReadLine().Trim(); public pair<T, U> Pair<T, U>() where T : IComparable<T> where U : IComparable<U> { T a; U b; Multi(out a, out b); return new pair<T, U>(a, b); } public int[] IntArr => StrArr.Select(int.Parse).ToArray(); public long[] LongArr => StrArr.Select(long.Parse).ToArray(); public double[] DoubleArr => StrArr.Select(double.Parse).ToArray(); public string[] StrArr => Str.Split(new []{' '}, System.StringSplitOptions.RemoveEmptyEntries); bool eq<T, U>() => typeof(T).Equals(typeof(U)); T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T)); T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s)) : eq<T, long>() ? ct<T, long>(long.Parse(s)) : eq<T, double>() ? ct<T, double>(double.Parse(s)) : eq<T, char>() ? ct<T, char>(s[0]) : ct<T, string>(s); public void Multi<T>(out T a) => a = cv<T>(Str); public void Multi<T, U>(out T a, out U b) { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); } public void Multi<T, U, V>(out T a, out U b, out V c) { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); } public void Multi<T, U, V, W>(out T a, out U b, out V c, out W d) { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); } public void Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e) { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]); } public void Multi<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f) { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]); f = cv<Y>(ar[5]); } } static class mymath { public static long Mod = 1000000007; public static bool isprime(long a) { if (a < 2) return false; for (long i = 2; i * i <= a; i++) if (a % i == 0) return false; return true; } public static bool[] sieve(int n) { var p = new bool[n + 1]; for (int i = 2; i <= n; i++) p[i] = true; for (int i = 2; i * i <= n; i++) if (p[i]) for (int j = i * i; j <= n; j += i) p[j] = false; return p; } public static List<int> getprimes(int n) { var prs = new List<int>(); var p = sieve(n); for (int i = 2; i <= n; i++) if (p[i]) prs.Add(i); return prs; } public static long[][] E(int n) { var ret = new long[n][]; for (int i = 0; i < n; i++) { ret[i] = new long[n]; ret[i][i] = 1; } return ret; } public static double[][] dE(int n) { var ret = new double[n][]; for (int i = 0; i < n; i++) { ret[i] = new double[n]; ret[i][i] = 1; } return ret; } public static long[][] pow(long[][] A, long n) { if (n == 0) return E(A.Length); var t = pow(A, n / 2); if ((n & 1) == 0) return mul(t, t); return mul(mul(t, t), A); } public static double[][] pow(double[][] A, long n) { if (n == 0) return dE(A.Length); var t = pow(A, n / 2); if ((n & 1) == 0) return mul(t, t); return mul(mul(t, t), A); } public static double dot(double[] x, double[] y) { int n = x.Length; double ret = 0; for (int i = 0; i < n; i++) ret += x[i] * y[i]; return ret; } public static long dot(long[] x, long[] y) { int n = x.Length; long ret = 0; for (int i = 0; i < n; i++) ret = (ret + x[i] * y[i]) % Mod; return ret; } public static int dot(int[] x, int[] y) { int n = x.Length; int ret = 0; for (int i = 0; i < n; i++) ret += x[i] * y[i]; return ret; } public static T[][] trans<T>(T[][] A) { int n = A[0].Length, m = A.Length; var ret = new T[n][]; for (int i = 0; i < n; i++) { ret[i] = new T[m]; for (int j = 0; j < m; j++) ret[i][j] = A[j][i]; } return ret; } public static double[] mul(double a, double[] x) { int n = x.Length; var ret = new double[n]; for (int i = 0; i < n; i++) ret[i] = a * x[i]; return ret; } public static long[] mul(long a, long[] x) { int n = x.Length; var ret = new long[n]; for (int i = 0; i < n; i++) ret[i] = a * x[i] % Mod; return ret; } public static double[] mul(double[][] A, double[] x) { int n = A.Length; var ret = new double[n]; for (int i = 0; i < n; i++) ret[i] = dot(x, A[i]); return ret; } public static long[] mul(long[][] A, long[] x) { int n = A.Length; var ret = new long[n]; for (int i = 0; i < n; i++) ret[i] = dot(x, A[i]); return ret; } public static int[] mul(int[][] A, int[] x) { int n = A.Length; var ret = new int[n]; for (int i = 0; i < n; i++) ret[i] = dot(x, A[i]); return ret; } public static double[][] mul(double a, double[][] A) { int n = A.Length; var ret = new double[n][]; for (int i = 0; i < n; i++) ret[i] = mul(a, A[i]); return ret; } public static long[][] mul(long a, long[][] A) { int n = A.Length; var ret = new long[n][]; for (int i = 0; i < n; i++) ret[i] = mul(a, A[i]); return ret; } public static double[][] mul(double[][] A, double[][] B) { int n = A.Length; var Bt = trans(B); var ret = new double[n][]; for (int i = 0; i < n; i++) ret[i] = mul(Bt, A[i]); return ret; } public static long[][] mul(long[][] A, long[][] B) { int n = A.Length; var Bt = trans(B); var ret = new long[n][]; for (int i = 0; i < n; i++) ret[i] = mul(Bt, A[i]); return ret; } public static int[][] mul(int[][] A, int[][] B) { int n = A.Length; var Bt = trans(B); var ret = new int[n][]; for (int i = 0; i < n; i++) ret[i] = mul(Bt, A[i]); return ret; } public static long[] add(long[] x, long[] y) { int n = x.Length; var ret = new long[n]; for (int i = 0; i < n; i++) ret[i] = (x[i] + y[i]) % Mod; return ret; } public static int[] add(int[] x, int[] y) { int n = x.Length; var ret = new int[n]; for (int i = 0; i < n; i++) ret[i] = x[i] + y[i]; return ret; } public static long[][] add(long[][] A, long[][] B) { int n = A.Length; var ret = new long[n][]; for (int i = 0; i < n; i++) ret[i] = add(A[i], B[i]); return ret; } public static double[] add(double[] x, double[] y) { int n = x.Length; var ret = new double[n]; for (int i = 0; i < n; i++) ret[i] = (x[i] + y[i]) % Mod; return ret; } public static double[][] add(double[][] A, double[][] B) { int n = A.Length; var ret = new double[n][]; for (int i = 0; i < n; i++) ret[i] = add(A[i], B[i]); return ret; } public static long pow(long a, long b) { if (a >= Mod) return pow(a % Mod, b); if (a == 0) return 0; if (b == 0) return 1; var t = pow(a, b / 2); if ((b & 1) == 0) return t * t % Mod; return t * t % Mod * a % Mod; } public static long inv(long a) => pow(a, Mod - 2); public static long gcd(long a, long b) { while (b > 0) { var t = a % b; a = b; b = t; } return a; } // a x + b y = gcd(a, b) public static long extgcd(long a, long b, out long x, out long y) { long g = a; x = 1; y = 0; if (b > 0) { g = extgcd(b, a % b, out y, out x); y -= a / b * x; } return g; } public static long lcm(long a, long b) => a / gcd(a, b) * b; static long[] facts; public static long[] setfacts(int n) { facts = new long[n + 1]; facts[0] = 1; for (int i = 0; i < n; i++) facts[i + 1] = facts[i] * (i + 1) % Mod; return facts; } public static long comb(int n, int r) { if (n < 0 || r < 0 || r > n) return 0; if (n - r < r) r = n - r; if (r == 0) return 1; if (r == 1) return n; if (facts != null && facts.Length > n) return facts[n] * inv(facts[r]) % Mod * inv(facts[n - r]) % Mod; int[] numer = new int[r], denom = new int[r]; for (int k = 0; k < r; k++) { numer[k] = n - r + k + 1; denom[k] = k + 1; } for (int p = 2; p <= r; p++) { int piv = denom[p - 1]; if (piv > 1) { int ofst = (n - r) % p; for (int k = p - 1; k < r; k += p) { numer[k - ofst] /= piv; denom[k] /= piv; } } } long ret = 1; for (int k = 0; k < r; k++) if (numer[k] > 1) ret = ret * numer[k] % Mod; return ret; } public static long[][] getcombs(int n) { var ret = new long[n + 1][]; for (int i = 0; i <= n; i++) { ret[i] = new long[i + 1]; ret[i][0] = ret[i][i] = 1; for (int j = 1; j < i; j++) ret[i][j] = (ret[i - 1][j - 1] + ret[i - 1][j]) % Mod; } return ret; } // nC0, nC2, ..., nCn public static long[] getcomb(int n) { var ret = new long[n + 1]; ret[0] = 1; for (int i = 0; i < n; i++) ret[i + 1] = ret[i] * (n - i) % Mod * inv(i + 1) % Mod; return ret; } }
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.IO; using System.Text; using System.Diagnostics; using static util; using P = pair<int, int>; using Binary = System.Func<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.BinaryExpression>; using Unary = System.Func<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.UnaryExpression>; class Program { static StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; static Scan sc = new Scan(); const int M = 1000000007; // const int M = 998244353; const long LM = (long)1e18; const double eps = 1e-11; static readonly int[] dd = { 0, 1, 0, -1, 0 }; const string dstring = "RDLU"; static void Main() { int n = sc.Int; int ans = 0; var _a = sc.IntArr; foreach (var item in _a) { int a = item; while ((a & 1) == 0) { ++ans; a >>= 1; } } Prt(ans); sw.Flush(); } static void DBG(string a) => Console.WriteLine(a); static void DBG<T>(IEnumerable<T> a) => DBG(string.Join(" ", a)); static void DBG(params object[] a) => DBG(string.Join(" ", a)); static void Prt(string a) => sw.WriteLine(a); static void Prt<T>(IEnumerable<T> a) => Prt(string.Join(" ", a)); static void Prt(params object[] a) => Prt(string.Join(" ", a)); } class pair<T, U> : IComparable<pair<T, U>> where T : IComparable<T> where U : IComparable<U> { public T v1; public U v2; public pair(T v1, U v2) { this.v1 = v1; this.v2 = v2; } public int CompareTo(pair<T, U> a) => v1.CompareTo(a.v1) != 0 ? v1.CompareTo(a.v1) : v2.CompareTo(a.v2); public override string ToString() => v1 + " " + v2; } static class util { public static pair<T, T> make_pair<T>(this IList<T> l) where T : IComparable<T> => make_pair(l[0], l[1]); public static pair<T, U> make_pair<T, U>(T v1, U v2) where T : IComparable<T> where U : IComparable<U> => new pair<T, U>(v1, v2); public static T sqr<T>(T a) => Operator<T>.Multiply(a, a); public static T Max<T>(params T[] a) => a.Max(); public static T Min<T>(params T[] a) => a.Min(); public static bool inside(int i, int j, int h, int w) => i >= 0 && i < h && j >= 0 && j < w; public static void swap<T>(ref T a, ref T b) { var t = a; a = b; b = t; } public static void swap<T>(this IList<T> a, int i, int j) { var t = a[i]; a[i] = a[j]; a[j] = t; } public static T[] copy<T>(this IList<T> a) { var ret = new T[a.Count]; for (int i = 0; i < a.Count; i++) ret[i] = a[i]; return ret; } } static class Operator<T> { static readonly ParameterExpression x = Expression.Parameter(typeof(T), "x"); static readonly ParameterExpression y = Expression.Parameter(typeof(T), "y"); public static readonly Func<T, T, T> Add = Lambda(Expression.Add); public static readonly Func<T, T, T> Subtract = Lambda(Expression.Subtract); public static readonly Func<T, T, T> Multiply = Lambda(Expression.Multiply); public static readonly Func<T, T, T> Divide = Lambda(Expression.Divide); public static readonly Func<T, T> Plus = Lambda(Expression.UnaryPlus); public static readonly Func<T, T> Negate = Lambda(Expression.Negate); public static Func<T, T, T> Lambda(Binary op) => Expression.Lambda<Func<T, T, T>>(op(x, y), x, y).Compile(); public static Func<T, T> Lambda(Unary op) => Expression.Lambda<Func<T, T>>(op(x), x).Compile(); } class Scan { public int Int => int.Parse(Str); public long Long => long.Parse(Str); public double Double => double.Parse(Str); public string Str => Console.ReadLine().Trim(); public pair<T, U> Pair<T, U>() where T : IComparable<T> where U : IComparable<U> { T a; U b; Multi(out a, out b); return new pair<T, U>(a, b); } public int[] IntArr => StrArr.Select(int.Parse).ToArray(); public long[] LongArr => StrArr.Select(long.Parse).ToArray(); public double[] DoubleArr => StrArr.Select(double.Parse).ToArray(); public string[] StrArr => Str.Split(new []{' '}, System.StringSplitOptions.RemoveEmptyEntries); bool eq<T, U>() => typeof(T).Equals(typeof(U)); T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T)); T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s)) : eq<T, long>() ? ct<T, long>(long.Parse(s)) : eq<T, double>() ? ct<T, double>(double.Parse(s)) : eq<T, char>() ? ct<T, char>(s[0]) : ct<T, string>(s); public void Multi<T>(out T a) => a = cv<T>(Str); public void Multi<T, U>(out T a, out U b) { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); } public void Multi<T, U, V>(out T a, out U b, out V c) { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); } public void Multi<T, U, V, W>(out T a, out U b, out V c, out W d) { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); } public void Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e) { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]); } public void Multi<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f) { var ar = StrArr; a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]); f = cv<Y>(ar[5]); } } static class mymath { public static long Mod = 1000000007; public static bool isprime(long a) { if (a < 2) return false; for (long i = 2; i * i <= a; i++) if (a % i == 0) return false; return true; } public static bool[] sieve(int n) { var p = new bool[n + 1]; for (int i = 2; i <= n; i++) p[i] = true; for (int i = 2; i * i <= n; i++) if (p[i]) for (int j = i * i; j <= n; j += i) p[j] = false; return p; } public static List<int> getprimes(int n) { var prs = new List<int>(); var p = sieve(n); for (int i = 2; i <= n; i++) if (p[i]) prs.Add(i); return prs; } public static long[][] E(int n) { var ret = new long[n][]; for (int i = 0; i < n; i++) { ret[i] = new long[n]; ret[i][i] = 1; } return ret; } public static double[][] dE(int n) { var ret = new double[n][]; for (int i = 0; i < n; i++) { ret[i] = new double[n]; ret[i][i] = 1; } return ret; } public static long[][] pow(long[][] A, long n) { if (n == 0) return E(A.Length); var t = pow(A, n / 2); if ((n & 1) == 0) return mul(t, t); return mul(mul(t, t), A); } public static double[][] pow(double[][] A, long n) { if (n == 0) return dE(A.Length); var t = pow(A, n / 2); if ((n & 1) == 0) return mul(t, t); return mul(mul(t, t), A); } public static double dot(double[] x, double[] y) { int n = x.Length; double ret = 0; for (int i = 0; i < n; i++) ret += x[i] * y[i]; return ret; } public static long dot(long[] x, long[] y) { int n = x.Length; long ret = 0; for (int i = 0; i < n; i++) ret = (ret + x[i] * y[i]) % Mod; return ret; } public static int dot(int[] x, int[] y) { int n = x.Length; int ret = 0; for (int i = 0; i < n; i++) ret += x[i] * y[i]; return ret; } public static T[][] trans<T>(T[][] A) { int n = A[0].Length, m = A.Length; var ret = new T[n][]; for (int i = 0; i < n; i++) { ret[i] = new T[m]; for (int j = 0; j < m; j++) ret[i][j] = A[j][i]; } return ret; } public static double[] mul(double a, double[] x) { int n = x.Length; var ret = new double[n]; for (int i = 0; i < n; i++) ret[i] = a * x[i]; return ret; } public static long[] mul(long a, long[] x) { int n = x.Length; var ret = new long[n]; for (int i = 0; i < n; i++) ret[i] = a * x[i] % Mod; return ret; } public static double[] mul(double[][] A, double[] x) { int n = A.Length; var ret = new double[n]; for (int i = 0; i < n; i++) ret[i] = dot(x, A[i]); return ret; } public static long[] mul(long[][] A, long[] x) { int n = A.Length; var ret = new long[n]; for (int i = 0; i < n; i++) ret[i] = dot(x, A[i]); return ret; } public static int[] mul(int[][] A, int[] x) { int n = A.Length; var ret = new int[n]; for (int i = 0; i < n; i++) ret[i] = dot(x, A[i]); return ret; } public static double[][] mul(double a, double[][] A) { int n = A.Length; var ret = new double[n][]; for (int i = 0; i < n; i++) ret[i] = mul(a, A[i]); return ret; } public static long[][] mul(long a, long[][] A) { int n = A.Length; var ret = new long[n][]; for (int i = 0; i < n; i++) ret[i] = mul(a, A[i]); return ret; } public static double[][] mul(double[][] A, double[][] B) { int n = A.Length; var Bt = trans(B); var ret = new double[n][]; for (int i = 0; i < n; i++) ret[i] = mul(Bt, A[i]); return ret; } public static long[][] mul(long[][] A, long[][] B) { int n = A.Length; var Bt = trans(B); var ret = new long[n][]; for (int i = 0; i < n; i++) ret[i] = mul(Bt, A[i]); return ret; } public static int[][] mul(int[][] A, int[][] B) { int n = A.Length; var Bt = trans(B); var ret = new int[n][]; for (int i = 0; i < n; i++) ret[i] = mul(Bt, A[i]); return ret; } public static long[] add(long[] x, long[] y) { int n = x.Length; var ret = new long[n]; for (int i = 0; i < n; i++) ret[i] = (x[i] + y[i]) % Mod; return ret; } public static int[] add(int[] x, int[] y) { int n = x.Length; var ret = new int[n]; for (int i = 0; i < n; i++) ret[i] = x[i] + y[i]; return ret; } public static long[][] add(long[][] A, long[][] B) { int n = A.Length; var ret = new long[n][]; for (int i = 0; i < n; i++) ret[i] = add(A[i], B[i]); return ret; } public static double[] add(double[] x, double[] y) { int n = x.Length; var ret = new double[n]; for (int i = 0; i < n; i++) ret[i] = (x[i] + y[i]) % Mod; return ret; } public static double[][] add(double[][] A, double[][] B) { int n = A.Length; var ret = new double[n][]; for (int i = 0; i < n; i++) ret[i] = add(A[i], B[i]); return ret; } public static long pow(long a, long b) { if (a >= Mod) return pow(a % Mod, b); if (a == 0) return 0; if (b == 0) return 1; var t = pow(a, b / 2); if ((b & 1) == 0) return t * t % Mod; return t * t % Mod * a % Mod; } public static long inv(long a) => pow(a, Mod - 2); public static long gcd(long a, long b) { while (b > 0) { var t = a % b; a = b; b = t; } return a; } // a x + b y = gcd(a, b) public static long extgcd(long a, long b, out long x, out long y) { long g = a; x = 1; y = 0; if (b > 0) { g = extgcd(b, a % b, out y, out x); y -= a / b * x; } return g; } public static long lcm(long a, long b) => a / gcd(a, b) * b; static long[] facts; public static long[] setfacts(int n) { facts = new long[n + 1]; facts[0] = 1; for (int i = 0; i < n; i++) facts[i + 1] = facts[i] * (i + 1) % Mod; return facts; } public static long comb(int n, int r) { if (n < 0 || r < 0 || r > n) return 0; if (n - r < r) r = n - r; if (r == 0) return 1; if (r == 1) return n; if (facts != null && facts.Length > n) return facts[n] * inv(facts[r]) % Mod * inv(facts[n - r]) % Mod; int[] numer = new int[r], denom = new int[r]; for (int k = 0; k < r; k++) { numer[k] = n - r + k + 1; denom[k] = k + 1; } for (int p = 2; p <= r; p++) { int piv = denom[p - 1]; if (piv > 1) { int ofst = (n - r) % p; for (int k = p - 1; k < r; k += p) { numer[k - ofst] /= piv; denom[k] /= piv; } } } long ret = 1; for (int k = 0; k < r; k++) if (numer[k] > 1) ret = ret * numer[k] % Mod; return ret; } public static long[][] getcombs(int n) { var ret = new long[n + 1][]; for (int i = 0; i <= n; i++) { ret[i] = new long[i + 1]; ret[i][0] = ret[i][i] = 1; for (int j = 1; j < i; j++) ret[i][j] = (ret[i - 1][j - 1] + ret[i - 1][j]) % Mod; } return ret; } // nC0, nC2, ..., nCn public static long[] getcomb(int n) { var ret = new long[n + 1]; ret[0] = 1; for (int i = 0; i < n; i++) ret[i + 1] = ret[i] * (n - i) % Mod * inv(i + 1) % Mod; return ret; } }
[["-", 8, 201, 0, 195, 8, 196, 0, 7, 0, 88], ["-", 8, 201, 0, 195, 8, 196, 0, 7, 0, 24], ["-", 0, 195, 8, 196, 0, 7, 10, 198, 39, 199], ["-", 8, 196, 0, 7, 10, 198, 0, 200, 141, 22], ["+", 8, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["-", 8, 201, 0, 195, 8, 196, 0, 7, 0, 35], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 31, 22], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 198, 0, 200, 0, 212, 0, 214, 205, 22], ["+", 0, 198, 0, 200, 0, 212, 0, 214, 0, 131], ["+", 0, 198, 0, 200, 0, 212, 0, 214, 141, 22], ["-", 0, 195, 8, 196, 0, 7, 26, 223, 0, 22], ["-", 0, 195, 8, 196, 0, 7, 26, 223, 0, 29], ["+", 8, 201, 0, 195, 8, 196, 0, 210, 0, 266], ["+", 8, 201, 0, 195, 8, 196, 0, 210, 0, 24], ["+", 0, 195, 8, 196, 0, 210, 39, 216, 0, 217], ["+", 8, 201, 0, 195, 8, 196, 0, 210, 31, 22], ["+", 8, 201, 0, 195, 8, 196, 0, 210, 0, 267], ["+", 8, 201, 0, 195, 8, 196, 0, 210, 12, 22], ["-", 0, 198, 0, 200, 0, 212, 0, 214, 205, 22], ["-", 0, 198, 0, 200, 0, 212, 0, 214, 0, 131], ["-", 0, 198, 0, 200, 0, 212, 0, 214, 141, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 22]]
8
4,591
26
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection.Emit; using System.Text; using static System.Console; using static System.Math; //using CS_Contest.Graph; using CS_Contest.Loop; using CS_Contest.Utils; using static Nakov.IO.Cin; using static CS_Contest.IO.IO; using static CS_Contest.Utils.MyMath; 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() { // ABC099 var N = NextInt(); var ans = int.MaxValue; var nl = new Li {6561, 729, 81, 9}; var sl = new Li {7776, 1296, 216, 36, 6}; for (int i = 0; i < N/9; i++) { var six = (N - 9 * i) / 6; var one = (N - 9 * i - 6 * six); var next = 0; var nine = i; foreach (var nn in nl) { var cnt = nine / nn; nine -= cnt * nn; next += cnt; } next += nine; foreach (var ss in sl) { var cnt = six / ss; six -= cnt * ss; next += cnt; } next += six; ans = Min(ans, next + one); } Min(ans,N).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 { [DebuggerStepThrough] 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 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); } } } public class Generate { public static IEnumerable<int> Seq(int e) => Seq(0, e, 1); public static IEnumerable<int> Seq(int s, int e) => Seq(s, e, 1); public static IEnumerable<int> Seq(int s, int e, int a) { while (s != e) { yield return s; s += a; } } public static List<T> Repeat<T>(Func<int, T> result, int range) => Enumerable.Range(0, range).Select(result).ToList(); } } 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 Li NextIntList(int n) => Enumerable.Repeat(0, n).Select(x => ReadLine()).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); public static T[,] GetBox<T>(int h, int w, Func<int, int, T> getFunc) { var rt = new T[h, w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { rt[i, j] = getFunc(i, j); } } return rt; } } } namespace CS_Contest.Utils { using Li = List<int>; using Ll = List<long>; [DebuggerStepThrough] public static class Utils { public static bool AnyOf<T>(this T @this, params T[] these) where T:IComparable { return these.Contains(@this); } 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 List<Tuple<TKey, TValue>> ToTupleList<TKey, TValue>(this Map<TKey, TValue> @this) => @this.Select(x => Tuple.Create(x.Key, x.Value)).ToList(); public static Map<TKey, int> CountUp<TKey>(this IEnumerable<TKey> l) { var dic = new Map<TKey, int>(); foreach (var item in l) { dic[item]++; } 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 static int LowerBound<T>(this List<T> @this, T x) where T : IComparable { int lb = -1, ub = @this.Count; while (ub - lb > 1) { int mid = (ub + lb) >> 1; if (@this[mid].CompareTo(x) >= 0) ub = mid; else lb = mid; } return ub; } public static int UpperBound<T>(this List<T> @this, T x) where T : IComparable { int lb = -1, ub = @this.Count; while (ub - lb > 1) { int mid = (ub + lb) >> 1; if (@this[mid].CompareTo(x) > 0) ub = mid; else lb = mid; } return ub; } } 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 T EMin<T>(params T[] a) where T : IComparable<T> => a.Min(); public static T EMax<T>(params T[] a) where T : IComparable<T> => a.Max(); } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection.Emit; using System.Text; using static System.Console; using static System.Math; //using CS_Contest.Graph; using CS_Contest.Loop; using CS_Contest.Utils; using static Nakov.IO.Cin; using static CS_Contest.IO.IO; using static CS_Contest.Utils.MyMath; 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() { // ABC099 var N = NextInt(); var ans = int.MaxValue; var nl = new Li {6561*9,6561, 729, 81, 9}; var sl = new Li {46656,7776, 1296, 216, 36, 6}; for (int i = 0; i <= N/9; i++) { var six = (N - 9 * i) / 6; var one = (N - 9 * i - 6 * six); var next = 0; var nine = i; foreach (var nn in nl) { var cnt = nine / nn; nine -= cnt * nn; next += cnt; } next += nine; foreach (var ss in sl) { var cnt = six / ss; six -= cnt * ss; next += cnt; } next += six; ans = Min(ans, next + one); } Min(ans,N).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 { [DebuggerStepThrough] 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 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); } } } public class Generate { public static IEnumerable<int> Seq(int e) => Seq(0, e, 1); public static IEnumerable<int> Seq(int s, int e) => Seq(s, e, 1); public static IEnumerable<int> Seq(int s, int e, int a) { while (s != e) { yield return s; s += a; } } public static List<T> Repeat<T>(Func<int, T> result, int range) => Enumerable.Range(0, range).Select(result).ToList(); } } 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 Li NextIntList(int n) => Enumerable.Repeat(0, n).Select(x => ReadLine()).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); public static T[,] GetBox<T>(int h, int w, Func<int, int, T> getFunc) { var rt = new T[h, w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { rt[i, j] = getFunc(i, j); } } return rt; } } } namespace CS_Contest.Utils { using Li = List<int>; using Ll = List<long>; [DebuggerStepThrough] public static class Utils { public static bool AnyOf<T>(this T @this, params T[] these) where T:IComparable { return these.Contains(@this); } 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 List<Tuple<TKey, TValue>> ToTupleList<TKey, TValue>(this Map<TKey, TValue> @this) => @this.Select(x => Tuple.Create(x.Key, x.Value)).ToList(); public static Map<TKey, int> CountUp<TKey>(this IEnumerable<TKey> l) { var dic = new Map<TKey, int>(); foreach (var item in l) { dic[item]++; } 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 static int LowerBound<T>(this List<T> @this, T x) where T : IComparable { int lb = -1, ub = @this.Count; while (ub - lb > 1) { int mid = (ub + lb) >> 1; if (@this[mid].CompareTo(x) >= 0) ub = mid; else lb = mid; } return ub; } public static int UpperBound<T>(this List<T> @this, T x) where T : IComparable { int lb = -1, ub = @this.Count; while (ub - lb > 1) { int mid = (ub + lb) >> 1; if (@this[mid].CompareTo(x) > 0) ub = mid; else lb = mid; } return ub; } } 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 T EMin<T>(params T[] a) where T : IComparable<T> => a.Min(); public static T EMax<T>(params T[] a) where T : IComparable<T> => a.Max(); } }
[["+", 0, 212, 0, 230, 10, 229, 0, 16, 17, 48], ["+", 0, 212, 0, 230, 10, 229, 0, 16, 12, 203], ["+", 0, 200, 0, 212, 0, 230, 10, 229, 0, 21], ["+", 0, 200, 0, 212, 0, 230, 10, 229, 0, 203], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
8
2,185
8
using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.IO; using System.Linq; using System.Diagnostics; using System.Globalization; using static System.Console; using static System.Math; namespace abc_99.c { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); var list = new List<int>(); list.Add(1); /* 100000を超えない6の累乗の数を入れてく */ int tmp = 6; int cnt = 1; while (Pow(tmp, cnt) < 100000) { list.Add((int)Pow(tmp, cnt)); cnt++; } /* 100000を超えない9の累乗の数を入れてく */ tmp = 9; cnt = 1; while (Pow(tmp, cnt) < 100000) { list.Add((int)Pow(tmp, cnt)); cnt++; } //コイン問題dp int[] dp = new int[100000]; for (int i = 0; i < 100000; i++) dp[i] = int.MaxValue; dp[0] = 0; for (int i = 0; i < list.Count; i++) { for (int j = 0; j + list[i] <= n; j++) { dp[j + list[i]] = Min(dp[j + list[i]], dp[j] + 1); } } WriteLine(dp[n]); } /// 値のスワップ static void Swap<T>(ref T lhs, ref T rhs) { T temp; temp = lhs; lhs = rhs; rhs = temp; } } }
using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.IO; using System.Linq; using System.Diagnostics; using System.Globalization; using static System.Console; using static System.Math; namespace abc_99.c { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); const int nmax = 100001; var list = new List<int>(); list.Add(1); /* 100000を超えない6の累乗の数を入れてく */ int tmp = 6; int cnt = 1; while (Pow(tmp, cnt) <= 100000) { list.Add((int)Pow(tmp, cnt)); cnt++; } /* 100000を超えない9の累乗の数を入れてく */ tmp = 9; cnt = 1; while (Pow(tmp, cnt) <= 100000) { list.Add((int)Pow(tmp, cnt)); cnt++; } //コイン問題dp int[] dp = new int[nmax]; for (int i = 0; i < nmax; i++) dp[i] = int.MaxValue; dp[0] = 0; for (int i = 0; i < list.Count; i++) { for (int j = 0; j + list[i] <= n; j++) { dp[j + list[i]] = Min(dp[j + list[i]], dp[j] + 1); } } WriteLine(dp[n]); } /// 値のスワップ static void Swap<T>(ref T lhs, ref T rhs) { T temp; temp = lhs; lhs = rhs; rhs = temp; } } }
[["+", 0, 195, 8, 196, 0, 197, 0, 251, 0, 154], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["-", 0, 195, 8, 196, 0, 52, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 52, 15, 16, 17, 19], ["-", 0, 212, 0, 227, 39, 224, 225, 226, 0, 203], ["+", 0, 212, 0, 227, 39, 224, 225, 226, 0, 22], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22]]
8
339
14
using System; using System.Collections.Generic; using System.Linq; using static System.Console; using static System.Convert; using static System.Math; class Program { private static int res = int.MaxValue; static void Main(string[] args) { var nc = Array.ConvertAll(ReadLine().Split(' '), int.Parse); var ds = new int[nc[1]][]; for (var i = 0; i < nc[1]; i++) ds[i] = Array.ConvertAll(ReadLine().Split(' '), int.Parse); /*for (var k = 0; k < nc[1]; k++) for (var i = 0; i < nc[1]; i++) for (var j = 0; j < nc[1]; j++) ds[i][j] = Min(ds[i][j], ds[i][k] + ds[k][j]);*/ var dic = new Dictionary<int, Dictionary<int, int>>(); for (var i = 1; i <= nc[0]; i++) { var ar = Array.ConvertAll(ReadLine().Split(' '), int.Parse); for (var j = 0; j < nc[0]; j++) { var mod = (i + j + 1) % 3; if (!dic.ContainsKey(mod)) dic[mod] = new Dictionary<int, int>(); if (dic[mod].ContainsKey(ar[j] - 1)) dic[mod][ar[j] - 1]++; else dic[mod][ar[j] - 1] = 1; } } for (var i = 0; i < nc[1]; i++) dfs(Enumerable.Repeat(-1, 3).ToArray(), 0, i, ds, dic, nc[1]); WriteLine(res); } private static void dfs(int[] sel, int index, int num, int[][] ds, Dictionary<int, Dictionary<int, int>> dic, int c) { sel[index] = num; if (index == 2) { var sum = 0; for (var i = 0; i < 3; i++) { for (var j = 0; j < c; j++) if (dic[i].ContainsKey(j)) sum += ds[j][sel[i]] * dic[i][j]; } res = Min(res, sum); sel[index] = -1; return; } for (var i = 0; i < c; i++) if (!sel.Contains(i)) dfs(sel, index + 1, i, ds, dic, c); sel[index] = -1; } private const string ALFA = "abcdefghijklmnopqrstuvwxyz"; private const int MOD = 1000000007; }
using System; using System.Collections.Generic; using System.Linq; using static System.Console; using static System.Convert; using static System.Math; class Program { private static int res = int.MaxValue; static void Main(string[] args) { var nc = Array.ConvertAll(ReadLine().Split(' '), int.Parse); var ds = new int[nc[1]][]; for (var i = 0; i < nc[1]; i++) ds[i] = Array.ConvertAll(ReadLine().Split(' '), int.Parse); var dic = new Dictionary<int, Dictionary<int, int>>(); for (var i = 1; i <= nc[0]; i++) { var ar = Array.ConvertAll(ReadLine().Split(' '), int.Parse); for (var j = 0; j < nc[0]; j++) { var mod = (i + j + 1) % 3; if (!dic.ContainsKey(mod)) dic[mod] = new Dictionary<int, int>(); if (dic[mod].ContainsKey(ar[j] - 1)) dic[mod][ar[j] - 1]++; else dic[mod][ar[j] - 1] = 1; } } for (var i = 0; i < nc[1]; i++) dfs(Enumerable.Repeat(-1, 3).ToArray(), 0, i, ds, dic, nc[1]); WriteLine(res); } private static void dfs(int[] sel, int index, int num, int[][] ds, Dictionary<int, Dictionary<int, int>> dic, int c) { sel[index] = num; if (index == 2) { var sum = 0; for (var i = 0; i < 3; i++) { for (var j = 0; j < c; j++) if (dic.ContainsKey(i) && dic[i].ContainsKey(j)) sum += ds[j][sel[i]] * dic[i][j]; } res = Min(res, sum); sel[index] = -1; return; } for (var i = 0; i < c; i++) if (!sel.Contains(i)) dfs(sel, index + 1, i, ds, dic, c); sel[index] = -1; } private const string ALFA = "abcdefghijklmnopqrstuvwxyz"; private const int MOD = 1000000007; }
[["+", 8, 57, 15, 16, 31, 213, 63, 214, 0, 131], ["+", 8, 57, 15, 16, 31, 213, 63, 214, 141, 22], ["+", 8, 57, 15, 16, 31, 213, 3, 4, 0, 24], ["+", 15, 16, 31, 213, 3, 4, 0, 28, 0, 22], ["+", 8, 57, 15, 16, 31, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 7, 8, 57, 15, 16, 17, 98], ["+", 15, 16, 12, 213, 63, 214, 205, 204, 205, 22]]
8
561
7
using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray(); this.CakeCount = inpt[0]; this.MaxEat = inpt[1]; this.Cakes = new long [this.CakeCount][]; this.dic = new long [this.CakeCount][][][]; for (int i = 0; i < this.CakeCount; i++) { this.Cakes[i] = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray(); } long ans = 0; for (int i = 0; i <= 7; i++) { long[] tmp = GetAns(0, this.MaxEat, i); ans = Math.Max(ans, tmp.Select(a => Math.Abs(a)).Sum()); } Console.WriteLine(ans); } private int CakeCount; private int MaxEat; private long[][] Cakes; private long[] GetAns(int idx, int remain, int type) { if (idx >= this.CakeCount && remain > 0) { return new long[0]; } if (remain <= 0) { return new long[3]; } if (dic[idx] == null) { dic[idx] = new long [this.MaxEat + 1][][]; } if (dic[idx][remain] == null) { dic[idx][remain] = new long [8][]; } if (dic[idx][remain][type] != null) { return dic[idx][remain][type]; } long[] tmp1 = GetAns(idx + 1, remain - 1, type); if (tmp1.Length == 0) { dic[idx][remain][type] = tmp1; return tmp1; } tmp1 = (long[])tmp1.Clone(); for (int i = 0; i < 3; i++) { tmp1[i] += this.Cakes[idx][i]; } long[] tmp2 = GetAns(idx + 1, remain, type); if (tmp2.Length > 0) { long total1 = 0; long total2 = 0; for (int i = 0; i < tmp1.Length; i++) { if ((type & TypeArr[i]) == 0) { total1 += tmp1[i]; total2 += tmp2[i]; } else { total1 -= tmp1[i]; total2 -= tmp2[i]; } } if (Math.Abs(total1) >= Math.Abs(total2)) { dic[idx][remain][type] = tmp1; return tmp1; } else { dic[idx][remain][type] = tmp2; return tmp2; } } else { dic[idx][remain][type] = tmp1; return tmp1; } } private int[] TypeArr = new int[] { 1, 2, 4 }; private long[][][][] dic; public class Reader { static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 3 0 2000000000 -9000000000 4000000000 7000000000 -5000000000 3000000000 6000000000 -1000000000 8000000000 "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }
using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray(); this.CakeCount = inpt[0]; this.MaxEat = inpt[1]; this.Cakes = new long [this.CakeCount][]; this.dic = new long [this.CakeCount][][][]; for (int i = 0; i < this.CakeCount; i++) { this.Cakes[i] = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray(); } long ans = 0; for (int i = 0; i <= 7; i++) { long[] tmp = GetAns(0, this.MaxEat, i); ans = Math.Max(ans, tmp.Select(a => Math.Abs(a)).Sum()); } Console.WriteLine(ans); } private int CakeCount; private int MaxEat; private long[][] Cakes; private long[] GetAns(int idx, int remain, int type) { if (idx >= this.CakeCount && remain > 0) { return new long[0]; } if (remain <= 0) { return new long[3]; } if (dic[idx] == null) { dic[idx] = new long [this.MaxEat + 1][][]; } if (dic[idx][remain] == null) { dic[idx][remain] = new long [8][]; } if (dic[idx][remain][type] != null) { return dic[idx][remain][type]; } long[] tmp1 = GetAns(idx + 1, remain - 1, type); if (tmp1.Length == 0) { dic[idx][remain][type] = tmp1; return tmp1; } tmp1 = (long[])tmp1.Clone(); for (int i = 0; i < 3; i++) { tmp1[i] += this.Cakes[idx][i]; } long[] tmp2 = GetAns(idx + 1, remain, type); if (tmp2.Length > 0) { long total1 = 0; long total2 = 0; for (int i = 0; i < tmp1.Length; i++) { if ((type & TypeArr[i]) == 0) { total1 += tmp1[i]; total2 += tmp2[i]; } else { total1 -= tmp1[i]; total2 -= tmp2[i]; } } if (total1 >= total2) { dic[idx][remain][type] = tmp1; return tmp1; } else { dic[idx][remain][type] = tmp2; return tmp2; } } else { dic[idx][remain][type] = tmp1; return tmp1; } } private int[] TypeArr = new int[] { 1, 2, 4 }; private long[][][][] dic; public class Reader { static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 3 0 2000000000 -9000000000 4000000000 7000000000 -5000000000 3000000000 6000000000 -1000000000 8000000000 "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }
[["-", 0, 57, 15, 16, 31, 213, 63, 214, 205, 22], ["-", 0, 57, 15, 16, 31, 213, 63, 214, 0, 131], ["-", 0, 57, 15, 16, 31, 213, 63, 214, 141, 22], ["-", 0, 57, 15, 16, 31, 213, 3, 4, 0, 24], ["-", 0, 57, 15, 16, 31, 213, 3, 4, 0, 25], ["-", 0, 57, 15, 16, 12, 213, 63, 214, 205, 22], ["-", 0, 57, 15, 16, 12, 213, 63, 214, 0, 131], ["-", 0, 57, 15, 16, 12, 213, 63, 214, 141, 22], ["-", 0, 57, 15, 16, 12, 213, 3, 4, 0, 24], ["-", 0, 57, 15, 16, 12, 213, 3, 4, 0, 25]]
8
805
10
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Collections; class Program { static void Main() { int[] nc = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); int N = nc[0]; int C = nc[1]; int[,] D = new int[C, C]; { for (int i = 0; i < C; i++) { int[] data = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); for (int j = 0; j < C; j++) { D[i, j] = data[j]; } } } int[,] c = new int[N, N]; { for (int i = 0; i < N; i++) { int[] data = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); for (int j = 0; j < N; j++) { c[i, j] = data[j] - 1; } } } //(i+j)%3がkであるマスを色cに変えたときの違和感の増分をX[k,c]とする。 int[,] X = new int[3, C]; for (int k = 0; k < 3; k++) { for (int cc = 0; cc < C; cc++) { int x = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if ((i + j) % 3 == k) { x += D[c[i, j], cc]; } } } X[k, cc] = x; } } int ans = int.MaxValue; //色の組み合わせ30*29*28の全部を試す for (int i = 0; i < C; i++) { for (int j = i + 1; j < C; j++) { for (int k = j + 1; k < C; k++) { if (k == j) continue; ans = Math.Min(ans, X[0, i] + X[1, j] + X[2, k]); } } } Console.WriteLine(ans); } static bool isOkini(long N, long num) { if (num == 0) return false; long a = N % num; long b = N / num; if (a == b) return true; else return false; } } static class MathUtil { public static IEnumerable<IEnumerable<int>> GetPermutation(int n) { if (n == 0) { yield return Single(0); yield break; } for (int i = 0; i <= n; i++) { foreach (var x in GetPermutation(n - 1)) { yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1)); } } } private static IEnumerable<int> Single(int x) { yield return x; } public static IEnumerable<int> EnumeratePrimeNumbers() { List<int> primes = new List<int>() { 2 }; yield return 2; for (int i = 3; i < int.MaxValue; i++) { bool isPrime = true; int Sqrt = (int)Math.Sqrt(i) + 1; foreach (var prime in primes) { if (prime > Sqrt) { break; } if (i % prime == 0) { isPrime = false; break; } } if (isPrime) { primes.Add(i); yield return i; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Collections; class Program { static void Main() { int[] nc = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); int N = nc[0]; int C = nc[1]; int[,] D = new int[C, C]; { for (int i = 0; i < C; i++) { int[] data = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); for (int j = 0; j < C; j++) { D[i, j] = data[j]; } } } int[,] c = new int[N, N]; { for (int i = 0; i < N; i++) { int[] data = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); for (int j = 0; j < N; j++) { c[i, j] = data[j] - 1; } } } //(i+j)%3がkであるマスを色cに変えたときの違和感の増分をX[k,c]とする。 int[,] X = new int[3, C]; for (int k = 0; k < 3; k++) { for (int cc = 0; cc < C; cc++) { int x = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if ((i + j) % 3 == k) { x += D[c[i, j], cc]; } } } X[k, cc] = x; } } int ans = int.MaxValue; //色の組み合わせ30*29*28の全部を試す for (int i = 0; i < C; i++) { for (int j = 0; j < C; j++) { if (j == i) continue; for (int k = 0; k < C; k++) { if (k == j) continue; if (k == i) continue; ans = Math.Min(ans, X[0, i] + X[1, j] + X[2, k]); } } } Console.WriteLine(ans); } static bool isOkini(long N, long num) { if (num == 0) return false; long a = N % num; long b = N / num; if (a == b) return true; else return false; } } static class MathUtil { public static IEnumerable<IEnumerable<int>> GetPermutation(int n) { if (n == 0) { yield return Single(0); yield break; } for (int i = 0; i <= n; i++) { foreach (var x in GetPermutation(n - 1)) { yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1)); } } } private static IEnumerable<int> Single(int x) { yield return x; } public static IEnumerable<int> EnumeratePrimeNumbers() { List<int> primes = new List<int>() { 2 }; yield return 2; for (int i = 3; i < int.MaxValue; i++) { bool isPrime = true; int Sqrt = (int)Math.Sqrt(i) + 1; foreach (var prime in primes) { if (prime > Sqrt) { break; } if (i % prime == 0) { isPrime = false; break; } } if (isPrime) { primes.Add(i); yield return i; } } } }
[["-", 10, 198, 0, 200, 0, 212, 0, 16, 31, 22], ["-", 10, 198, 0, 200, 0, 212, 0, 16, 17, 72], ["-", 10, 198, 0, 200, 0, 212, 0, 16, 12, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 24], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 12, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 25], ["+", 0, 7, 8, 196, 0, 57, 64, 116, 0, 117], ["+", 0, 7, 8, 196, 0, 57, 64, 116, 0, 35]]
8
799
24
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Numerics; namespace AtCoder { class Program { static void Main(string[] args) { var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); var N = vals[0]; var M = vals[1]; var data = new long [N][]; foreach (var i in Enumerable.Range(0, N)) { data[i] = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); } if (M == 0) { Console.WriteLine(0); return; } long maxpoints = 0; int[] currentIndices = null; foreach (var s in Enumerable.Range(0, 8)) { int[] coef; switch (s) { case 0: coef = new int[] { 1, 1, 1 }; break; case 1: coef = new int[] { 1, 1, -1 }; break; case 2: coef = new int[] { 1, -1, 1 }; break; case 3: coef = new int[] { 1, -1, -1 }; break; case 4: coef = new int[] { -1, 1, 1 }; break; case 5: coef = new int[] { -1, 1, -1 }; break; case 6: coef = new int[] { -1, -1, 1 }; break; case 7: coef = new int[] { -1, -1, -1 }; break; default: coef = new int[] { 0, 0, 0 }; break; } var filter = Enumerable.Range(0, N) .Select(x => new { Index = x, Sum = data[x][0] * coef[0] + data[x][1] * coef[1] + data[x][2] * coef[2] }) .OrderByDescending(x => x.Sum) .Take(M); var currentPoint = filter.Select(x => x.Sum).Sum(); if (maxpoints < currentPoint) { currentIndices = filter.Select(x => x.Index).ToArray(); maxpoints = currentPoint; } } //再計算 long x1 = 0; long x2 = 0; long x3 = 0; foreach (var i in currentIndices) { x1 += data[i][0]; x2 += data[i][1]; x3 += data[i][2]; } var result = Math.Abs(x1) + Math.Abs(x2) + Math.Abs(x3); Console.WriteLine(result); } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Numerics; namespace AtCoder { class Program { static void Main(string[] args) { var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); var N = vals[0]; var M = vals[1]; var data = new long [N][]; foreach (var i in Enumerable.Range(0, N)) { data[i] = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); } if (M == 0) { Console.WriteLine(0); return; } long maxpoints = 0; int[] currentIndices = null; foreach (var s in Enumerable.Range(0, 8)) { int[] coef; switch (s) { case 0: coef = new int[] { 1, 1, 1 }; break; case 1: coef = new int[] { 1, 1, -1 }; break; case 2: coef = new int[] { 1, -1, 1 }; break; case 3: coef = new int[] { 1, -1, -1 }; break; case 4: coef = new int[] { -1, 1, 1 }; break; case 5: coef = new int[] { -1, 1, -1 }; break; case 6: coef = new int[] { -1, -1, 1 }; break; case 7: coef = new int[] { -1, -1, -1 }; break; default: coef = new int[] { 0, 0, 0 }; break; } var filter = Enumerable.Range(0, N) .Select(x => new { Index = x, Sum = data[x][0] * coef[0] + data[x][1] * coef[1] + data[x][2] * coef[2] }) .OrderByDescending(x => x.Sum) .Take(M); var currentPoint = filter.Select(x => x.Sum).Sum(); if (maxpoints < currentPoint) { currentIndices = filter.Select(x => x.Index).ToArray(); maxpoints = currentPoint; } } //再計算 long x1 = 0; long x2 = 0; long x3 = 0; if (currentIndices != null) { foreach (var i in currentIndices) { x1 += data[i][0]; x2 += data[i][1]; x3 += data[i][2]; } } var result = Math.Abs(x1) + Math.Abs(x2) + Math.Abs(x3); Console.WriteLine(result); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 79], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 215], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 210, 8, 196, 0, 46]]
8
615
8
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Practice { class Program { static void Main(string[] args) { Solve(); } private const int MOD = 1000000007; static void Solve() { var n = ReadAndParseInt(); int min = int.MaxValue; for (int a = 1; a < n / 2; ++a) { int b = n - a; min = Math.Min(min, CalcSum(a) + CalcSum(b)); } Console.WriteLine(min); } private static int CalcSum(int a) { int ret = 0; while (a > 0) { ret += a % 10; a /= 10; } return ret; } #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; using System.Linq; using System.Text; namespace Practice { class Program { static void Main(string[] args) { Solve(); } private const int MOD = 1000000007; static void Solve() { var n = ReadAndParseInt(); long min = long.MaxValue; for (int a = 1; a <= n / 2; ++a) { long b = n - a; min = Math.Min(min, CalcSum(a) + CalcSum(b)); } Console.WriteLine(min); } private static long CalcSum(long a) { long ret = 0; while (a > 0) { ret += a % 10; a /= 10; } return ret; } #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, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 198, 0, 200, 0, 212, 0, 214, 205, 199], ["+", 0, 198, 0, 200, 0, 212, 0, 214, 205, 199], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19], ["-", 0, 7, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 7, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 8, 201, 0, 235, 8, 201, 0, 195, 39, 199], ["+", 8, 201, 0, 235, 8, 201, 0, 195, 39, 199], ["-", 8, 201, 0, 195, 54, 55, 0, 220, 39, 199], ["+", 8, 201, 0, 195, 54, 55, 0, 220, 39, 199]]
8
757
14
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace AtCoder.AGC025 { class Program { static void Main() { var sc = new Scanner(); var ns = sc.Next(); if (int.Parse(ns.Substring(1)) != 0) { var result = 0; foreach (var item in ns) { result += int.Parse(item.ToString()); } Console.WriteLine(result); return; } else { var n0 = int.Parse(ns[0].ToString()); if (n0 == 1) { Console.WriteLine(10); return; } else { Console.WriteLine(n0); return; } } } } class Scanner { string[] s; long 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 long NextLong() { return long.Parse(Next()); } public long[] ArrayLong(int N, long add = 0) { long[] Array = new long[N]; for (long i = 0; i < N; i++) { Array[i] = NextLong() + add; } return Array; } public double NextDouble() { return double.Parse(Next()); } public double[] ArrayDouble(long N, double add = 0) { double[] Array = new double[N]; for (long i = 0; i < N; i++) { Array[i] = NextDouble() + add; } return Array; } public decimal NextDecimal() { return decimal.Parse(Next()); } public decimal[] ArrayDecimal(long N, decimal add = 0) { decimal[] Array = new decimal[N]; for (long i = 0; i < N; i++) { Array[i] = NextDecimal(); } return Array; } } }
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace AtCoder.AGC025 { class Program { static void Main() { var sc = new Scanner(); var ns = sc.Next(); if (string.IsNullOrEmpty(ns.Substring(1))) { Console.WriteLine(ns); } else if (int.Parse(ns.Substring(1)) != 0) { var result = 0; foreach (var item in ns) { result += int.Parse(item.ToString()); } Console.WriteLine(result); } else { var n0 = int.Parse(ns[0].ToString()); if (n0 == 1) { Console.WriteLine(10); } else { Console.WriteLine(n0); } } } } class Scanner { string[] s; long 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 long NextLong() { return long.Parse(Next()); } public long[] ArrayLong(int N, long add = 0) { long[] Array = new long[N]; for (long i = 0; i < N; i++) { Array[i] = NextLong() + add; } return Array; } public double NextDouble() { return double.Parse(Next()); } public double[] ArrayDouble(long N, double add = 0) { double[] Array = new double[N]; for (long i = 0; i < N; i++) { Array[i] = NextDouble() + add; } return Array; } public decimal NextDecimal() { return decimal.Parse(Next()); } public decimal[] ArrayDecimal(long N, decimal add = 0) { decimal[] Array = new decimal[N]; for (long i = 0; i < N; i++) { Array[i] = NextDecimal(); } return Array; } } }
[["+", 8, 196, 0, 57, 15, 213, 63, 214, 205, 199], ["+", 8, 196, 0, 57, 15, 213, 63, 214, 0, 131], ["+", 8, 196, 0, 57, 15, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 57, 15, 213, 3, 4, 0, 24], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 205, 22], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 0, 131], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["+", 3, 4, 0, 28, 0, 213, 3, 4, 0, 24], ["+", 0, 28, 0, 213, 3, 4, 0, 28, 0, 203], ["+", 3, 4, 0, 28, 0, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 15, 213, 3, 4, 0, 25], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 64, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 64, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["+", 0, 195, 8, 196, 0, 57, 75, 57, 0, 121], ["+", 0, 195, 8, 196, 0, 57, 75, 57, 0, 24], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 35], ["-", 75, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["-", 75, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["-", 75, 196, 0, 57, 75, 196, 0, 1, 0, 35], ["-", 75, 196, 0, 57, 75, 196, 0, 37, 0, 38]]
8
596
30
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Runtime.Remoting.Contexts; namespace Contest { class Scanner { private string[] line = new string[0]; private int index = 0; public string Next() { if (line.Length <= index) { line = Console.ReadLine().Split(' '); index = 0; } var res = line[index]; index++; return res; } public int NextInt() { return int.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } public string[] Array() { line = Console.ReadLine().Split(' '); index = line.Length; return line; } public int[] IntArray() { var array = Array(); var result = new int[array.Length]; for (int i = 0; i < array.Length; i++) { result[i] = int.Parse(array[i]); } return result; } public long[] LongArray() { var array = Array(); var result = new long[array.Length]; for (int i = 0; i < array.Length; i++) { result[i] = long.Parse(array[i]); } return result; } public uint NextUint() { return uint.Parse(Next()); } } struct Cake { public long X, Y, Z; public Cake(long x, long y, long z) { X = x; Y = y; Z = z; } } class Program { private int N, M; private Cake[] Cakes; private void Scan() { var sc = new Scanner(); N = sc.NextInt(); M = sc.NextInt(); Cakes = new Cake[N]; for (int i = 0; i < N; i++) { Cakes[i] = new Cake(sc.NextLong(), sc.NextLong(), sc.NextLong()); } } public void Solve() { Scan(); long ans = Score(1, 1, 1); ans = Math.Max(ans, Score(1, 1, -1)); ans = Math.Max(ans, Score(1, -1, 1)); ans = Math.Max(ans, Score(1, -1, -1)); ans = Math.Max(ans, Score(-1, 1, 1)); ans = Math.Max(ans, Score(-1, 1, -1)); ans = Math.Max(ans, Score(-1, -1, 1)); ans = Math.Max(ans, Score(-1, -1, -1)); Console.WriteLine(ans); } private long Score(int a, int b, int c) { var dp = new long[M + 1, N + 1]; var bb = new bool[M + 1, N + 1]; for (int i = 0; i <= M; i++) { for (int j = 0; j <= N; j++) { dp[i, j] = long.MinValue; } } dp[0, 0] = 0; bb[0, 0] = true; for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { if (!bb[j, i]) continue; dp[j, i + 1] = Math.Max(dp[j, i + 1], dp[j, i]); bb[j, i + 1] = true; dp[j + 1, i + 1] = Math.Max(dp[j + 1, i + 1], dp[j, i] + Cakes[i].X * a + Cakes[i].Y * b + Cakes[i].Z * c); bb[j + 1, i + 1] = true; } } return (dp[M, N]); } static void Main() => new Program().Solve(); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Runtime.Remoting.Contexts; namespace Contest { class Scanner { private string[] line = new string[0]; private int index = 0; public string Next() { if (line.Length <= index) { line = Console.ReadLine().Split(' '); index = 0; } var res = line[index]; index++; return res; } public int NextInt() { return int.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } public string[] Array() { line = Console.ReadLine().Split(' '); index = line.Length; return line; } public int[] IntArray() { var array = Array(); var result = new int[array.Length]; for (int i = 0; i < array.Length; i++) { result[i] = int.Parse(array[i]); } return result; } public long[] LongArray() { var array = Array(); var result = new long[array.Length]; for (int i = 0; i < array.Length; i++) { result[i] = long.Parse(array[i]); } return result; } public uint NextUint() { return uint.Parse(Next()); } } struct Cake { public long X, Y, Z; public Cake(long x, long y, long z) { X = x; Y = y; Z = z; } } class Program { private int N, M; private Cake[] Cakes; private void Scan() { var sc = new Scanner(); N = sc.NextInt(); M = sc.NextInt(); Cakes = new Cake[N]; for (int i = 0; i < N; i++) { Cakes[i] = new Cake(sc.NextLong(), sc.NextLong(), sc.NextLong()); } } public void Solve() { Scan(); long ans = Score(1, 1, 1); ans = Math.Max(ans, Score(1, 1, -1)); ans = Math.Max(ans, Score(1, -1, 1)); ans = Math.Max(ans, Score(1, -1, -1)); ans = Math.Max(ans, Score(-1, 1, 1)); ans = Math.Max(ans, Score(-1, 1, -1)); ans = Math.Max(ans, Score(-1, -1, 1)); ans = Math.Max(ans, Score(-1, -1, -1)); Console.WriteLine(ans); } private long Score(int a, int b, int c) { var dp = new long[M + 1, N + 1]; var bb = new bool[M + 1, N + 1]; for (int i = 0; i <= M; i++) { for (int j = 0; j <= N; j++) { dp[i, j] = long.MinValue; } } dp[0, 0] = 0; bb[0, 0] = true; for (int i = 0; i < N; i++) { for (int j = 0; j <= M; j++) { if (!bb[j, i]) continue; dp[j, i + 1] = Math.Max(dp[j, i + 1], dp[j, i]); bb[j, i + 1] = true; if (j < M) { dp[j + 1, i + 1] = Math.Max(dp[j + 1, i + 1], dp[j, i] + Cakes[i].X * a + Cakes[i].Y * b + Cakes[i].Z * c); bb[j + 1, i + 1] = true; } } } return (dp[M, N]); } static void Main() => new Program().Solve(); } }
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 17, 19], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 24], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 12, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 25], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46]]
8
914
10
using System; using System.Globalization; using System.IO.Pipes; using System.Runtime.InteropServices; namespace ConsoleApp2 { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); if (n < 1000) Console.WriteLine("ABC" + n); else Console.WriteLine("ABD" + (n - 999)); } } }
using System; using System.Globalization; using System.IO.Pipes; using System.Runtime.InteropServices; namespace ConsoleApp2 { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); if (n < 1000) Console.WriteLine("ABC"); else Console.WriteLine("ABD"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22], ["-", 3, 4, 0, 28, 0, 16, 12, 23, 0, 24], ["-", 0, 28, 0, 16, 12, 23, 0, 16, 31, 22], ["-", 0, 28, 0, 16, 12, 23, 0, 16, 17, 33], ["-", 0, 28, 0, 16, 12, 23, 0, 16, 12, 203], ["-", 3, 4, 0, 28, 0, 16, 12, 23, 0, 25]]
8
88
8
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace atcoder { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int answer = digits(N, N.ToString().Length); int digit = 0; for (int i = 1; i < N; i++) { digit = 0; digit += digits(i, i.ToString().Length) + digits(N - i, (N - i).ToString().Length); if (answer >= digit) answer = digit; } Console.WriteLine(answer); } static int digits(int C, int len) { int digit_sum = 0; for (int i = 0; i < len; i++) { digit_sum += C % 10; C = C / 10; } return digit_sum; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace atcoder { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int answer = digits(1, 1.ToString().Length) + digits(N - 1, (N - 1).ToString().Length); int digit = 0; for (int i = 1; i < N; i++) { digit = digits(i, i.ToString().Length) + digits(N - i, (N - i).ToString().Length); if (answer >= digit) answer = digit; } Console.WriteLine(answer); } static int digits(int C, int len) { int digit_sum = 0; for (int i = 0; i < len; i++) { digit_sum += C % 10; C = C / 10; } return digit_sum; } } }
[["+", 0, 16, 31, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 212, 0, 16, 31, 213, 3, 4, 0, 21], ["+", 0, 28, 0, 214, 205, 213, 63, 214, 205, 203], ["+", 0, 28, 0, 214, 205, 213, 63, 214, 0, 131], ["+", 0, 28, 0, 214, 205, 213, 63, 214, 141, 22], ["+", 0, 28, 0, 214, 205, 213, 3, 4, 0, 24], ["+", 0, 28, 0, 214, 205, 213, 3, 4, 0, 25], ["+", 31, 213, 3, 4, 0, 28, 0, 214, 0, 131], ["+", 31, 213, 3, 4, 0, 28, 0, 214, 141, 22], ["+", 0, 212, 0, 16, 31, 213, 3, 4, 0, 25], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 72], ["+", 0, 200, 0, 212, 0, 16, 12, 213, 63, 22], ["+", 0, 212, 0, 16, 12, 213, 3, 4, 0, 24], ["+", 12, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["+", 12, 213, 3, 4, 0, 28, 0, 16, 12, 203], ["+", 0, 214, 205, 213, 63, 214, 205, 23, 0, 24], ["+", 205, 213, 63, 214, 205, 23, 0, 16, 17, 33], ["+", 205, 213, 63, 214, 205, 23, 0, 16, 12, 203], ["+", 0, 214, 205, 213, 63, 214, 205, 23, 0, 25], ["-", 0, 7, 8, 196, 0, 1, 0, 11, 12, 203], ["-", 8, 196, 0, 7, 8, 196, 0, 1, 0, 35], ["-", 0, 7, 8, 196, 0, 1, 0, 11, 31, 22], ["-", 8, 196, 0, 1, 0, 11, 0, 202, 0, 107]]
8
200
23
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization.Formatters.Binary; #if !DEBUG using System.IO; #endif public class Program { public static void Main() { #region SetAutoFlushIsFalse #if !DEBUG var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); #endif #endregion var n = ReadLib.ReadAsInt(); Console.WriteLine(n < 1000 ? $"ABC{n.ToString("000")}" : $"ABD{(n-999).ToString("000")}"); #region Flush #if !DEBUG Console.Out.Flush(); sw.Close(); #endif #endregion } } static class Calculation {} static class RootedTreeNodesFactory { public class RootedTreeNode { public int Id { get; } public int Parent { get; } public int Depth { get; set; } int[] Childs { get; } public RootedTreeNode(int id, int parent, int[] childs) { this.Id = id; this.Parent = parent; this.Childs = childs; } } } static class Quick { internal static void Calculate(int[] ts) { QuickSort(ts, 0, ts.Count() - 1); } private static void QuickSort(int[] ts, int p, int r) { if (p < r) { var q = Partition(ts, p, r); QuickSort(ts, p, q - 1); QuickSort(ts, q + 1, r); } } public static int Partition(int[] sArr, int p, int r) { var x = sArr[r]; var i = p - 1; for (int j = p; j < r; j++) { if (sArr[j] <= x) { i++; sArr.Swap(i, j); } } sArr.Swap(i + 1, r); return i + 1; } } static class ReadLib { public static long ReadAsLong() { return long.Parse(Console.ReadLine()); } public static int ReadAsInt() { return int.Parse(Console.ReadLine()); } public static int[] ReadAsIntArray(int step = 0) { return Console.ReadLine() .Split(' ') .Select(s => int.Parse(s) + step) .ToArray(); } public static long[] ReadAsLongArray(int step = 0) { return Console.ReadLine() .Split(' ') .Select(s => long.Parse(s) + step) .ToArray(); } public static ulong[] ReadAsULongArray() { return Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray(); } public static string[] ReadAsStringArray() { return Console.ReadLine().Split(' '); } public static int[] ReadNTimesAsInt(int n, int step = 0) { return Enumerable.Range(1, n) .Select(s => int.Parse(Console.ReadLine()) + step) .ToArray(); } public static int[][] ReadNTimesAsIntArray(int n, int step = 0) { return Enumerable.Range(1, n).Select(s => ReadAsIntArray(step)).ToArray(); } public static string[] ReadNTimesAsString(int n) { return Enumerable.Range(1, n).Select(s => Console.ReadLine()).ToArray(); } } static class WriteLib { public static void Write<T>(IEnumerable<T> ts) { ts.ToList().ForEach(s => Console.WriteLine(s)); } } static class MyMath { /// <summary>階乗</summary> public static long Factorial(int n) { if (n == 0) { return 1; } return Permutation(n, 0); } public static long Permutation(int n, int k) { return Enumerable.Range(0, n - k) .Select(i => n - i) .Aggregate(1, (b, i) => b * i); } #region FullPower /// <summary>総乗、π</summary> public static long FullPower(IEnumerable<long> vs) { return vs.Aggregate(1L, (a, b) => a * b); } public static long FullPower(IEnumerable<int> vs) { return vs.Aggregate(1L, (a, b) => a * b); } #endregion /// <summary>最大公約数</summary> public static long Gcd(long item1, long item2) { var a = Math.Max(item1, item2); var b = Math.Min(item1, item2); while (true) { long mod; Math.DivRem(a, b, out mod); if (mod == 0) { break; } a = b; b = mod; } return b; } /// <summary>約分。最大公約数で割ったものを返す。</summary> public static Tuple<long, long> DeviedByGcd(long item1, long item2) { var gcd = Gcd(item1, item2); return new Tuple<long, long>(item1 / gcd, item2 / gcd); } public static long Lcm(int item1, int item2) { return Math.BigMul(item1, item2) / Gcd(item1, item2); } public static ModCombination ModCombination(int maxN, int mod = 1000000007) { return new ModCombination(maxN, mod); } /// <summary>a^n mod</summary> public static int ModPow(int a, int n, int mod = 1000000007) { var res = 1; while (n > 0) { if ((n & 1) == 1) { res = (int)(Math.BigMul(res % mod, a) % mod); // resにaをかける } a = (int)(Math.Pow(a % mod, 2) % mod); // 次のaはa^2 n >>= 1; } return res; } } static class MyMethod { /// <summary>数え上げて、key, 出現回数に変換</summary> public static Dictionary<T, int> CountUp<T>(IEnumerable<T> str) { return str.GroupBy(c => c) .Select(g => new KeyValuePair<T, int>(g.Key, g.Count())) .ToDictionary(e => e.Key, e => e.Value); } /// <summary>計数ソート</summary> public static int[] CountingSort(int[] aArr, int k) { int[] b, c; var n = aArr.Length; b = new int[n]; c = Enumerable.Repeat(0, k + 1).ToArray(); for (int i = 0; i < n; i++) { c[aArr[i]]++; } for (int i = 1; i <= k; i++) { c[i] += c[i - 1]; } for (int i = n - 1; i >= 0; i--) { b[c[aArr[i]] - 1] = aArr[i]; c[aArr[i]]--; } return b; } } /// <summary>無向グラフ</summary> class UndirectedGraph { public Dictionary<int, List<int>> Graph { get; } /// <param name="graphArr">point1 to point2</param> /// <param name="n">グラフの全要素数</param> public UndirectedGraph(int[][] graphArr, int n) { Graph = new Dictionary<int, List<int>>(); for (int i = 1; i <= n; i++) { Graph.Add(i, new List<int>()); } foreach (var arr in graphArr) { Graph[arr[0]].Add(arr[1]); Graph[arr[1]].Add(arr[0]); } } } /// <summary>DeepCopyするクラス</summary> class DeepCopier { BinaryFormatter b = new BinaryFormatter(); public T DeepCopy<T>(T obj) { T result; using (var mem = new MemoryStream()) { b.Serialize(mem, obj); // binaryFormatterによりobjをmemにserial化して書き出す mem.Position = 0; // memのpotisionを先頭に戻す result = (T)b.Deserialize(mem); // memの内容を読み取る。 } return result; } } static class MergeSort { public static long[] Sort(long[] arr) { return Sort(arr, 0, arr.Count()); } // rightは+1されていることに注意 private static long[] Merge(long[] sArr, int left, int mid, int right) { var n1 = mid - left; var n2 = right - mid; var lArr = new long[n1 + 1]; var rArr = new long[n2 + 1]; for (int i = 0; i < n1; i++) { lArr[i] = sArr[left + i]; } lArr[n1] = int.MaxValue; for (int i = 0; i < n2; i++) { rArr[i] = sArr[mid + i]; } rArr[n2] = int.MaxValue; int l = 0, r = 0; for (int k = left; k < right; k++) { if (lArr[l] <= rArr[r]) { sArr[k] = lArr[l]; l++; } else { sArr[k] = rArr[r]; r++; } } return sArr; // 要素数はright - left } private static long[] Sort(long[] sArr, int left, int right) { if (left + 1 < right) { var mid = (left + right) / 2; sArr = Sort(sArr, left, mid); sArr = Sort(sArr, mid, right); sArr = Merge(sArr, left, mid, right); } return sArr; } } /// <summary>あまりを計算するためのintのラッパー</summary> struct ModInt { int Value { get; } int Mod { get; } public override string ToString() { return Value.ToString(); } public static explicit operator ModInt(long value) { return new ModInt(value); } public ModInt(long value, int mod = 1000000007) { this.Value = (int)(value % mod); this.Mod = mod; } public static explicit operator int(ModInt modInt) { return modInt.Value; } private static void CheckNotEqualMod(ModInt item1, ModInt item2) { if (item1.Mod != item2.Mod) { throw new Exception("mod not equal"); } } public static ModInt operator +(ModInt item1, ModInt item2) { CheckNotEqualMod(item1, item2); long value = item1.Value + item2.Value; return new ModInt(value, item1.Mod); } public static ModInt operator *(ModInt item1, ModInt item2) { CheckNotEqualMod(item1, item2); long value = Math.BigMul(item1.Value, item2.Value); return new ModInt(value, item1.Mod); } public static ModInt operator -(ModInt item1, ModInt item2) { CheckNotEqualMod(item1, item2); long value = item1.Value - item2.Value; if (value < 0) { value += item1.Mod; } return new ModInt(value, item1.Mod); } public static ModInt operator +(ModInt item1, int item2) { return item1 + new ModInt(item2, item1.Mod); } public static ModInt operator *(ModInt item1, int item2) { return item1 * new ModInt(item2, item1.Mod); } public static ModInt operator -(ModInt item1, int item2) { return item1 - new ModInt(item2, item1.Mod); } public override int GetHashCode() { return this.Value; } public override bool Equals(object obj) { if (obj == null || this.GetType() != obj.GetType()) { return false; } var modIntObj = (ModInt)obj; return modIntObj.Value == this.Value; } public static bool operator ==(ModInt item1, ModInt item2) { return item1.Value == item2.Value; } public static bool operator !=(ModInt item1, ModInt item2) { return !(item1 == item2); } public static bool operator ==(ModInt item1, int item2) { return item1.Value == item2; } public static bool operator !=(ModInt item1, int item2) { return !(item1.Value == item2); } public static bool operator >=(ModInt item1, ModInt item2) { return item1.Value >= item2.Value; } public static bool operator <=(ModInt item1, ModInt item2) { return item1.Value <= item2.Value; } public static bool operator >=(ModInt item1, int item2) { return item1.Value >= item2; } public static bool operator <=(ModInt item1, int item2) { return item1.Value <= item2; } public static bool operator>(ModInt item1, ModInt item2) { return item1.Value > item2.Value; } public static bool operator<(ModInt item1, ModInt item2) { return item1.Value < item2.Value; } public static bool operator>(ModInt item1, int item2) { return item1.Value >= item2; } public static bool operator<(ModInt item1, int item2) { return item1.Value <= item2; } } /// <summary>組み合わせ</summary> class ModCombination { private int mod; private int[] fac; private int[] finv; private int[] inv; public ModCombination(int max, int mod = 1000000007) { this.mod = mod; fac = new int[max]; // modが法のn!の列 inv = new int[max]; // indexの逆元の列 finv = new int[max]; // modを法とした、invの累積の累積 fac[0] = 1; fac[1] = 1; finv[0] = 1; finv[1] = 1; inv[1] = 1; for (int i = 2; i < max; i++) { fac[i] = (int)(Math.BigMul(fac[i - 1], i) % mod); // factorを求める var s = Math.BigMul(inv[mod % i], mod / i) % mod; inv[i] = (int)(mod - s);   // iに対する逆元を求める finv[i] = (int)(Math.BigMul(finv[i - 1], inv[i]) % mod); } } /// <summary>nCk</summary> public int Calculation(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return (int)(Math.BigMul(fac[n], (int)(Math.BigMul(finv[k], finv[n - k]) % mod)) % mod); } } /// <summary>拡張メソッドs</summary> static class Extention { /// <summary>iとjを入れ替える</summary> public static void Swap<T>(this T[] arr, int i, int j) { var buf = arr[i]; arr[i] = arr[j]; arr[j] = buf; } /// <summary> /// partition。末尾sArr[r]を基準として、左に基準より小さい数、右に基準より大きい数が存在するように配列を並び替える。 /// </summary> /// <param name="sArr"></param> /// <param name="p">partitionの先頭の添字</param> /// <param name="r">partitionの末尾の添字</param> /// <returns>partitionの基準が存在する添字</returns> public static int Partition(this int[] sArr, int p, int r) { var x = sArr[r]; var i = p - 1; for (int j = p; j < r; j++) { if (sArr[j] <= x) { i++; sArr.Swap(i, j); } } sArr.Swap(i + 1, r); return i + 1; } /// <summary>深いコピーをする</summary> public static T DeepCopy<T>(this T obj) { T result; var b = new BinaryFormatter(); using (var mem = new MemoryStream()) { b.Serialize(mem, obj); // binaryFormatterによりobjをmemにserial化して書き出す mem.Position = 0; // memのpotisionを先頭に戻す result = (T)b.Deserialize(mem); // memの内容を読み取る。 } return result; } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization.Formatters.Binary; #if !DEBUG using System.IO; #endif public class Program { public static void Main() { #region SetAutoFlushIsFalse #if !DEBUG var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); #endif #endregion var n = ReadLib.ReadAsInt(); Console.WriteLine(n < 1000 ? $"ABC" : $"ABD"); #region Flush #if !DEBUG Console.Out.Flush(); sw.Close(); #endif #endregion } } static class Calculation {} static class RootedTreeNodesFactory { public class RootedTreeNode { public int Id { get; } public int Parent { get; } public int Depth { get; set; } int[] Childs { get; } public RootedTreeNode(int id, int parent, int[] childs) { this.Id = id; this.Parent = parent; this.Childs = childs; } } } static class Quick { internal static void Calculate(int[] ts) { QuickSort(ts, 0, ts.Count() - 1); } private static void QuickSort(int[] ts, int p, int r) { if (p < r) { var q = Partition(ts, p, r); QuickSort(ts, p, q - 1); QuickSort(ts, q + 1, r); } } public static int Partition(int[] sArr, int p, int r) { var x = sArr[r]; var i = p - 1; for (int j = p; j < r; j++) { if (sArr[j] <= x) { i++; sArr.Swap(i, j); } } sArr.Swap(i + 1, r); return i + 1; } } static class ReadLib { public static long ReadAsLong() { return long.Parse(Console.ReadLine()); } public static int ReadAsInt() { return int.Parse(Console.ReadLine()); } public static int[] ReadAsIntArray(int step = 0) { return Console.ReadLine() .Split(' ') .Select(s => int.Parse(s) + step) .ToArray(); } public static long[] ReadAsLongArray(int step = 0) { return Console.ReadLine() .Split(' ') .Select(s => long.Parse(s) + step) .ToArray(); } public static ulong[] ReadAsULongArray() { return Console.ReadLine().Split(' ').Select(s => ulong.Parse(s)).ToArray(); } public static string[] ReadAsStringArray() { return Console.ReadLine().Split(' '); } public static int[] ReadNTimesAsInt(int n, int step = 0) { return Enumerable.Range(1, n) .Select(s => int.Parse(Console.ReadLine()) + step) .ToArray(); } public static int[][] ReadNTimesAsIntArray(int n, int step = 0) { return Enumerable.Range(1, n).Select(s => ReadAsIntArray(step)).ToArray(); } public static string[] ReadNTimesAsString(int n) { return Enumerable.Range(1, n).Select(s => Console.ReadLine()).ToArray(); } } static class WriteLib { public static void Write<T>(IEnumerable<T> ts) { ts.ToList().ForEach(s => Console.WriteLine(s)); } } static class MyMath { /// <summary>階乗</summary> public static long Factorial(int n) { if (n == 0) { return 1; } return Permutation(n, 0); } public static long Permutation(int n, int k) { return Enumerable.Range(0, n - k) .Select(i => n - i) .Aggregate(1, (b, i) => b * i); } #region FullPower /// <summary>総乗、π</summary> public static long FullPower(IEnumerable<long> vs) { return vs.Aggregate(1L, (a, b) => a * b); } public static long FullPower(IEnumerable<int> vs) { return vs.Aggregate(1L, (a, b) => a * b); } #endregion /// <summary>最大公約数</summary> public static long Gcd(long item1, long item2) { var a = Math.Max(item1, item2); var b = Math.Min(item1, item2); while (true) { long mod; Math.DivRem(a, b, out mod); if (mod == 0) { break; } a = b; b = mod; } return b; } /// <summary>約分。最大公約数で割ったものを返す。</summary> public static Tuple<long, long> DeviedByGcd(long item1, long item2) { var gcd = Gcd(item1, item2); return new Tuple<long, long>(item1 / gcd, item2 / gcd); } public static long Lcm(int item1, int item2) { return Math.BigMul(item1, item2) / Gcd(item1, item2); } public static ModCombination ModCombination(int maxN, int mod = 1000000007) { return new ModCombination(maxN, mod); } /// <summary>a^n mod</summary> public static int ModPow(int a, int n, int mod = 1000000007) { var res = 1; while (n > 0) { if ((n & 1) == 1) { res = (int)(Math.BigMul(res % mod, a) % mod); // resにaをかける } a = (int)(Math.Pow(a % mod, 2) % mod); // 次のaはa^2 n >>= 1; } return res; } } static class MyMethod { /// <summary>数え上げて、key, 出現回数に変換</summary> public static Dictionary<T, int> CountUp<T>(IEnumerable<T> str) { return str.GroupBy(c => c) .Select(g => new KeyValuePair<T, int>(g.Key, g.Count())) .ToDictionary(e => e.Key, e => e.Value); } /// <summary>計数ソート</summary> public static int[] CountingSort(int[] aArr, int k) { int[] b, c; var n = aArr.Length; b = new int[n]; c = Enumerable.Repeat(0, k + 1).ToArray(); for (int i = 0; i < n; i++) { c[aArr[i]]++; } for (int i = 1; i <= k; i++) { c[i] += c[i - 1]; } for (int i = n - 1; i >= 0; i--) { b[c[aArr[i]] - 1] = aArr[i]; c[aArr[i]]--; } return b; } } /// <summary>無向グラフ</summary> class UndirectedGraph { public Dictionary<int, List<int>> Graph { get; } /// <param name="graphArr">point1 to point2</param> /// <param name="n">グラフの全要素数</param> public UndirectedGraph(int[][] graphArr, int n) { Graph = new Dictionary<int, List<int>>(); for (int i = 1; i <= n; i++) { Graph.Add(i, new List<int>()); } foreach (var arr in graphArr) { Graph[arr[0]].Add(arr[1]); Graph[arr[1]].Add(arr[0]); } } } /// <summary>DeepCopyするクラス</summary> class DeepCopier { BinaryFormatter b = new BinaryFormatter(); public T DeepCopy<T>(T obj) { T result; using (var mem = new MemoryStream()) { b.Serialize(mem, obj); // binaryFormatterによりobjをmemにserial化して書き出す mem.Position = 0; // memのpotisionを先頭に戻す result = (T)b.Deserialize(mem); // memの内容を読み取る。 } return result; } } static class MergeSort { public static long[] Sort(long[] arr) { return Sort(arr, 0, arr.Count()); } // rightは+1されていることに注意 private static long[] Merge(long[] sArr, int left, int mid, int right) { var n1 = mid - left; var n2 = right - mid; var lArr = new long[n1 + 1]; var rArr = new long[n2 + 1]; for (int i = 0; i < n1; i++) { lArr[i] = sArr[left + i]; } lArr[n1] = int.MaxValue; for (int i = 0; i < n2; i++) { rArr[i] = sArr[mid + i]; } rArr[n2] = int.MaxValue; int l = 0, r = 0; for (int k = left; k < right; k++) { if (lArr[l] <= rArr[r]) { sArr[k] = lArr[l]; l++; } else { sArr[k] = rArr[r]; r++; } } return sArr; // 要素数はright - left } private static long[] Sort(long[] sArr, int left, int right) { if (left + 1 < right) { var mid = (left + right) / 2; sArr = Sort(sArr, left, mid); sArr = Sort(sArr, mid, right); sArr = Merge(sArr, left, mid, right); } return sArr; } } /// <summary>あまりを計算するためのintのラッパー</summary> struct ModInt { int Value { get; } int Mod { get; } public override string ToString() { return Value.ToString(); } public static explicit operator ModInt(long value) { return new ModInt(value); } public ModInt(long value, int mod = 1000000007) { this.Value = (int)(value % mod); this.Mod = mod; } public static explicit operator int(ModInt modInt) { return modInt.Value; } private static void CheckNotEqualMod(ModInt item1, ModInt item2) { if (item1.Mod != item2.Mod) { throw new Exception("mod not equal"); } } public static ModInt operator +(ModInt item1, ModInt item2) { CheckNotEqualMod(item1, item2); long value = item1.Value + item2.Value; return new ModInt(value, item1.Mod); } public static ModInt operator *(ModInt item1, ModInt item2) { CheckNotEqualMod(item1, item2); long value = Math.BigMul(item1.Value, item2.Value); return new ModInt(value, item1.Mod); } public static ModInt operator -(ModInt item1, ModInt item2) { CheckNotEqualMod(item1, item2); long value = item1.Value - item2.Value; if (value < 0) { value += item1.Mod; } return new ModInt(value, item1.Mod); } public static ModInt operator +(ModInt item1, int item2) { return item1 + new ModInt(item2, item1.Mod); } public static ModInt operator *(ModInt item1, int item2) { return item1 * new ModInt(item2, item1.Mod); } public static ModInt operator -(ModInt item1, int item2) { return item1 - new ModInt(item2, item1.Mod); } public override int GetHashCode() { return this.Value; } public override bool Equals(object obj) { if (obj == null || this.GetType() != obj.GetType()) { return false; } var modIntObj = (ModInt)obj; return modIntObj.Value == this.Value; } public static bool operator ==(ModInt item1, ModInt item2) { return item1.Value == item2.Value; } public static bool operator !=(ModInt item1, ModInt item2) { return !(item1 == item2); } public static bool operator ==(ModInt item1, int item2) { return item1.Value == item2; } public static bool operator !=(ModInt item1, int item2) { return !(item1.Value == item2); } public static bool operator >=(ModInt item1, ModInt item2) { return item1.Value >= item2.Value; } public static bool operator <=(ModInt item1, ModInt item2) { return item1.Value <= item2.Value; } public static bool operator >=(ModInt item1, int item2) { return item1.Value >= item2; } public static bool operator <=(ModInt item1, int item2) { return item1.Value <= item2; } public static bool operator>(ModInt item1, ModInt item2) { return item1.Value > item2.Value; } public static bool operator<(ModInt item1, ModInt item2) { return item1.Value < item2.Value; } public static bool operator>(ModInt item1, int item2) { return item1.Value >= item2; } public static bool operator<(ModInt item1, int item2) { return item1.Value <= item2; } } /// <summary>組み合わせ</summary> class ModCombination { private int mod; private int[] fac; private int[] finv; private int[] inv; public ModCombination(int max, int mod = 1000000007) { this.mod = mod; fac = new int[max]; // modが法のn!の列 inv = new int[max]; // indexの逆元の列 finv = new int[max]; // modを法とした、invの累積の累積 fac[0] = 1; fac[1] = 1; finv[0] = 1; finv[1] = 1; inv[1] = 1; for (int i = 2; i < max; i++) { fac[i] = (int)(Math.BigMul(fac[i - 1], i) % mod); // factorを求める var s = Math.BigMul(inv[mod % i], mod / i) % mod; inv[i] = (int)(mod - s);   // iに対する逆元を求める finv[i] = (int)(Math.BigMul(finv[i - 1], inv[i]) % mod); } } /// <summary>nCk</summary> public int Calculation(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return (int)(Math.BigMul(fac[n], (int)(Math.BigMul(finv[k], finv[n - k]) % mod)) % mod); } } /// <summary>拡張メソッドs</summary> static class Extention { /// <summary>iとjを入れ替える</summary> public static void Swap<T>(this T[] arr, int i, int j) { var buf = arr[i]; arr[i] = arr[j]; arr[j] = buf; } /// <summary> /// partition。末尾sArr[r]を基準として、左に基準より小さい数、右に基準より大きい数が存在するように配列を並び替える。 /// </summary> /// <param name="sArr"></param> /// <param name="p">partitionの先頭の添字</param> /// <param name="r">partitionの末尾の添字</param> /// <returns>partitionの基準が存在する添字</returns> public static int Partition(this int[] sArr, int p, int r) { var x = sArr[r]; var i = p - 1; for (int j = p; j < r; j++) { if (sArr[j] <= x) { i++; sArr.Swap(i, j); } } sArr.Swap(i + 1, r); return i + 1; } /// <summary>深いコピーをする</summary> public static T DeepCopy<T>(this T obj) { T result; var b = new BinaryFormatter(); using (var mem = new MemoryStream()) { b.Serialize(mem, obj); // binaryFormatterによりobjをmemにserial化して書き出す mem.Position = 0; // memのpotisionを先頭に戻す result = (T)b.Deserialize(mem); // memの内容を読み取る。 } return result; } }
[["-", 0, 28, 0, 41, 64, 283, 0, 284, 0, 45], ["-", 64, 283, 0, 284, 0, 213, 63, 214, 205, 22], ["-", 64, 283, 0, 284, 0, 213, 63, 214, 0, 131], ["-", 64, 283, 0, 284, 0, 213, 63, 214, 141, 22], ["-", 64, 283, 0, 284, 0, 213, 3, 4, 0, 24], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 62], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["-", 64, 283, 0, 284, 0, 213, 3, 4, 0, 25], ["-", 0, 28, 0, 41, 64, 283, 0, 284, 0, 46], ["-", 3, 4, 0, 28, 0, 41, 64, 283, 0, 62], ["-", 0, 28, 0, 41, 75, 283, 0, 284, 0, 45], ["-", 0, 284, 0, 213, 63, 214, 205, 23, 0, 24], ["-", 0, 213, 63, 214, 205, 23, 0, 16, 31, 22], ["-", 0, 213, 63, 214, 205, 23, 0, 16, 17, 33], ["-", 0, 213, 63, 214, 205, 23, 0, 16, 12, 203], ["-", 0, 284, 0, 213, 63, 214, 205, 23, 0, 25], ["-", 75, 283, 0, 284, 0, 213, 63, 214, 0, 131], ["-", 75, 283, 0, 284, 0, 213, 63, 214, 141, 22], ["-", 75, 283, 0, 284, 0, 213, 3, 4, 0, 24], ["-", 75, 283, 0, 284, 0, 213, 3, 4, 0, 25], ["-", 0, 28, 0, 41, 75, 283, 0, 284, 0, 46]]
8
3,175
24
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(); write wr = new write(); int n = sc.intarr[0]; if (n <= 999) wr.wri("ABC" + n.ToString()); else wr.wri("ABD" + (n - 999).ToString()); } } class Scan { public string str => Console.ReadLine(); public string[] strarr => str.Split(' '); public long[] longarr => strarr.Select(long.Parse).ToArray(); public int[] intarr => strarr.Select(int.Parse).ToArray(); public char[] chararr => str.ToArray(); } class write { public void wri<Type>(Type x) { Console.WriteLine(x); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { Solve(); } 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"); } } class Scan { public string str => Console.ReadLine(); public string[] strarr => str.Split(' '); public long[] longarr => strarr.Select(long.Parse).ToArray(); public int[] intarr => strarr.Select(int.Parse).ToArray(); public char[] chararr => str.ToArray(); } class write { public void wri<Type>(Type x) { Console.WriteLine(x); } }
[["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["-", 0, 28, 0, 16, 12, 213, 63, 214, 205, 22], ["-", 0, 28, 0, 16, 12, 213, 63, 214, 0, 131], ["-", 0, 28, 0, 16, 12, 213, 63, 214, 141, 22], ["-", 0, 28, 0, 16, 12, 213, 3, 4, 0, 24], ["-", 0, 57, 64, 1, 0, 213, 3, 4, 0, 25], ["-", 0, 16, 12, 213, 63, 214, 205, 23, 0, 24], ["-", 12, 213, 63, 214, 205, 23, 0, 16, 31, 22], ["-", 12, 213, 63, 214, 205, 23, 0, 16, 17, 33], ["-", 12, 213, 63, 214, 205, 23, 0, 16, 12, 203], ["-", 0, 16, 12, 213, 63, 214, 205, 23, 0, 25], ["-", 0, 28, 0, 16, 12, 213, 3, 4, 0, 25]]
8
222
16
using System; using System.Linq; using System.Collections.Generic; using static System.Console; using static System.Math; public class Hello { public static void Main() { /* string[] input = ReadLine().Split(' '); int n = int.Parse(input[0]); int m = int.Parse(input[1]);*/ // string temp = ReadLine(); int n = int.Parse(ReadLine()); if (n < 1000) { WriteLine("ABC{0:000}", n); } else { WriteLine("ABD{0:000}", n - 999); } } }
using System; using System.Linq; using System.Collections.Generic; using static System.Console; using static System.Math; public class Hello { public static void Main() { /* string[] input = ReadLine().Split(' '); int n = int.Parse(input[0]); int m = int.Parse(input[1]);*/ // string temp = ReadLine(); int n = int.Parse(ReadLine()); if (n < 1000) { WriteLine("ABC"); } else { WriteLine("ABD"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["-", 64, 196, 0, 1, 0, 213, 3, 4, 0, 21], ["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["-", 75, 196, 0, 1, 0, 213, 3, 4, 0, 21], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
8
85
10
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace AtCoder.ABC099.A { class Program { static void Main() { var sc = new Scanner(); var n = sc.Nextint(); n = n <= 999 ? n : n - 999; Console.WriteLine($"ABC{n:000}"); } } class Scanner { string[] s; long 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 long NextLong() { return long.Parse(Next()); } public long[] ArrayLong(int N, long add = 0) { long[] Array = new long[N]; for (long i = 0; i < N; i++) { Array[i] = NextLong() + add; } return Array; } public double NextDouble() { return double.Parse(Next()); } public double[] ArrayDouble(long N, double add = 0) { double[] Array = new double[N]; for (long i = 0; i < N; i++) { Array[i] = NextDouble() + add; } return Array; } public decimal NextDecimal() { return decimal.Parse(Next()); } public decimal[] ArrayDecimal(long N, decimal add = 0) { decimal[] Array = new decimal[N]; for (long i = 0; i < N; i++) { Array[i] = NextDecimal(); } return Array; } } }
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace AtCoder.ABC099.A { class Program { static void Main() { var sc = new Scanner(); var n = sc.Nextint(); Console.WriteLine(n <= 999 ? "ABC" : "ABD"); } } class Scanner { string[] s; long 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 long NextLong() { return long.Parse(Next()); } public long[] ArrayLong(int N, long add = 0) { long[] Array = new long[N]; for (long i = 0; i < N; i++) { Array[i] = NextLong() + add; } return Array; } public double NextDouble() { return double.Parse(Next()); } public double[] ArrayDouble(long N, double add = 0) { double[] Array = new double[N]; for (long i = 0; i < N; i++) { Array[i] = NextDouble() + add; } return Array; } public decimal NextDecimal() { return decimal.Parse(Next()); } public decimal[] ArrayDecimal(long N, decimal add = 0) { decimal[] Array = new decimal[N]; for (long i = 0; i < N; i++) { Array[i] = NextDecimal(); } return Array; } } }
[["-", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22], ["-", 8, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["-", 0, 1, 0, 11, 12, 41, 15, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 41, 15, 16, 17, 19], ["-", 0, 1, 0, 11, 12, 41, 15, 16, 12, 203], ["-", 8, 196, 0, 1, 0, 11, 12, 41, 0, 101], ["-", 8, 196, 0, 1, 0, 11, 12, 41, 64, 22], ["-", 8, 196, 0, 1, 0, 11, 12, 41, 0, 102], ["-", 0, 1, 0, 11, 12, 41, 75, 16, 31, 22], ["-", 0, 1, 0, 11, 12, 41, 75, 16, 17, 33], ["-", 0, 1, 0, 11, 12, 41, 75, 16, 12, 203], ["-", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35], ["-", 0, 213, 3, 4, 0, 28, 0, 283, 0, 295], ["-", 0, 213, 3, 4, 0, 28, 0, 283, 0, 296], ["-", 3, 4, 0, 28, 0, 283, 0, 284, 0, 45], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 12, 203], ["+", 0, 213, 3, 4, 0, 28, 0, 41, 0, 101], ["+", 3, 4, 0, 28, 0, 41, 64, 5, 0, 62], ["+", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["-", 3, 4, 0, 28, 0, 283, 0, 284, 0, 46], ["+", 3, 4, 0, 28, 0, 41, 75, 5, 0, 62], ["+", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222]]
8
521
25
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Net.Mail; namespace Contest { class Scanner { private string[] line = new string[0]; private int index = 0; public string Next() { if (line.Length <= index) { line = Console.ReadLine().Split(' '); index = 0; } var res = line[index]; index++; return res; } public int NextInt() { return int.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } public string[] Array() { line = Console.ReadLine().Split(' '); index = line.Length; return line; } public int[] IntArray() { var array = Array(); var result = new int[array.Length]; for (int i = 0; i < array.Length; i++) { result[i] = int.Parse(array[i]); } return result; } public long[] LongArray() { var array = Array(); var result = new long[array.Length]; for (int i = 0; i < array.Length; i++) { result[i] = long.Parse(array[i]); } return result; } } class MyMath { public static long Pow(long a, long b) { long res = 1; while (b > 0) { if (b % 2 == 1) { res *= a; res %= Mod; } a *= a; a %= Mod; b /= 2; } return res; } private const long Mod = 998244353; static MyMath() { _factorial = new long[500001]; _factorial[0] = 1; for (int i = 1; i <= 500000; i++) { _factorial[i] = (_factorial[i - 1] * i) % Mod; } } private static long[] _factorial; private static long Factorial(long n) { return _factorial[n]; } public static long Combination(long n, long m) { long bunsi = _factorial[n]; long bunbo = (_factorial[m] * _factorial[n - m]) % Mod; long gyakugen = Pow(bunbo, Mod - 2); return (bunsi * gyakugen) % Mod; } } class Program { private int N, A, B; private long K; private const long Mod = 998244353; private void Scan() { var sc = new Scanner(); N = sc.NextInt(); A = sc.NextInt(); B = sc.NextInt(); K = sc.NextLong(); } public void Solve() { Scan(); long ans = 0; for (int r = 0; r <= N; r++) { long bb = K - (long)r * A; long b; if (bb < 0) continue; if (bb % B == 0) { b = bb / B; } else { continue; } ans += MyMath.Combination(N, r) * MyMath.Combination(N, b); ans %= Mod; } Console.WriteLine(ans); } static void Main() => new Program().Solve(); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Net.Mail; namespace Contest { class Scanner { private string[] line = new string[0]; private int index = 0; public string Next() { if (line.Length <= index) { line = Console.ReadLine().Split(' '); index = 0; } var res = line[index]; index++; return res; } public int NextInt() { return int.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } public string[] Array() { line = Console.ReadLine().Split(' '); index = line.Length; return line; } public int[] IntArray() { var array = Array(); var result = new int[array.Length]; for (int i = 0; i < array.Length; i++) { result[i] = int.Parse(array[i]); } return result; } public long[] LongArray() { var array = Array(); var result = new long[array.Length]; for (int i = 0; i < array.Length; i++) { result[i] = long.Parse(array[i]); } return result; } } class MyMath { public static long Pow(long a, long b) { long res = 1; while (b > 0) { if (b % 2 == 1) { res *= a; res %= Mod; } a *= a; a %= Mod; b /= 2; } return res; } private const long Mod = 998244353; static MyMath() { _factorial = new long[700001]; _factorial[0] = 1; for (int i = 1; i <= 700000; i++) { _factorial[i] = (_factorial[i - 1] * i) % Mod; } } private static long[] _factorial; private static long Factorial(long n) { return _factorial[n]; } public static long Combination(long n, long m) { if (n < m) return 0; long bunsi = _factorial[n]; long bunbo = (_factorial[m] * _factorial[n - m]) % Mod; long gyakugen = Pow(bunbo, Mod - 2); return (bunsi * gyakugen) % Mod; } } class Program { private long N, A, B; private long K; private const long Mod = 998244353; private void Scan() { var sc = new Scanner(); N = sc.NextInt(); A = sc.NextInt(); B = sc.NextInt(); K = sc.NextLong(); } public void Solve() { Scan(); long ans = 0; for (long r = 0; r <= N; r++) { long bb = K - r * A; long b; if (bb < 0) continue; if (bb % B == 0) { b = bb / B; } else { continue; } ans += MyMath.Combination(N, r) * MyMath.Combination(N, b); ans %= Mod; } Console.WriteLine(ans); } static void Main() => new Program().Solve(); } }
[["-", 0, 11, 12, 227, 39, 224, 225, 226, 0, 203], ["+", 0, 11, 12, 227, 39, 224, 225, 226, 0, 203], ["-", 0, 263, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 263, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 22], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 37, 0, 38], ["+", 0, 195, 8, 196, 0, 57, 64, 37, 0, 203], ["+", 0, 195, 8, 196, 0, 57, 64, 37, 0, 35], ["-", 0, 235, 8, 201, 0, 124, 0, 198, 39, 199], ["+", 0, 235, 8, 201, 0, 124, 0, 198, 39, 199], ["-", 0, 195, 8, 196, 0, 7, 10, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 7, 10, 198, 39, 199], ["-", 0, 212, 0, 16, 12, 16, 31, 74, 0, 24], ["-", 0, 212, 0, 16, 12, 16, 31, 74, 39, 199], ["-", 0, 212, 0, 16, 12, 16, 31, 74, 0, 25]]
8
702
20
using System; using System.Collections.Generic; class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(); long N = long.Parse(str[0]); long A = long.Parse(str[1]); long B = long.Parse(str[2]); long K = long.Parse(str[3]); long mod = 998244353; long[] NA = new long[N + 1]; long[] INA = new long[N + 1]; NA[0] = 1; INA[0] = 1; for (var i = 1; i < NA.Length; i++) { NA[i] = NA[i - 1] * i % mod; INA[i] = INA[i - 1] * Mpow(i, mod - 2, mod) % mod; } long ans = 0; for (var i = 0; i <= N; i++) { if (K - A * i < 0) { break; } if ((K - A * i) % B == 0) { long j1 = (K - A * i) / B; long an1 = NA[N] * INA[N - i] % mod; an1 = an1 * INA[i] % mod; an1 = an1 * NA[N] % mod; an1 = an1 * INA[N - j1] % mod; an1 = an1 * INA[j1] % mod; ans = (ans + an1) % mod; } } Console.WriteLine(ans); } public static long Mpow(long x, long n, long m) { long ans = 1; while (n > 0) { if (n % 2 == 1) { ans = ans * x % m; n -= 1; } x = x * x % m; n /= 2; } return ans; } }
using System; using System.Collections.Generic; class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(); long N = long.Parse(str[0]); long A = long.Parse(str[1]); long B = long.Parse(str[2]); long K = long.Parse(str[3]); long mod = 998244353; long[] NA = new long[N + 1]; long[] INA = new long[N + 1]; NA[0] = 1; INA[0] = 1; for (var i = 1; i < NA.Length; i++) { NA[i] = NA[i - 1] * i % mod; INA[i] = INA[i - 1] * Mpow(i, mod - 2, mod) % mod; } long ans = 0; for (var i = 0; i <= N; i++) { if (K - A * i < 0) { break; } if ((K - A * i) % B == 0) { long j1 = (K - A * i) / B; if (j1 <= N) { long an1 = NA[N] * INA[N - i] % mod; an1 = an1 * INA[i] % mod; an1 = an1 * NA[N] % mod; an1 = an1 * INA[N - j1] % mod; an1 = an1 * INA[j1] % mod; ans = (ans + an1) % mod; } } } Console.WriteLine(ans); } public static long Mpow(long x, long n, long m) { long ans = 1; while (n > 0) { if (n % 2 == 1) { ans = ans * x % m; n -= 1; } x = x * x % m; n /= 2; } return ans; } }
[["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 24], ["+", 0, 57, 64, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 57, 64, 196, 0, 57, 15, 16, 17, 19], ["+", 0, 57, 64, 196, 0, 57, 15, 16, 12, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 25], ["+", 0, 57, 64, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 57, 64, 196, 0, 46]]
8
406
8
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AtCoder { class Modulo { public readonly int M = 998244353; private readonly int[] m_facs; public Modulo(int n) { m_facs = new int[n + 1]; m_facs[0] = 1; for (int i = 1; i <= n; ++i) { m_facs[i] = (int)(Math.BigMul(m_facs[i - 1], i) % M); } } public int Fac(int n) { return m_facs[n]; } public int Pow(int a, int m) { switch (m) { case 0: return 1; case 1: return a; default: int p1 = Pow(a, m / 2); long p2 = Math.BigMul(p1, p1) % M; return (int)(((m & 1) == 0) ? p2 : p2 * a % M); } } public long Ncr(int n, int r) { if (n < r) { return 0; } if (n == r) { return 1; } long res = Fac(n); res *= Pow(Fac(r), M - 2); res %= M; res *= Pow(Fac(n - r), M - 2); res %= M; return res; } } class Program { private const int MODULO = 998244353; 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); } static long Solve(int N, int A, int B, long K) { var modulo = new Modulo(N); long sum = 0; for (int i = 0; i <= N; ++i) { long L = Math.BigMul(A, i); if ((K - L) % B == 0 && (K - L) / B <= N) { int j = (int)((K - L) / B); sum += (modulo.Ncr(N, i) * modulo.Ncr(N, j)) % MODULO; sum %= MODULO; } } return sum; } static void Main(string[] args) { var V = ReadLongs(); Console.WriteLine(Solve((int)V[0], (int)V[1], (int)V[2], V[3])); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AtCoder { class Modulo { public readonly int M = 998244353; private readonly int[] m_facs; public Modulo(int n) { m_facs = new int[n + 1]; m_facs[0] = 1; for (int i = 1; i <= n; ++i) { m_facs[i] = (int)(Math.BigMul(m_facs[i - 1], i) % M); } } public int Fac(int n) { return m_facs[n]; } public int Pow(int a, int m) { switch (m) { case 0: return 1; case 1: return a; default: int p1 = Pow(a, m / 2); long p2 = Math.BigMul(p1, p1) % M; return (int)(((m & 1) == 0) ? p2 : p2 * a % M); } } public long Ncr(int n, int r) { if (n < r) { return 0; } if (n == r) { return 1; } long res = Fac(n); res *= Pow(Fac(r), M - 2); res %= M; res *= Pow(Fac(n - r), M - 2); res %= M; return res; } } class Program { private const int MODULO = 998244353; 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); } static long Solve(int N, int A, int B, long K) { var modulo = new Modulo(N); long sum = 0; for (int i = 0; i <= N; ++i) { long L = Math.BigMul(A, i); if ((K - L) >= 0 && (K - L) % B == 0 && (K - L) / B <= N) { int j = (int)((K - L) / B); sum += (modulo.Ncr(N, i) * modulo.Ncr(N, j)) % MODULO; sum %= MODULO; } } return sum; } static void Main(string[] args) { var V = ReadLongs(); Console.WriteLine(Solve((int)V[0], (int)V[1], (int)V[2], V[3])); } } }
[["+", 0, 57, 15, 16, 31, 16, 31, 16, 17, 20], ["+", 0, 57, 15, 16, 31, 16, 31, 16, 12, 203], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 98], ["+", 31, 16, 12, 16, 31, 16, 31, 23, 0, 24], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 31, 22], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 16, 31, 16, 31, 23, 0, 16, 12, 22], ["+", 31, 16, 12, 16, 31, 16, 31, 23, 0, 25]]
8
639
8
using System; using System.Collections.Generic; using System.Linq; using System.Text; public class AtCoderA { static void Main() { var sc = new Scanner(); int a = sc.NextInt(); int b = sc.NextInt(); int c = sc.NextInt(); int[] nums = new int[] { a + b, a - b, a * b }; int answer = nums.Max(); Console.WriteLine(answer); } class Scanner { private string[] _line; private int _index; private const char Separator = ' '; public Scanner() { _line = new string[0]; _index = 0; } public string Next() { while (_index >= _line.Length) { _line = Console.ReadLine().Split(Separator); _index = 0; } return _line[_index++]; } public int NextInt() => int.Parse(Next()); public long NextLong() => long.Parse(Next()); public double NextDouble() => double.Parse(Next()); public decimal NextDecimal() => decimal.Parse(Next()); public char NextChar() => Next()[0]; public char[] NextCharArray() => Next().ToCharArray(); public string[] Array() { _line = Console.ReadLine().Split(Separator); _index = _line.Length; return _line; } public int[] IntArray() => Array().Select(int.Parse).ToArray(); public long[] LongArray() => Array().Select(long.Parse).ToArray(); public double[] DoubleArray() => Array().Select(double.Parse).ToArray(); public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray(); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; public class AtCoderA { static void Main() { var sc = new Scanner(); int a = sc.NextInt(); int b = sc.NextInt(); int[] nums = new int[] { a + b, a - b, a * b }; int answer = nums.Max(); Console.WriteLine(answer); } class Scanner { private string[] _line; private int _index; private const char Separator = ' '; public Scanner() { _line = new string[0]; _index = 0; } public string Next() { while (_index >= _line.Length) { _line = Console.ReadLine().Split(Separator); _index = 0; } return _line[_index++]; } public int NextInt() => int.Parse(Next()); public long NextLong() => long.Parse(Next()); public double NextDouble() => double.Parse(Next()); public decimal NextDecimal() => decimal.Parse(Next()); public char NextChar() => Next()[0]; public char[] NextCharArray() => Next().ToCharArray(); public string[] Array() { _line = Console.ReadLine().Split(Separator); _index = _line.Length; return _line; } public int[] IntArray() => Array().Select(int.Parse).ToArray(); public long[] LongArray() => Array().Select(long.Parse).ToArray(); public double[] DoubleArray() => Array().Select(double.Parse).ToArray(); public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray(); } }
[["-", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["-", 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, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["-", 8, 196, 0, 197, 0, 198, 39, 224, 39, 199]]
8
400
9
using System; using System.Collections.Generic; using System.Linq; 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 Int() { 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] = Int() + add; } return Array; } public long Long() { 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] = Long() + add; } return Array; } } class Program { static Scanner cin = new Scanner(); static void Main() { int N = cin.Int(); int K = cin.Int(); Console.ReadLine(); Console.WriteLine((N - 1) / (K - 1)); Console.ReadLine(); } }
using System; using System.Collections.Generic; using System.Linq; 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 Int() { 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] = Int() + add; } return Array; } public long Long() { 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] = Long() + add; } return Array; } } class Program { static Scanner cin = new Scanner(); static void Main() { int N = cin.Int(); int K = cin.Int(); Console.ReadLine(); Console.WriteLine(Math.Ceiling((double)(N - 1) / (K - 1))); Console.ReadLine(); } }
[["+", 3, 4, 0, 28, 0, 213, 63, 214, 205, 22], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 0, 131], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["+", 3, 4, 0, 28, 0, 213, 3, 4, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 25], ["+", 3, 4, 0, 28, 0, 16, 12, 23, 0, 25]]
8
358
8
using System; using System.Collections.Generic; using System.Linq; class Program { static int n, k; static int ans = 0; static int Main() { string[] nyu = Console.ReadLine().Split(' '); n = int.Parse(nyu[0]); k = int.Parse(nyu[1]); int[] a = new int[n]; string[] nya = Console.ReadLine().Split(' '); if ((n - 1) % (k - 1) == 0) { ans = 1; } else { ans = (n - 1) / (k - 1) + 1; } Console.WriteLine("{0}", ans); return 0; } }
using System; using System.Collections.Generic; using System.Linq; class Program { static int n, k; static int ans = 0; static int Main() { string[] nyu = Console.ReadLine().Split(' '); n = int.Parse(nyu[0]); k = int.Parse(nyu[1]); int[] a = new int[n]; string[] nya = Console.ReadLine().Split(' '); if ((n - 1) % (k - 1) == 0) { ans = (n - 1) / (k - 1); } else { ans = (n - 1) / (k - 1) + 1; } Console.WriteLine("{0}", ans); return 0; } }
[["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 12, 203], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 64, 196, 0, 1, 0, 11, 12, 16, 17, 85], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 33], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
8
164
10
using System; using System.Linq; using System.Collections.Generic; using E = System.Linq.Enumerable; public class Program { public static void Main() { var nk = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); var xs = Console.ReadLine().Split().ToArray(); var n = nk[0]; var k = nk[1]; var m = Array.IndexOf(xs, "1"); var t = (m + k - 2) / (k - 1); var s = m % (k - 1); var r = (n - m - Math.Max(1, s) + k - 2) / (k - 1); Console.WriteLine(t + r); } }
using System; using System.Linq; using System.Collections.Generic; using E = System.Linq.Enumerable; public class Program { public static void Main() { var nk = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); var xs = Console.ReadLine().Split().ToArray(); var n = nk[0]; var k = nk[1]; var m = Array.IndexOf(xs, "1"); var t = (m + k - 2) / (k - 1); var s = k - (m - (t - 1) * (k - 1)) % k; var r = (n - m - 1 - (s - 1) + k - 2) / (k - 1); Console.WriteLine(t + r); } }
[["+", 0, 198, 0, 200, 0, 212, 0, 16, 31, 22], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 33], ["+", 0, 212, 0, 16, 12, 16, 31, 23, 0, 24], ["-", 0, 198, 0, 200, 0, 212, 0, 16, 17, 109], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 16, 12, 16, 31, 23, 0, 16, 12, 203], ["+", 31, 23, 0, 16, 12, 16, 31, 23, 0, 25], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 48], ["+", 31, 23, 0, 16, 12, 16, 12, 23, 0, 24], ["+", 0, 212, 0, 16, 12, 16, 31, 23, 0, 25], ["+", 0, 200, 0, 212, 0, 16, 12, 16, 17, 109], ["+", 0, 200, 0, 212, 0, 16, 12, 16, 12, 22], ["-", 31, 16, 31, 16, 12, 213, 63, 214, 205, 22], ["-", 31, 16, 31, 16, 12, 213, 63, 214, 0, 131], ["-", 31, 16, 31, 16, 12, 213, 63, 214, 141, 22], ["-", 31, 16, 31, 16, 12, 213, 3, 4, 0, 24], ["-", 31, 16, 31, 16, 12, 213, 3, 4, 0, 21], ["+", 31, 23, 0, 16, 31, 16, 31, 16, 17, 33], ["+", 0, 16, 31, 16, 31, 16, 12, 23, 0, 24], ["+", 31, 16, 31, 16, 12, 23, 0, 16, 17, 33], ["+", 31, 16, 31, 16, 12, 23, 0, 16, 12, 203]]
8
178
23
using System; class Program { static void Main(string[] args) { string[] t = Console.ReadLine().Split(' '); int N = int.Parse(t[0]); int K = int.Parse(t[1]); string[] a = Console.ReadLine().Split(' '); int[] A = new int[a.Length]; for (int i = 0; i < a.Length; i++) { A[i] = int.Parse(a[i]); } if (N == K) { Console.WriteLine(1); } else if (N % (K - 1) == 0) { Console.WriteLine(N / (K - 1)); } else if (N % (K - 1) != 0) { Console.WriteLine(N / (K - 1) + 1); } } }
using System; class Program { static void Main(string[] args) { string[] t = Console.ReadLine().Split(' '); int N = int.Parse(t[0]); int K = int.Parse(t[1]); string[] a = Console.ReadLine().Split(' '); int[] A = new int[a.Length]; for (int i = 0; i < a.Length; i++) { A[i] = int.Parse(a[i]); } if (N == K) { Console.WriteLine(1); } else if ((N - 1) % (K - 1) == 0) { Console.WriteLine((N - 1) / (K - 1)); } else if ((N - 1) % (K - 1) != 0) { Console.WriteLine((N - 1) / (K - 1) + 1); } } }
[["+", 75, 57, 15, 16, 31, 16, 31, 23, 0, 24], ["+", 15, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 15, 16, 31, 16, 31, 23, 0, 16, 12, 203], ["+", 75, 57, 15, 16, 31, 16, 31, 23, 0, 25], ["+", 64, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 28, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 28, 0, 16, 31, 23, 0, 16, 12, 203], ["+", 3, 4, 0, 28, 0, 16, 31, 23, 0, 25], ["+", 8, 196, 0, 57, 75, 57, 75, 57, 0, 24], ["+", 0, 28, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 16, 31, 16, 31, 23, 0, 16, 12, 203], ["+", 0, 28, 0, 16, 31, 16, 31, 23, 0, 25]]
8
199
16
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace atcoder_cs { class Program { static double CalcSunuke(long num) { long tmp = num; long sn = 0; while (tmp > 0) { sn += (tmp % 10); tmp /= 10; } return num / (double)sn; } static void PrintSunuke(long k) { int count = 0; for (int i = 1; i < 10; i++) { Console.WriteLine(i.ToString()); ++count; if (count >= k) { return; } } long baseNum = 9; long baseDigit = 10; while (count < k) { long topNum = 1; long nextCandidate = 0; long nowCandidate = topNum * baseDigit + baseNum; while (nowCandidate <= nextCandidate) { ++topNum; nowCandidate = topNum * baseDigit + baseNum; } double sunuke = CalcSunuke(nowCandidate); while (count < k) { ++topNum; nextCandidate = topNum * baseDigit + baseNum; double tmpSunuke = CalcSunuke(nextCandidate); if (sunuke < tmpSunuke) { Console.WriteLine(nowCandidate.ToString()); nowCandidate = nextCandidate; sunuke = tmpSunuke; ++count; } else { baseNum = baseNum * 10 + 9; baseDigit *= 10; break; } } } } static void Main(string[] args) { long k; string str = Console.ReadLine(); k = long.Parse(str); PrintSunuke(k); return; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace atcoder_cs { class Program { static double CalcSunuke(long num) { long tmp = num; long sn = 0; while (tmp > 0) { sn += (tmp % 10); tmp /= 10; } return num / (double)sn; } static void PrintSunuke(long k) { int count = 0; for (int i = 1; i < 10; i++) { Console.WriteLine(i.ToString()); ++count; if (count >= k) { return; } } long baseNum = 9; long baseDigit = 10; long nextCandidate = 0; while (count < k) { long topNum = 1; long nowCandidate = topNum * baseDigit + baseNum; while (nowCandidate <= nextCandidate) { ++topNum; nowCandidate = topNum * baseDigit + baseNum; } double sunuke = CalcSunuke(nowCandidate); while (count < k) { ++topNum; nextCandidate = topNum * baseDigit + baseNum; double tmpSunuke = CalcSunuke(nextCandidate); if (sunuke < tmpSunuke) { Console.WriteLine(nowCandidate.ToString()); nowCandidate = nextCandidate; sunuke = tmpSunuke; ++count; } else { baseNum = baseNum * 10 + 9; baseDigit *= 10; break; } } } } static void Main(string[] args) { long k; string str = Console.ReadLine(); k = long.Parse(str); PrintSunuke(k); return; } } }
[["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["-", 8, 196, 0, 52, 8, 196, 0, 197, 0, 35], ["-", 0, 52, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203]]
8
313
10
using System; class Plogram { static void Main() { var array = Console.ReadLine().Split(); int A = int.Parse(array[0]); int B = int.Parse(array[1]); string str = ":("; if (A <= 10 && B <= 10 && A + B <= 16) { str = "Yay!"; } Console.WriteLine(str); } }
using System; class Plogram { static void Main() { var array = Console.ReadLine().Split(); int A = int.Parse(array[0]); int B = int.Parse(array[1]); string str = ":("; if (A <= 8 && B <= 8) { str = "Yay!"; } Console.WriteLine(str); } }
[["-", 0, 57, 15, 16, 31, 16, 31, 16, 12, 203], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 98], ["-", 0, 57, 15, 16, 31, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 16, 31, 16, 12, 16, 17, 19], ["-", 0, 57, 15, 16, 31, 16, 12, 16, 12, 203], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203], ["-", 0, 57, 15, 16, 12, 16, 31, 16, 31, 22], ["-", 0, 57, 15, 16, 12, 16, 31, 16, 17, 72], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 12, 203], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 12, 203]]
8
91
10
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[0] + input[1] == 16 && input[0] != input[1] ? ":(" : "Yay!"); /* //処理速度計測 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[0] <= 8 && input[1] <= 8) ? ":(" : "Yay!"); /* //処理速度計測 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, 241, 0, 111], ["+", 0, 28, 0, 41, 15, 241, 0, 23, 0, 24], ["-", 0, 41, 15, 16, 31, 16, 31, 16, 17, 72], ["-", 15, 16, 31, 16, 31, 16, 12, 204, 205, 22], ["-", 31, 16, 31, 16, 12, 204, 206, 207, 0, 70], ["-", 31, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["-", 31, 16, 31, 16, 12, 204, 206, 207, 0, 73], ["-", 0, 28, 0, 41, 15, 16, 31, 16, 17, 60], ["-", 0, 28, 0, 41, 15, 16, 31, 16, 12, 203], ["+", 15, 241, 0, 23, 0, 16, 31, 16, 17, 19], ["+", 15, 241, 0, 23, 0, 16, 31, 16, 12, 203], ["-", 12, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["-", 15, 16, 12, 16, 31, 204, 206, 207, 0, 73], ["-", 0, 28, 0, 41, 15, 16, 12, 16, 17, 79], ["-", 0, 41, 15, 16, 12, 16, 12, 204, 205, 22], ["-", 15, 16, 12, 16, 12, 204, 206, 207, 0, 70], ["+", 15, 241, 0, 23, 0, 16, 12, 16, 17, 19], ["+", 15, 241, 0, 23, 0, 16, 12, 16, 12, 203], ["+", 0, 28, 0, 41, 15, 241, 0, 23, 0, 25]]
8
113
19
using System; namespace AtCorder100_A { class Program { static void Main(string[] args) { string INPUT = Console.ReadLine(); string[] INPUT_ = INPUT.Split(' '); int A = int.Parse(INPUT_[0]); int B = int.Parse(INPUT_[1]); if (A > 8 || B > 8) Console.WriteLine(": ("); if (A <= 8 && B <= 8) Console.WriteLine("Yay!"); int C = Math.Abs(A - B); } } }
using System; namespace AtCorder100_A { class Program { static void Main(string[] args) { string INPUT = Console.ReadLine(); string[] INPUT_ = INPUT.Split(' '); int A = int.Parse(INPUT_[0]); int B = int.Parse(INPUT_[1]); if (A > 8 || B > 8) Console.WriteLine(":("); if (A <= 8 && B <= 8) Console.WriteLine("Yay!"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["-", 0, 57, 64, 1, 0, 213, 3, 4, 0, 25], ["-", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35], ["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["-", 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, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
8
121
14
using System; namespace BeginnerContest_100_A { class Program { static void Main(string[] args) { string[] hoge = Console.ReadLine().Split(' '); int a = int.Parse(hoge[0]); int b = int.Parse(hoge[1]); if (a <= 8) Console.WriteLine("Yay!"); else if (b <= 8) Console.WriteLine("Yay"); else Console.WriteLine(":("); } } }
using System; namespace BeginnerContest_100_A { class Program { static void Main(string[] args) { string[] hoge = Console.ReadLine().Split(' '); int a = int.Parse(hoge[0]); int b = int.Parse(hoge[1]); if (a <= 8 && b <= 8) Console.WriteLine("Yay!"); else Console.WriteLine(":("); } } }
[["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["-", 0, 57, 64, 1, 0, 213, 63, 214, 205, 22], ["-", 0, 57, 64, 1, 0, 213, 63, 214, 0, 131], ["-", 0, 57, 64, 1, 0, 213, 63, 214, 141, 22], ["-", 0, 57, 64, 1, 0, 213, 3, 4, 0, 24], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 62], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["-", 0, 57, 64, 1, 0, 213, 3, 4, 0, 25], ["-", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["-", 0, 195, 8, 196, 0, 57, 75, 57, 0, 121], ["-", 0, 195, 8, 196, 0, 57, 75, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
107
16
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Competitive { internal class Solution { public int A, B; public void Run() { { A = Input.ReadInt(); B = Input.ReadInt(); } Console.WriteLine((A <= 8 && B <= 8) ? "Yay!" : ":("); } } // libs ---------- // common ---------- internal static class Input { public static string ReadString() { string line = Console.ReadLine(); return line; } public static int ReadInt() { string line = Console.ReadLine(); return int.Parse(line); } public static int[] ReadIntArray() { string line = Console.ReadLine(); return line.Split(' ').Select(int.Parse).ToArray(); } public static long ReadLong() { string line = Console.ReadLine(); return long.Parse(line); } public static long[] ReadLongArray() { string line = Console.ReadLine(); return line.Split(' ').Select(long.Parse).ToArray(); } public static double[] ReadDoubleArray() { string line = Console.ReadLine(); return line.Split(' ').Select(double.Parse).ToArray(); } } internal class Program { public static void Main(string[] args) { var s = new Solution(); s.Run(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Competitive { internal class Solution { public int A, B; public void Run() { { var line = Input.ReadIntArray(); A = line[0]; B = line[1]; } Console.WriteLine((A <= 8 && B <= 8) ? "Yay!" : ":("); } } // libs ---------- // common ---------- internal static class Input { public static string ReadString() { string line = Console.ReadLine(); return line; } public static int ReadInt() { string line = Console.ReadLine(); return int.Parse(line); } public static int[] ReadIntArray() { string line = Console.ReadLine(); return line.Split(' ').Select(int.Parse).ToArray(); } public static long ReadLong() { string line = Console.ReadLine(); return long.Parse(line); } public static long[] ReadLongArray() { string line = Console.ReadLine(); return line.Split(' ').Select(long.Parse).ToArray(); } public static double[] ReadDoubleArray() { string line = Console.ReadLine(); return line.Split(' ').Select(double.Parse).ToArray(); } } internal class Program { public static void Main(string[] args) { var s = new Solution(); s.Run(); } } }
[["-", 8, 196, 0, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["+", 0, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["-", 0, 1, 0, 11, 12, 213, 63, 214, 141, 22], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 0, 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], ["+", 0, 195, 8, 196, 0, 196, 0, 1, 0, 35], ["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 22], ["-", 0, 1, 0, 11, 12, 213, 63, 214, 0, 131], ["-", 0, 1, 0, 11, 12, 213, 3, 4, 0, 24], ["-", 0, 1, 0, 11, 12, 213, 3, 4, 0, 25]]
8
312
21
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST { static void Main() { Sol mySol = new Sol(); mySol.Solve(); } } class Sol { public void Solve() { var A = ri(); var B = ri(); Console.WriteLine(Math.Max(A, B) <= 8 ? "Yay!" : ":("); } public Sol() {} static String rs() { return Console.ReadLine(); } static int ri() { return int.Parse(Console.ReadLine()); } static long rl() { return long.Parse(Console.ReadLine()); } static double rd() { return double.Parse(Console.ReadLine()); } static String[] rsa(char sep = ' ') { return Console.ReadLine().Split(sep); } static int[] ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); } static long[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); } static double[] rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST { static void Main() { Sol mySol = new Sol(); mySol.Solve(); } } class Sol { public void Solve() { var d = ria(); var A = d[0]; var B = d[1]; Console.WriteLine(Math.Max(A, B) <= 8 ? "Yay!" : ":("); } public Sol() {} static String rs() { return Console.ReadLine(); } static int ri() { return int.Parse(Console.ReadLine()); } static long rl() { return long.Parse(Console.ReadLine()); } static double rd() { return double.Parse(Console.ReadLine()); } static String[] rsa(char sep = ' ') { return Console.ReadLine().Split(sep); } static int[] ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); } static long[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); } static double[] rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); } }
[["-", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["-", 0, 198, 0, 200, 0, 212, 0, 213, 63, 22], ["+", 0, 198, 0, 200, 0, 212, 0, 213, 63, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["+", 0, 198, 0, 200, 0, 212, 0, 204, 205, 22], ["+", 0, 200, 0, 212, 0, 204, 206, 207, 0, 70], ["+", 0, 212, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 200, 0, 212, 0, 204, 206, 207, 0, 73], ["+", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["+", 8, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["-", 0, 200, 0, 212, 0, 213, 3, 4, 0, 24], ["-", 0, 200, 0, 212, 0, 213, 3, 4, 0, 25]]
8
326
19
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Numerics; using System.Text; using System.Text.RegularExpressions; namespace AtCoder.ABC { class QuestionB { public static void Main(string[] args) { var scanner = new Scanner(); var (d, n) = scanner.Int2(); var dd = Pow(100, d); Console.WriteLine(dd * n); } public static long Pow(long a, long b, long mod = 0L) { var temp = a; var ans = 1L; for (int i = 1; i <= b; i <<= 1) { if ((b & i) != 0) { ans *= temp; if (mod != 0) { ans %= mod; } } temp *= temp; if (mod != 0) { temp %= mod; } } return ans; } public class Scanner { private readonly char[] delimiter_ = new char[] { ' ' }; private readonly string filePath_; private readonly Func<string> reader_; private string[] buf_; private int index_; public Scanner(string file = "") { if (string.IsNullOrWhiteSpace(file)) { reader_ = Console.ReadLine; } else { filePath_ = file; var fs = new StreamReader(file); reader_ = fs.ReadLine; } buf_ = new string[0]; index_ = 0; } public string NextLine() => reader_(); public string Next() { if (index_ < buf_.Length) { return buf_[index_++]; } string st = reader_(); while (st == "") { st = reader_(); } buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries); if (buf_.Length == 0) { return Next(); } index_ = 0; return buf_[index_++]; } public int Int() => int.Parse(Next()); public long Long() => long.Parse(Next()); public double Double() => double.Parse(Next()); public int[] ArrayInt(int N, int add = 0) { int[] Array = new int[N]; for (int i = 0; i < N; i++) { Array[i] = Int() + add; } return Array; } public long[] ArrayLong(int N, long add = 0) { long[] Array = new long[N]; for (int i = 0; i < N; i++) { Array[i] = Long() + add; } return Array; } public double[] ArrayDouble(int N, double add = 0) { double[] Array = new double[N]; for (int i = 0; i < N; i++) { Array[i] = Double() + add; } return Array; } public (int, int) Int2(int add = 0) { var array = ArrayInt(2, add); return (array[0], array[1]); } public (int, int, int) Int3(int add = 0) { var array = ArrayInt(3, add); return (array[0], array[1], array[2]); } public (long, long) Long2(int add = 0) { var array = ArrayLong(2, add); return (array[0], array[1]); } public (long, long, long) Long3(int add = 0) { var array = ArrayLong(3, add); return (array[0], array[1], array[2]); } public (double, double) Double2(int add = 0) { var array = ArrayDouble(2, add); return (array[0], array[1]); } public (double, double, double) Double3(int add = 0) { var array = ArrayDouble(3, add); return (array[0], array[1], array[2]); } public void Save(string text) { if (string.IsNullOrWhiteSpace(filePath_)) { return; } File.WriteAllText(filePath_ + "_output.txt", text); } } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Numerics; using System.Text; using System.Text.RegularExpressions; namespace AtCoder.ABC { class QuestionB { public static void Main(string[] args) { var scanner = new Scanner(); var (d, n) = scanner.Int2(); var dd = Pow(100, d); if (n == 100) { n++; } Console.WriteLine(dd * n); } public static long Pow(long a, long b, long mod = 0L) { var temp = a; var ans = 1L; for (int i = 1; i <= b; i <<= 1) { if ((b & i) != 0) { ans *= temp; if (mod != 0) { ans %= mod; } } temp *= temp; if (mod != 0) { temp %= mod; } } return ans; } public class Scanner { private readonly char[] delimiter_ = new char[] { ' ' }; private readonly string filePath_; private readonly Func<string> reader_; private string[] buf_; private int index_; public Scanner(string file = "") { if (string.IsNullOrWhiteSpace(file)) { reader_ = Console.ReadLine; } else { filePath_ = file; var fs = new StreamReader(file); reader_ = fs.ReadLine; } buf_ = new string[0]; index_ = 0; } public string NextLine() => reader_(); public string Next() { if (index_ < buf_.Length) { return buf_[index_++]; } string st = reader_(); while (st == "") { st = reader_(); } buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries); if (buf_.Length == 0) { return Next(); } index_ = 0; return buf_[index_++]; } public int Int() => int.Parse(Next()); public long Long() => long.Parse(Next()); public double Double() => double.Parse(Next()); public int[] ArrayInt(int N, int add = 0) { int[] Array = new int[N]; for (int i = 0; i < N; i++) { Array[i] = Int() + add; } return Array; } public long[] ArrayLong(int N, long add = 0) { long[] Array = new long[N]; for (int i = 0; i < N; i++) { Array[i] = Long() + add; } return Array; } public double[] ArrayDouble(int N, double add = 0) { double[] Array = new double[N]; for (int i = 0; i < N; i++) { Array[i] = Double() + add; } return Array; } public (int, int) Int2(int add = 0) { var array = ArrayInt(2, add); return (array[0], array[1]); } public (int, int, int) Int3(int add = 0) { var array = ArrayInt(3, add); return (array[0], array[1], array[2]); } public (long, long) Long2(int add = 0) { var array = ArrayLong(2, add); return (array[0], array[1]); } public (long, long, long) Long3(int add = 0) { var array = ArrayLong(3, add); return (array[0], array[1], array[2]); } public (double, double) Double2(int add = 0) { var array = ArrayDouble(2, add); return (array[0], array[1]); } public (double, double, double) Double3(int add = 0) { var array = ArrayDouble(3, add); return (array[0], array[1], array[2]); } public void Save(string text) { if (string.IsNullOrWhiteSpace(filePath_)) { return; } File.WriteAllText(filePath_ + "_output.txt", text); } } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 29], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
8
893
11
using System; using System.Collections.Generic; using System.Linq; using System.Numerics; namespace ConsoleApp1 { class Program { static void Main(string[] args) { int[] DN = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray(); int D = DN[0]; int N = DN[1]; if (D == 0) { Console.WriteLine(N); return; } if (D == 1) { Console.WriteLine(100 * N); return; } if (D == 2) { Console.WriteLine(10000 * N); return; } } } } // int[] N = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray();
using System; using System.Collections.Generic; using System.Linq; using System.Numerics; namespace ConsoleApp1 { class Program { static void Main(string[] args) { int[] DN = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray(); int D = DN[0]; int N = DN[1]; if (N == 100) { N += 1; } if (D == 0) { Console.WriteLine(N); return; } if (D == 1) { Console.WriteLine(100 * N); return; } if (D == 2) { Console.WriteLine(10000 * N); return; } } } } // int[] N = Console.ReadLine().Split(" ").Select(x => int.Parse(x)).ToArray();
[["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 107], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 203], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24]]
8
145
12
using System; using System.Linq; using System.Collections.Generic; using static System.Console; using System.Text; using System.IO; using static System.Math; namespace AtCoder { class Program { static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); } static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); } static readonly long Mod = 1000000000 + 7; static void Main(string[] args) { // SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false }); var DN = Sarray(); var D = DN[0]; var N = DN[1]; var ans = (long)Pow(100, D) * N; WriteLine(ans); // Out.Flush(); } } }
using System; using System.Linq; using System.Collections.Generic; using static System.Console; using System.Text; using System.IO; using static System.Math; namespace AtCoder { class Program { static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); } static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); } static readonly long Mod = 1000000000 + 7; static void Main(string[] args) { // SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false }); var DN = Sarray(); var D = DN[0]; var N = DN[1]; if (N == 100) ++N; var ans = (long)Pow(100, D) * N; WriteLine(ans); // Out.Flush(); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 241, 0, 29], ["+", 8, 196, 0, 57, 64, 1, 0, 241, 0, 22], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35]]
8
171
9
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace AtCoder.B { public class Program { public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); } private static object GetResult() { var (D, N) = Read2Longs(); return Math.Pow(100, D) * N; } #region Console.Read public static string ReadText() { return Console.ReadLine(); } public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); } public static long ReadLong() { return long.Parse(Console.ReadLine()); } public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); } public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); } public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); } public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); } public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); } #endregion } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace AtCoder.B { public class Program { public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); } private static object GetResult() { var (D, N) = Read2Longs(); var ans = N == 100 ? Math.Pow(100, D) * (N + 1) : Math.Pow(100, D) * N; return ans; } #region Console.Read public static string ReadText() { return Console.ReadLine(); } public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); } public static long ReadLong() { return long.Parse(Console.ReadLine()); } public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); } public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); } public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); } public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); } public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); } #endregion } }
[["-", 8, 201, 0, 195, 8, 196, 0, 37, 0, 38], ["+", 8, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["+", 0, 200, 0, 212, 0, 41, 15, 16, 31, 22], ["+", 0, 200, 0, 212, 0, 41, 15, 16, 17, 60], ["+", 0, 200, 0, 212, 0, 41, 15, 16, 12, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 41, 0, 101], ["+", 0, 41, 64, 16, 31, 213, 63, 214, 205, 22], ["+", 0, 41, 64, 16, 31, 213, 63, 214, 0, 131], ["+", 0, 41, 64, 16, 31, 213, 63, 214, 141, 22], ["+", 0, 41, 64, 16, 31, 213, 3, 4, 0, 24], ["+", 64, 16, 31, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 41, 64, 16, 31, 213, 3, 4, 0, 21], ["+", 64, 16, 31, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 41, 64, 16, 31, 213, 3, 4, 0, 25], ["+", 0, 200, 0, 212, 0, 41, 64, 16, 17, 48], ["+", 0, 212, 0, 41, 64, 16, 12, 23, 0, 24], ["+", 0, 41, 64, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 41, 64, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 41, 64, 16, 12, 23, 0, 16, 12, 203], ["+", 0, 212, 0, 41, 64, 16, 12, 23, 0, 25], ["+", 0, 198, 0, 200, 0, 212, 0, 41, 0, 102], ["+", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["+", 8, 201, 0, 195, 8, 196, 0, 37, 0, 38], ["+", 8, 201, 0, 195, 8, 196, 0, 37, 0, 22]]
8
371
26
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace AtCoder.B { public class Program { public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); } private static object GetResult() { var (D, N) = Read2Longs(); if (D == 0) { return N; } else if (D == 1) { return 100 * N; } else { return 10000 * N; } } #region Console.Read public static string ReadText() { return Console.ReadLine(); } public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); } public static long ReadLong() { return long.Parse(Console.ReadLine()); } public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); } public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); } public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); } public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); } public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); } #endregion } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace AtCoder.B { public class Program { public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); } private static object GetResult() { var (D, N) = Read2Longs(); if (D == 0) { if (N == 100) { return 101; } return N; } else if (D == 1) { if (N == 100) { return 10100; } return 100 * N; } else { if (N == 100) { return 1010000; } return 10000 * N; } } #region Console.Read public static string ReadText() { return Console.ReadLine(); } public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); } public static long ReadLong() { return long.Parse(Console.ReadLine()); } public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); } public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); } public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); } public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); } public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); } #endregion } }
[["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 24], ["+", 0, 57, 64, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 57, 64, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 57, 64, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 25], ["+", 0, 57, 64, 196, 0, 57, 64, 196, 0, 45], ["+", 64, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 64, 196, 0, 57, 64, 196, 0, 37, 0, 203], ["+", 64, 196, 0, 57, 64, 196, 0, 37, 0, 35], ["+", 0, 57, 64, 196, 0, 57, 64, 196, 0, 46], ["+", 0, 57, 75, 57, 64, 196, 0, 57, 0, 121], ["+", 0, 57, 75, 57, 64, 196, 0, 57, 0, 24], ["+", 75, 57, 64, 196, 0, 57, 15, 16, 31, 22], ["+", 75, 57, 64, 196, 0, 57, 15, 16, 17, 60], ["+", 75, 57, 64, 196, 0, 57, 15, 16, 12, 203], ["+", 0, 57, 75, 57, 64, 196, 0, 57, 0, 25], ["+", 75, 57, 64, 196, 0, 57, 64, 196, 0, 45], ["+", 75, 57, 64, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 196, 0, 57, 75, 57, 75, 196, 0, 45], ["+", 0, 57, 75, 57, 75, 196, 0, 57, 0, 121], ["+", 0, 57, 75, 57, 75, 196, 0, 57, 0, 24], ["+", 75, 57, 75, 196, 0, 57, 15, 16, 31, 22], ["+", 75, 57, 75, 196, 0, 57, 15, 16, 17, 60], ["+", 75, 57, 75, 196, 0, 57, 15, 16, 12, 203], ["+", 0, 57, 75, 57, 75, 196, 0, 57, 0, 25], ["+", 75, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["+", 75, 196, 0, 57, 64, 196, 0, 37, 0, 203], ["+", 75, 196, 0, 57, 64, 196, 0, 37, 0, 35], ["+", 75, 57, 75, 196, 0, 57, 64, 196, 0, 46]]
8
392
33
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Numerics; public class MainClass { public const long Giri = 1000000007; public const long DpInf = 99999999999999; public static void Main(string[] args) { var p = Input().ToInt(); var d = p[0]; var n = p[1]; long q = (long)Math.Pow(100, d); Console.WriteLine(q * n); } static long GCD(long a, long b) { var v = new[] { a, b }; while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; } return v[0]; } public static string[] Input() { return Console.ReadLine().Split(); } } public static class Smarter { public static int ToInt(this string str) { return int.Parse(str); } public static long ToLong(this string str) { return long.Parse(str); } public static int[] ToInt(this string[] str, int offset = 0) { var r = new int[str.Length]; for (int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset; return r; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Numerics; public class MainClass { public const long Giri = 1000000007; public const long DpInf = 99999999999999; public static void Main(string[] args) { var p = Input().ToInt(); var d = p[0]; var n = p[1]; long q = (long)Math.Pow(100, d); if (n == 100) { Console.WriteLine(q * 101); } else Console.WriteLine(q * n); } static long GCD(long a, long b) { var v = new[] { a, b }; while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; } return v[0]; } public static string[] Input() { return Console.ReadLine().Split(); } } public static class Smarter { public static int ToInt(this string str) { return int.Parse(str); } public static long ToLong(this string str) { return long.Parse(str); } public static int[] ToInt(this string[] str, int offset = 0) { var r = new int[str.Length]; for (int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset; return r; } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 64, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 48], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203], ["+", 64, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95]]
8
301
18
using System; using System.Collections.Generic; using System.Linq; using System.Text; public class MainClass { public const long Giri = 1000000007; public static void Main(string[] args) { var p = Input(); var d = p[0].ToInt(); var n = p[1].ToInt(); Console.WriteLine(Math.Pow(100, d) * n); } static long GCD(long a, long b) { var v = new[] { a, b }; while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; } return v[0]; } public static string[] Input() { return Console.ReadLine().Split(' '); } public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); } } public static class Smarter { public static int ToInt(this string str) { return int.Parse(str); } public static long ToLong(this string str) { return long.Parse(str); } public static int[] ToInt(this string[] str) { var r = new int[str.Length]; for (int i = 0; i < str.Length; i++) r[i] = str[i].ToInt(); return r; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; public class MainClass { public const long Giri = 1000000007; public static void Main(string[] args) { var p = Input(); var d = p[0].ToInt(); var n = p[1].ToInt(); if (n < 100) Console.WriteLine(Math.Pow(100, d) * n); else Console.WriteLine(Math.Pow(100, d) * 101); } static long GCD(long a, long b) { var v = new[] { a, b }; while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; } return v[0]; } public static string[] Input() { return Console.ReadLine().Split(' '); } public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); } } public static class Smarter { public static int ToInt(this string str) { return int.Parse(str); } public static long ToLong(this string str) { return long.Parse(str); } public static int[] ToInt(this string[] str) { var r = new int[str.Length]; for (int i = 0; i < str.Length; i++) r[i] = str[i].ToInt(); return r; } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 57, 64, 1, 0, 213, 3, 4, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["+", 0, 57, 75, 1, 0, 213, 63, 214, 205, 22], ["+", 0, 57, 75, 1, 0, 213, 63, 214, 0, 131], ["+", 0, 57, 75, 1, 0, 213, 63, 214, 141, 22], ["+", 0, 57, 75, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 28, 0, 16, 31, 213, 63, 214, 205, 22], ["+", 0, 28, 0, 16, 31, 213, 63, 214, 0, 131], ["+", 0, 28, 0, 16, 31, 213, 63, 214, 141, 22], ["+", 0, 28, 0, 16, 31, 213, 3, 4, 0, 24], ["+", 0, 16, 31, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 28, 0, 16, 31, 213, 3, 4, 0, 21], ["+", 0, 16, 31, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 28, 0, 16, 31, 213, 3, 4, 0, 25], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 48], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
8
316
23
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; namespace AtCoder { public class ABC { static public void Main(string[] args) { Console.SetOut( new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }); Solve(); Console.Out.Flush(); } const int mod = 1000000007; // 10^9+7 static int Mod(long x, int m) { return (int)((x % m + m) % m); } static long Mod(long x, long m) { return (x % m + m) % m; } static public void Solve() { // string s = Console.ReadLine(); // int n = int.Parse(Console.ReadLine()); // long x = long.Parse(Console.ReadLine()); // int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray(); // long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray(); int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray(); int d = vs[0]; int n = vs[1]; int x = 1; for (int i = 0; i < d; i++) { x *= 100; } long ans = x * n; Console.WriteLine(ans); } } }
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; namespace AtCoder { public class ABC { static public void Main(string[] args) { Console.SetOut( new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }); Solve(); Console.Out.Flush(); } const int mod = 1000000007; // 10^9+7 static int Mod(long x, int m) { return (int)((x % m + m) % m); } static long Mod(long x, long m) { return (x % m + m) % m; } static public void Solve() { // string s = Console.ReadLine(); // int n = int.Parse(Console.ReadLine()); // long x = long.Parse(Console.ReadLine()); // int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray(); // long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray(); int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray(); int d = vs[0]; int n = vs[1]; long x = 1; for (int i = 0; i < d; i++) { x *= 100; } long ans = n * x + n / 100 * x; Console.WriteLine(ans); } } }
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 198, 0, 200, 0, 212, 0, 16, 31, 22], ["+", 0, 200, 0, 212, 0, 16, 31, 16, 31, 22], ["+", 0, 200, 0, 212, 0, 16, 31, 16, 12, 22], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 72], ["+", 0, 212, 0, 16, 12, 16, 31, 16, 17, 85], ["+", 0, 212, 0, 16, 12, 16, 31, 16, 12, 203], ["+", 0, 200, 0, 212, 0, 16, 12, 16, 17, 48], ["+", 0, 200, 0, 212, 0, 16, 12, 16, 12, 22]]
8
230
10
using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; 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; } void Omame() { cin = new Scanner(); int D = cin.nextInt(); int N = cin.nextInt(); int x = 1; if (D == 1) { x *= 100; } else if (D == 2) { x *= 10000; } long ans = 0; for (int i = 0; i < N; i++) { ans += x; } Console.WriteLine(ans); } } }
using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; 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; } void Omame() { cin = new Scanner(); int D = cin.nextInt(); int N = cin.nextInt(); int x = 1; if (D == 1) { x *= 100; } else if (D == 2) { x *= 10000; } long ans = x * N; if (N == 100) ans += x; Console.WriteLine(ans); } } }
[["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 31, 22], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 48], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 22], ["-", 8, 201, 0, 195, 8, 196, 0, 7, 0, 88], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["-", 0, 195, 8, 196, 0, 7, 10, 198, 39, 199], ["-", 8, 196, 0, 7, 10, 198, 0, 200, 141, 22], ["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 32], ["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["-", 8, 201, 0, 195, 8, 196, 0, 7, 0, 35], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 31, 22], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["-", 0, 195, 8, 196, 0, 7, 26, 223, 0, 22], ["-", 0, 195, 8, 196, 0, 7, 26, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["-", 0, 195, 8, 196, 0, 7, 8, 196, 0, 45], ["-", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46]]
8
588
20
using System; using System.Linq; public class Program { static void Main() { long[] input = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse); long d = input[0]; long n = input[1]; long ans = 1; if (d == 0) Console.WriteLine(n != 100 ? n : n + 1); else Console.WriteLine(n != 100 ? Math.Pow(100, d) * n : Math.Pow(100, d) * n + 1); } }
using System; using System.Linq; public class Program { static void Main() { long[] input = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse); long d = input[0]; long n = input[1]; if (d == 0) Console.WriteLine(n != 100 ? n : n + 1); else Console.WriteLine(n != 100 ? Math.Pow(100, d) * n : Math.Pow(100, d) * (n + 1)); } }
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["-", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["+", 0, 28, 0, 41, 75, 16, 12, 23, 0, 24], ["+", 0, 28, 0, 41, 75, 16, 12, 23, 0, 25]]
8
123
7
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; namespace B { public class Program { static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); Solve(); Console.Out.Flush(); } public static void Solve() { var dn = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray(); var d = dn[0]; var n = dn[1]; Console.WriteLine(Math.Pow(100, d) * n + (n == 100 ? 1 : 0)); } } }
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; namespace B { public class Program { static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); Solve(); Console.Out.Flush(); } public static void Solve() { var dn = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray(); var d = dn[0]; var n = dn[1]; Console.WriteLine((long)Math.Pow(100, d) * (n < 100 ? n : 101)); } } }
[["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 31, 74, 0, 25], ["-", 3, 4, 0, 28, 0, 16, 31, 16, 12, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["-", 0, 16, 12, 23, 0, 41, 15, 16, 17, 60], ["+", 0, 16, 12, 23, 0, 41, 15, 16, 17, 18], ["-", 0, 28, 0, 16, 12, 23, 0, 41, 64, 203], ["+", 0, 28, 0, 16, 12, 23, 0, 41, 64, 22], ["-", 0, 28, 0, 16, 12, 23, 0, 41, 75, 203], ["+", 0, 28, 0, 16, 12, 23, 0, 41, 75, 203]]
8
163
11
using System; using System.Collections.Generic; using System.Linq; using System.Text; public class AtCoderA { static void Main() { var sc = new Scanner(); int d = sc.NextInt(); int n = sc.NextInt(); int div = d == 0 ? 1 : (d == 1 ? 100 : 10000); int answer = div * n; Console.WriteLine(answer); } class Scanner { private string[] _line; private int _index; private const char Separator = ' '; public Scanner() { _line = new string[0]; _index = 0; } public string Next() { while (_index >= _line.Length) { _line = Console.ReadLine().Split(Separator); _index = 0; } return _line[_index++]; } public int NextInt() => int.Parse(Next()); public long NextLong() => long.Parse(Next()); public double NextDouble() => double.Parse(Next()); public decimal NextDecimal() => decimal.Parse(Next()); public char NextChar() => Next()[0]; public char[] NextCharArray() => Next().ToCharArray(); public string[] Array() { _line = Console.ReadLine().Split(Separator); _index = _line.Length; return _line; } public int[] IntArray() => Array().Select(int.Parse).ToArray(); public long[] LongArray() => Array().Select(long.Parse).ToArray(); public double[] DoubleArray() => Array().Select(double.Parse).ToArray(); public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray(); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; public class AtCoderA { static void Main() { var sc = new Scanner(); int d = sc.NextInt(); int n = sc.NextInt(); int div = d == 0 ? 1 : (d == 1 ? 100 : 10000); int answer = div * n; if (n == 100) { answer += div; } Console.WriteLine(answer); } class Scanner { private string[] _line; private int _index; private const char Separator = ' '; public Scanner() { _line = new string[0]; _index = 0; } public string Next() { while (_index >= _line.Length) { _line = Console.ReadLine().Split(Separator); _index = 0; } return _line[_index++]; } public int NextInt() => int.Parse(Next()); public long NextLong() => long.Parse(Next()); public double NextDouble() => double.Parse(Next()); public decimal NextDecimal() => decimal.Parse(Next()); public char NextChar() => Next()[0]; public char[] NextCharArray() => Next().ToCharArray(); public string[] Array() { _line = Console.ReadLine().Split(Separator); _index = _line.Length; return _line; } public int[] IntArray() => Array().Select(int.Parse).ToArray(); public long[] LongArray() => Array().Select(long.Parse).ToArray(); public double[] DoubleArray() => Array().Select(double.Parse).ToArray(); public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray(); } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 107], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 22], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
8
385
12
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 d = cin.nextLong(); var n = cin.nextLong(); Console.WriteLine(Math.Pow(100, d) * n); } } public static partial class MathEx { public static int GCD(int n, int m) { return (int)GCD((long)n, m); } public static long GCD(long n, long m) { n = Math.Abs(n); m = Math.Abs(m); while (n != 0) { m %= n; if (m == 0) return n; n %= m; } return m; } public static long LCM(long n, long m) { return (n / GCD(n, m)) * m; } public static bool[] Sieve(int max, List<int> primes = null) { var isPrime = new bool[max + 1]; for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true; for (int i = 2; i * i <= max; i++) if (!isPrime[i]) continue; else for (int j = i * i; j <= max; j += i) isPrime[j] = false; if (primes != null) for (int i = 0; i <= max; i++) if (isPrime[i]) primes.Add(i); return isPrime; } public static bool IsPrime(int num) { if (num < 2) return false; else if (num == 2) return true; else if (num % 2 == 0) return false; double sqrtNum = Math.Sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { return false; } } return true; } private static readonly List<int> facs = new List<int> { 1 }; public static int Fac(int n) { for (int i = facs.Count; i <= n; ++i) { facs.Add((int)(Math.BigMul(facs.Last(), i) % 1000000007)); } return facs[n]; } public static int Ncr(int n, int r) { return (n < r) ? 0 : (n == r) ? 1 : Fac(n) / (Fac(r) * Fac(n - r)); } } 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 d = cin.nextLong(); var n = cin.nextLong(); var s = 1; for (int i = 0; i < d; i++) s *= 100; Console.WriteLine(n <= 99 ? s * n : s * 101); } } public static partial class MathEx { public static int GCD(int n, int m) { return (int)GCD((long)n, m); } public static long GCD(long n, long m) { n = Math.Abs(n); m = Math.Abs(m); while (n != 0) { m %= n; if (m == 0) return n; n %= m; } return m; } public static long LCM(long n, long m) { return (n / GCD(n, m)) * m; } public static bool[] Sieve(int max, List<int> primes = null) { var isPrime = new bool[max + 1]; for (int i = 2; i < isPrime.Length; i++) isPrime[i] = true; for (int i = 2; i * i <= max; i++) if (!isPrime[i]) continue; else for (int j = i * i; j <= max; j += i) isPrime[j] = false; if (primes != null) for (int i = 0; i <= max; i++) if (isPrime[i]) primes.Add(i); return isPrime; } public static bool IsPrime(int num) { if (num < 2) return false; else if (num == 2) return true; else if (num % 2 == 0) return false; double sqrtNum = Math.Sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { return false; } } return true; } private static readonly List<int> facs = new List<int> { 1 }; public static int Fac(int n) { for (int i = facs.Count; i <= n; ++i) { facs.Add((int)(Math.BigMul(facs.Last(), i) % 1000000007)); } return facs[n]; } public static int Ncr(int n, int r) { return (n < r) ? 0 : (n == r) ? 1 : Fac(n) / (Fac(r) * Fac(n - r)); } } 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(); } }
[["+", 8, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["+", 8, 201, 0, 195, 8, 196, 0, 7, 0, 88], ["+", 8, 201, 0, 195, 8, 196, 0, 7, 0, 24], ["+", 0, 195, 8, 196, 0, 7, 10, 198, 39, 199], ["+", 8, 196, 0, 7, 10, 198, 0, 200, 141, 22], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 32], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 7, 0, 35], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 195, 8, 196, 0, 7, 26, 223, 0, 22], ["+", 0, 195, 8, 196, 0, 7, 26, 223, 0, 29], ["+", 8, 201, 0, 195, 8, 196, 0, 7, 0, 25], ["+", 8, 196, 0, 7, 8, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 1, 0, 11, 0, 202, 0, 108], ["+", 8, 196, 0, 7, 8, 1, 0, 11, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 8, 1, 0, 35], ["-", 0, 28, 0, 16, 31, 213, 63, 214, 205, 22], ["-", 0, 28, 0, 16, 31, 213, 63, 214, 0, 131], ["-", 0, 28, 0, 16, 31, 213, 63, 214, 141, 22], ["-", 0, 28, 0, 16, 31, 213, 3, 4, 0, 24], ["-", 0, 16, 31, 213, 3, 4, 0, 28, 0, 203], ["-", 0, 28, 0, 16, 31, 213, 3, 4, 0, 21], ["-", 0, 16, 31, 213, 3, 4, 0, 28, 0, 22], ["-", 0, 28, 0, 16, 31, 213, 3, 4, 0, 25], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 31, 22], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 19], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 12, 203], ["+", 0, 213, 3, 4, 0, 28, 0, 41, 0, 101], ["+", 3, 4, 0, 28, 0, 41, 64, 16, 31, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 41, 0, 102], ["+", 3, 4, 0, 28, 0, 41, 75, 16, 31, 22], ["+", 3, 4, 0, 28, 0, 41, 75, 16, 17, 48], ["+", 3, 4, 0, 28, 0, 41, 75, 16, 12, 203]]
8
1,045
40
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 d = int.Parse(spl[0]); var n = int.Parse(spl[1]); if (d == 0) { if (n == 100) return 101; return n; } return Pow(100, d) * n; } static long Pow(long x, long n) { long ans = 1; while (n > 0) { if (n % 2 == 1) { ans = ans * x; } x = x * x; n /= 2; } return ans; } static long[] ToIntArray(string strs, int n) { var ret = new long[n]; var spl = strs.Split(' '); for (int i = 0; i < n; i++) ret[i] = long.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 d = int.Parse(spl[0]); var n = int.Parse(spl[1]); if (d == 0) { if (n == 100) return 101; return n; } if (n == 100) n++; return Pow(100, d) * n; } static long Pow(long x, long n) { long ans = 1; while (n > 0) { if (n % 2 == 1) { ans = ans * x; } x = x * x; n /= 2; } return ans; } static long[] ToIntArray(string strs, int n) { var ret = new long[n]; var spl = strs.Split(' '); for (int i = 0; i < n; i++) ret[i] = long.Parse(spl[i]); return ret; } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 22], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35]]
8
317
9
using System; using System.Collections.Generic; using System.Linq; class Progaram { static void Main(string[] args) { var l = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); var d = l[0]; var n = l[1]; long res; if (d == 0) { res = 1; } else if (d == 1) { res = 100; } else { res = 10000; } Console.WriteLine(res * n); } }
using System; using System.Collections.Generic; using System.Linq; class Progaram { static void Main(string[] args) { var l = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); var d = l[0]; var n = l[1]; long res; if (d == 0) { res = 1; } else if (d == 1) { res = 100; } else { res = 10000; } if (n == 100) n++; Console.WriteLine(res * n); } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 22], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35]]
8
122
9
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp15 { class Class118 { static void Main() { var DN = Console.ReadLine().Split().Select(int.Parse); int D = DN.First(), N = DN.Last(); int ans = (int)Math.Pow(100, D) * N; Console.WriteLine(ans); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp15 { class Class118 { static void Main() { var DN = Console.ReadLine().Split().Select(int.Parse); int D = DN.First(), N = DN.Last(); if (N == 100) N++; int ans = (int)Math.Pow(100, D) * N; Console.WriteLine(ans); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 22], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35]]
8
103
9
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using static kyoupuro.Input; using static kyoupuro.MyMath; using static kyoupuro.Modular; namespace kyoupuro { class MainClass { public static void Main() { int D = NextInt, N = NextInt; long div = (long)Math.Pow(100, D); Console.WriteLine(div * N); } } class MyMath { public static long Gcd(long a, long b) { return b == 0 ? a : Gcd(b, a % b); } public static long Sqrt(long n) { if (n < 0) return 0; long a = 0, tmp = 0, b = 0; for (int i = 62; i >= 0; i -= 2) { tmp = (b << 1) + 1 <= (n >> i) ? 1 : 0; a = a << 1 | tmp; n -= (((b << 1) + 1) * tmp) << i; b = (b << 1) + tmp + tmp; } return a; } public static long Nck(int n, int k) { if (k == 0) return 1; if (n == 0) return 0; return n * Nck(n - 1, k - 1) / k; } } class Modular { public const int mod = 1000000007; public readonly long value; public Modular(long value) { this.value = value; } public static implicit operator Modular(long a) { var m = a % mod; return new Modular((m < 0) ? m + mod : m); } public static Modular operator +(Modular a, Modular b) { return a.value + b.value; } public static Modular operator -(Modular a, Modular b) { return a.value - b.value; } public static Modular operator *(Modular a, Modular b) { return a.value * b.value; } private static Modular Pow(Modular a, int n) { switch (n) { case 0: return 1; case 1: return a; default: var p = Pow(a, n / 2); return p * p * Pow(a, n % 2); } } public static Modular operator /(Modular a, Modular b) { return a * Pow(b, mod - 2); } private static readonly List<int> facs = new List<int> { 1 }; private static Modular Fac(int n) { for (int i = facs.Count; i <= n; ++i) { facs.Add((int)(Math.BigMul(facs.Last(), i) % mod)); } return facs[n]; } public static Modular Ncr(int n, int r) { return (n < r) ? 0 : (n == r) ? 1 : Fac(n) / (Fac(r) * Fac(n - r)); } public static explicit operator int(Modular a) { return (int)a.value; } } public class PriorityQueue<T> { readonly List<T> _heap = new List<T>(); readonly Comparison<T> _comparison; public PriorityQueue(Comparison<T> comparison) { _comparison = comparison; } public PriorityQueue() : this(Comparer<T>.Default.Compare) {} public PriorityQueue(IComparer<T> comparer) : this(comparer.Compare) {} public void Enqueue(T item) { _heap.Add(item); int childID = _heap.Count - 1; int parentID = (childID - 1) / 2; while (childID > 0 && _comparison(_heap[parentID], _heap[childID]) > 0) { Swap(parentID, childID); childID = parentID; parentID = (parentID - 1) / 2; } } public T Dequeue() { var first = _heap.First(); _heap[0] = _heap.Last(); _heap.RemoveAt(_heap.Count - 1); int parentID = 0; int childID = parentID * 2 + 2; if (childID >= _heap.Count || _comparison(_heap[childID], _heap[childID - 1]) > 0) childID--; while (childID < _heap.Count && _comparison(_heap[parentID], _heap[childID]) > 0) { Swap(parentID, childID); parentID = childID; childID = parentID * 2 + 2; if (childID >= _heap.Count || _comparison(_heap[childID], _heap[childID - 1]) > 0) childID--; } return first; } void Swap(int parent, int child) { var tmp = _heap[parent]; _heap[parent] = _heap[child]; _heap[child] = tmp; } public T Peek() { return _heap[0]; } public int Count => _heap.Count; public bool Any() { return _heap.Any(); } public List<T> Data => _heap; } public class UnionFind { public int[] Parents { get; set; } public UnionFind(int size) { Parents = Enumerable.Repeat(-1, size).ToArray(); } public int Find(int num) { if (Parents[num] < 0) return num; Parents[num] = Find(Parents[num]); return Parents[num]; } public int Size(int num) { return -Parents[Find(num)]; } public bool Same(int a, int b) { return Find(a) == Find(b); } public void Unite(int a, int b) { int x = Find(a), y = Find(b); if (Size(x) > Size(y)) { Parents[x] += Parents[y]; Parents[y] = x; } else { Parents[y] += Parents[x]; Parents[x] = y; } } } class Input { static IEnumerator<string> enumerator = new string[] {}.AsEnumerable().GetEnumerator(); public static string Line => Console.ReadLine(); public static string[] StrArr => Line.Split(' '); public static int NextInt => int.Parse(NextWord()); public static long NextLong => long.Parse(NextWord()); public static List<int> IntList => StrArr.Select(int.Parse).ToList(); public static List<long> LongList => StrArr.Select(long.Parse).ToList(); public static string NextWord() { while (!enumerator.MoveNext()) { enumerator = StrArr.AsEnumerable().GetEnumerator(); } return enumerator.Current; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using static kyoupuro.Input; using static kyoupuro.MyMath; using static kyoupuro.Modular; namespace kyoupuro { class MainClass { public static void Main() { int D = NextInt, N = NextInt; long div = (long)Math.Pow(100, D); if (N == 100) { Console.WriteLine(div * (N + 1)); } else { Console.WriteLine(div * N); } } } class MyMath { public static long Gcd(long a, long b) { return b == 0 ? a : Gcd(b, a % b); } public static long Sqrt(long n) { if (n < 0) return 0; long a = 0, tmp = 0, b = 0; for (int i = 62; i >= 0; i -= 2) { tmp = (b << 1) + 1 <= (n >> i) ? 1 : 0; a = a << 1 | tmp; n -= (((b << 1) + 1) * tmp) << i; b = (b << 1) + tmp + tmp; } return a; } public static long Nck(int n, int k) { if (k == 0) return 1; if (n == 0) return 0; return n * Nck(n - 1, k - 1) / k; } } class Modular { public const int mod = 1000000007; public readonly long value; public Modular(long value) { this.value = value; } public static implicit operator Modular(long a) { var m = a % mod; return new Modular((m < 0) ? m + mod : m); } public static Modular operator +(Modular a, Modular b) { return a.value + b.value; } public static Modular operator -(Modular a, Modular b) { return a.value - b.value; } public static Modular operator *(Modular a, Modular b) { return a.value * b.value; } private static Modular Pow(Modular a, int n) { switch (n) { case 0: return 1; case 1: return a; default: var p = Pow(a, n / 2); return p * p * Pow(a, n % 2); } } public static Modular operator /(Modular a, Modular b) { return a * Pow(b, mod - 2); } private static readonly List<int> facs = new List<int> { 1 }; private static Modular Fac(int n) { for (int i = facs.Count; i <= n; ++i) { facs.Add((int)(Math.BigMul(facs.Last(), i) % mod)); } return facs[n]; } public static Modular Ncr(int n, int r) { return (n < r) ? 0 : (n == r) ? 1 : Fac(n) / (Fac(r) * Fac(n - r)); } public static explicit operator int(Modular a) { return (int)a.value; } } public class PriorityQueue<T> { readonly List<T> _heap = new List<T>(); readonly Comparison<T> _comparison; public PriorityQueue(Comparison<T> comparison) { _comparison = comparison; } public PriorityQueue() : this(Comparer<T>.Default.Compare) {} public PriorityQueue(IComparer<T> comparer) : this(comparer.Compare) {} public void Enqueue(T item) { _heap.Add(item); int childID = _heap.Count - 1; int parentID = (childID - 1) / 2; while (childID > 0 && _comparison(_heap[parentID], _heap[childID]) > 0) { Swap(parentID, childID); childID = parentID; parentID = (parentID - 1) / 2; } } public T Dequeue() { var first = _heap.First(); _heap[0] = _heap.Last(); _heap.RemoveAt(_heap.Count - 1); int parentID = 0; int childID = parentID * 2 + 2; if (childID >= _heap.Count || _comparison(_heap[childID], _heap[childID - 1]) > 0) childID--; while (childID < _heap.Count && _comparison(_heap[parentID], _heap[childID]) > 0) { Swap(parentID, childID); parentID = childID; childID = parentID * 2 + 2; if (childID >= _heap.Count || _comparison(_heap[childID], _heap[childID - 1]) > 0) childID--; } return first; } void Swap(int parent, int child) { var tmp = _heap[parent]; _heap[parent] = _heap[child]; _heap[child] = tmp; } public T Peek() { return _heap[0]; } public int Count => _heap.Count; public bool Any() { return _heap.Any(); } public List<T> Data => _heap; } public class UnionFind { public int[] Parents { get; set; } public UnionFind(int size) { Parents = Enumerable.Repeat(-1, size).ToArray(); } public int Find(int num) { if (Parents[num] < 0) return num; Parents[num] = Find(Parents[num]); return Parents[num]; } public int Size(int num) { return -Parents[Find(num)]; } public bool Same(int a, int b) { return Find(a) == Find(b); } public void Unite(int a, int b) { int x = Find(a), y = Find(b); if (Size(x) > Size(y)) { Parents[x] += Parents[y]; Parents[y] = x; } else { Parents[y] += Parents[x]; Parents[x] = y; } } } class Input { static IEnumerator<string> enumerator = new string[] {}.AsEnumerable().GetEnumerator(); public static string Line => Console.ReadLine(); public static string[] StrArr => Line.Split(' '); public static int NextInt => int.Parse(NextWord()); public static long NextLong => long.Parse(NextWord()); public static List<int> IntList => StrArr.Select(int.Parse).ToList(); public static List<long> LongList => StrArr.Select(long.Parse).ToList(); public static string NextWord() { while (!enumerator.MoveNext()) { enumerator = StrArr.AsEnumerable().GetEnumerator(); } return enumerator.Current; } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 64, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 48], ["+", 3, 4, 0, 28, 0, 16, 12, 23, 0, 24], ["+", 0, 28, 0, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 28, 0, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 28, 0, 16, 12, 23, 0, 16, 12, 203], ["+", 3, 4, 0, 28, 0, 16, 12, 23, 0, 25], ["+", 64, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 46]]
8
1,398
24
using System; using System.Linq; using System.Collections.Generic; using static System.Console; using static System.Math; public class Hello { public static void Main() { string[] input = ReadLine().Split(' '); long n = long.Parse(input[0]); long m = long.Parse(input[1]); // int kazu = int.Parse(ReadLine()); // string[,] map = new string[kazu,kazu]; for (int i = 0; i < n; i++) { m *= 100; } WriteLine(m); } }
using System; using System.Linq; using System.Collections.Generic; using static System.Console; using static System.Math; public class Hello { public static void Main() { string[] input = ReadLine().Split(' '); long n = long.Parse(input[0]); long m = long.Parse(input[1]); if (m == 100) { m++; } // int kazu = int.Parse(ReadLine()); // string[,] map = new string[kazu,kazu]; for (int i = 0; i < n; i++) { m *= 100; } WriteLine(m); } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 29], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
8
109
11
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 = 1 * Math.Pow(100, str[0]) * str[1]; Console.WriteLine(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(); if (str[1] == 100) { str[1]++; } var ans = 1 * Math.Pow(100, str[0]) * str[1]; Console.WriteLine(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 + " "); } } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 8, 196, 0, 57, 15, 16, 31, 204, 205, 22], ["+", 0, 57, 15, 16, 31, 204, 206, 207, 0, 70], ["+", 15, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 57, 15, 16, 31, 204, 206, 207, 0, 73], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 64, 196, 0, 1, 0, 223, 0, 204, 205, 22], ["+", 0, 1, 0, 223, 0, 204, 206, 207, 0, 70], ["+", 0, 223, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 1, 0, 223, 0, 204, 206, 207, 0, 73], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 29], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
8
330
17
using System; using System.Linq; using System.Collections.Generic; using static program.Input; using static program.MyMath; using static System.Console; namespace program { class Program { static string Alp = "abcdefghijklmnopqrstuvwxyz"; static void Main() { var input = ScanIntArray(); var d = input[0]; var n = input[1]; int A = 1; for (int i = 0; i < d; i++) A *= 100; WriteLine(A * n); } } static class Input { static public int ScanInt() { return int.Parse(Console.ReadLine()); } static public uint ScanUint() { return uint.Parse(Console.ReadLine()); } static public double ScanDouble() { return double.Parse(Console.ReadLine()); } static public long ScanLong() { return long.Parse(Console.ReadLine()); } static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); } static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); } static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); } static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); } static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); } static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); } static public string ScanStr() { return Console.ReadLine(); } static public string[] ScanStrArray() { return ScanStr().Split(); } } static class MyMath { public static int GCD(int a, int b) { Func<int, int, int> gcd = null; gcd = (x, y) => y == 0 ? x : gcd(y, x % y); return a > b ? gcd(a, b) : gcd(b, a); } public static long GCD(long a, long b) { Func<long, long, long> gcd = null; gcd = (x, y) => y == 0 ? x : gcd(y, x % y); return a > b ? gcd(a, b) : gcd(b, a); } public static ulong extGCD(ulong a, ulong b, ref ulong x, ref ulong y) { if (b == 0) { x = 1; y = 0; return a; } var d = extGCD(b, a % b, ref y, ref x); y -= a / b * x; return d; } public static int LCM(int a, int b) { return a * b / GCD(a, b); } public static long LCM(long a, long b) { return a * b / GCD(a, b); } } }
using System; using System.Linq; using System.Collections.Generic; using static program.Input; using static program.MyMath; using static System.Console; namespace program { class Program { static string Alp = "abcdefghijklmnopqrstuvwxyz"; static void Main() { var input = ScanIntArray(); var d = input[0]; var n = input[1]; int A = 1; for (int i = 0; i < d; i++) A *= 100; int res = A * n; if (n == 100) res += A; WriteLine(res); } } static class Input { static public int ScanInt() { return int.Parse(Console.ReadLine()); } static public uint ScanUint() { return uint.Parse(Console.ReadLine()); } static public double ScanDouble() { return double.Parse(Console.ReadLine()); } static public long ScanLong() { return long.Parse(Console.ReadLine()); } static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); } static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); } static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); } static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); } static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); } static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); } static public string ScanStr() { return Console.ReadLine(); } static public string[] ScanStrArray() { return ScanStr().Split(); } } static class MyMath { public static int GCD(int a, int b) { Func<int, int, int> gcd = null; gcd = (x, y) => y == 0 ? x : gcd(y, x % y); return a > b ? gcd(a, b) : gcd(b, a); } public static long GCD(long a, long b) { Func<long, long, long> gcd = null; gcd = (x, y) => y == 0 ? x : gcd(y, x % y); return a > b ? gcd(a, b) : gcd(b, a); } public static ulong extGCD(ulong a, ulong b, ref ulong x, ref ulong y) { if (b == 0) { x = 1; y = 0; return a; } var d = extGCD(b, a % b, ref y, ref x); y -= a / b * x; return d; } public static int LCM(int a, int b) { return a * b / GCD(a, b); } public static long LCM(long a, long b) { return a * b / GCD(a, b); } } }
[["-", 0, 195, 8, 196, 0, 1, 0, 213, 63, 22], ["-", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["+", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 0, 202, 0, 107], ["+", 8, 196, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 1, 0, 213, 63, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
8
691
19
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using Console = System.Console; namespace Atcoder { class Program { static void Main(string[] args) { var firstLine = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); var D = firstLine[0]; var N = firstLine[1]; var tmp = Math.Pow(100, D); Console.WriteLine(tmp * N); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using Console = System.Console; namespace Atcoder { class Program { static void Main(string[] args) { var firstLine = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); var D = firstLine[0]; var N = firstLine[1]; var tmp = Math.Pow(100, D); if (N == 100) { N++; } Console.WriteLine(tmp * N); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 29], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
8
112
11
using System; using System.Collections.Generic; using System.Linq; using System.Text; using static System.Console; using static System.Math; namespace AtTest.NothingToLearn { class ABC100_B { static void Main(string[] args) { var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false }; SetOut(sw); Method(args); Out.Flush(); } static void Method(string[] args) { int[] dn = ReadInts(); WriteLine(Pow(100, dn[0]) * dn[1]); } private static string Read() { return ReadLine(); } private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); } 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 AtTest.NothingToLearn { class ABC100_B { static void Main(string[] args) { var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false }; SetOut(sw); Method(args); Out.Flush(); } static void Method(string[] args) { int[] dn = ReadInts(); int res = (int)Pow(100, dn[0]) * dn[1]; if (dn[1] == 100) { res += (int)Pow(100, dn[0]); } WriteLine(res); } private static string Read() { return ReadLine(); } private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); } 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, 1, 0, 213, 63, 22], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["+", 0, 200, 0, 212, 0, 16, 31, 74, 39, 199], ["+", 0, 200, 0, 212, 0, 16, 31, 74, 0, 25], ["+", 0, 200, 0, 212, 0, 16, 12, 204, 205, 22], ["+", 0, 212, 0, 16, 12, 204, 206, 207, 0, 70], ["+", 0, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 212, 0, 16, 12, 204, 206, 207, 0, 73], ["+", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 57, 15, 16, 31, 204, 206, 207, 0, 73], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 107], ["+", 64, 196, 0, 1, 0, 11, 12, 74, 0, 24], ["+", 64, 196, 0, 1, 0, 11, 12, 74, 39, 199], ["+", 64, 196, 0, 1, 0, 11, 12, 74, 0, 25], ["+", 0, 1, 0, 11, 12, 74, 51, 213, 63, 22], ["+", 0, 11, 12, 74, 51, 213, 3, 4, 0, 24], ["+", 12, 74, 51, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 11, 12, 74, 51, 213, 3, 4, 0, 21], ["+", 51, 213, 3, 4, 0, 28, 0, 204, 205, 22], ["+", 3, 4, 0, 28, 0, 204, 206, 207, 0, 70], ["+", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 11, 12, 74, 51, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 0, 195, 8, 196, 0, 1, 0, 213, 63, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
8
309
36
namespace AtCoder.ABC.B100 { using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.IO; using AtCoder.ABC.IO; public class B100 { public void Solve(Parser parser, Printer printer) { int d = parser.Integer(); int n = parser.Integer(); var got = Solve(d, n); printer.Write(got); printer.WriteLine(); printer.Flush(); } private int Solve(int d, int n) { switch (d) { case 0: return n; case 1: return 100 * n; case 2: return 10000 * n; default: return -1; } } } static class Program { static void Main(string[] args) { var i = new Parser(Console.OpenStandardInput()); var o = new Printer(Console.OpenStandardOutput()); new B100().Solve(i, o); } } } namespace AtCoder.ABC.IO { #region IO using System; using System.IO; using System.Text; using System.Linq; using System.Collections.Generic; using System.Globalization; public class Parser { public Parser(Stream stream) { str = stream; } public readonly Stream str; private readonly byte[] buf = new byte[1024]; private int len, ptr; public bool isEof; public bool IsEndOfStream { get { return isEof; } } public IEnumerable<Parser> Take(int n) { return Enumerable.Range(1, n).Select(_ => this); } private byte read() { if (isEof) return 0; if (ptr < len) return buf[ptr++]; ptr = 0; if ((len = str.Read(buf, 0, 1024)) > 0) return buf[ptr++]; isEof = true; return 0; } public char Char() { byte b; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; } public string Scan() { var sb = new StringBuilder(); for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b); return sb.ToString(); } public string ScanLine() { var sb = new StringBuilder(); for (var b = Char(); b != '\n'; b = (char)read()) if (b == 0) break; else if (b != '\r') sb.Append(b); return sb.ToString(); } public long Long() { if (isEof) return long.MinValue; long ret = 0; byte b; var ng = false; do b = read(); while (b != 0 && b != '-' && (b < '0' || '9' < b)); if (b == 0) return long.MinValue; if (b == '-') { ng = true; b = read(); } for (;; b = read()) { if (b < '0' || '9' < b) return ng ? -ret : ret; ret = ret * 10 + b - '0'; } } public int Integer() { return (isEof) ? int.MinValue : (int)Long(); } public double Double() { var s = Scan(); return s != "" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN; } static T[] enumerate<T>(int n, Func<T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; } public char[] Char(int n) { return enumerate(n, Char); } public string[] Scan(int n) { return enumerate(n, Scan); } public double[] Double(int n) { return enumerate(n, Double); } public int[] Integer(int n) { return enumerate(n, Integer); } public long[] Long(int n) { return enumerate(n, Long); } } public class Printer : StreamWriter { public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) {} public Printer(Stream stream, Encoding encoding) : base(stream, encoding) {} public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); } public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); } } #endregion }
namespace AtCoder.ABC.B100 { using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.IO; using AtCoder.ABC.IO; public class B100 { public void Solve(Parser parser, Printer printer) { int d = parser.Integer(); int n = parser.Integer(); var got = Solve(d, n); printer.Write(got); printer.WriteLine(); printer.Flush(); } private int Solve(int d, int n) { if (n == 100) { n += 1; } switch (d) { case 0: return n; case 1: return 100 * n; case 2: return 10000 * n; default: return -1; } } } static class Program { static void Main(string[] args) { var i = new Parser(Console.OpenStandardInput()); var o = new Printer(Console.OpenStandardOutput()); new B100().Solve(i, o); } } } namespace AtCoder.ABC.IO { #region IO using System; using System.IO; using System.Text; using System.Linq; using System.Collections.Generic; using System.Globalization; public class Parser { public Parser(Stream stream) { str = stream; } public readonly Stream str; private readonly byte[] buf = new byte[1024]; private int len, ptr; public bool isEof; public bool IsEndOfStream { get { return isEof; } } public IEnumerable<Parser> Take(int n) { return Enumerable.Range(1, n).Select(_ => this); } private byte read() { if (isEof) return 0; if (ptr < len) return buf[ptr++]; ptr = 0; if ((len = str.Read(buf, 0, 1024)) > 0) return buf[ptr++]; isEof = true; return 0; } public char Char() { byte b; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; } public string Scan() { var sb = new StringBuilder(); for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b); return sb.ToString(); } public string ScanLine() { var sb = new StringBuilder(); for (var b = Char(); b != '\n'; b = (char)read()) if (b == 0) break; else if (b != '\r') sb.Append(b); return sb.ToString(); } public long Long() { if (isEof) return long.MinValue; long ret = 0; byte b; var ng = false; do b = read(); while (b != 0 && b != '-' && (b < '0' || '9' < b)); if (b == 0) return long.MinValue; if (b == '-') { ng = true; b = read(); } for (;; b = read()) { if (b < '0' || '9' < b) return ng ? -ret : ret; ret = ret * 10 + b - '0'; } } public int Integer() { return (isEof) ? int.MinValue : (int)Long(); } public double Double() { var s = Scan(); return s != "" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN; } static T[] enumerate<T>(int n, Func<T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(); return a; } public char[] Char(int n) { return enumerate(n, Char); } public string[] Scan(int n) { return enumerate(n, Scan); } public double[] Double(int n) { return enumerate(n, Double); } public int[] Integer(int n) { return enumerate(n, Integer); } public long[] Long(int n) { return enumerate(n, Long); } } public class Printer : StreamWriter { public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) {} public Printer(Stream stream, Encoding encoding) : base(stream, encoding) {} public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); } public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); } } #endregion }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 107], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 203], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
8
1,042
12
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABCtest { delegate void Signal(); class Program { static void Main(string[] args) { int D, N; string[] Array = Console.ReadLine().Split(' '); int value; if (Array.Length == 1) return; if (!int.TryParse(Array[0], out D) & !(D == 0 | D == 1 | D == 2)) return; if (!int.TryParse(Array[1], out N) & !(N >= 1 & N <= 100)) return; switch (D) { case 0: Console.WriteLine(N); break; case 1: Console.WriteLine(N * 100); break; case 2: Console.WriteLine(N * 10000); break; } Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABCtest { delegate void Signal(); class Program { static void Main(string[] args) { int D, N; string[] Array = Console.ReadLine().Split(' '); int value; if (Array.Length == 1) return; if (!int.TryParse(Array[0], out D) & !(D == 0 | D == 1 | D == 2)) return; if (!int.TryParse(Array[1], out N) & !(N >= 1 & N <= 100)) return; switch (D) { case 0: Console.WriteLine(N == 100 ? N + 1 : N); break; case 1: Console.WriteLine(N == 100 ? 100 * N + 100 : 100 * N); break; case 2: Console.WriteLine(N == 100 ? 10000 * N + 10000 : 10000 * N); break; default: break; } Console.ReadLine(); } } }
[["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 60], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 12, 203], ["+", 0, 213, 3, 4, 0, 28, 0, 41, 0, 101], ["+", 3, 4, 0, 28, 0, 41, 64, 16, 31, 22], ["+", 3, 4, 0, 28, 0, 41, 64, 16, 17, 72], ["+", 3, 4, 0, 28, 0, 41, 64, 16, 12, 203], ["+", 0, 213, 3, 4, 0, 28, 0, 41, 0, 102], ["+", 0, 213, 3, 4, 0, 28, 0, 41, 75, 22], ["+", 0, 28, 0, 41, 64, 16, 31, 16, 31, 203], ["+", 0, 28, 0, 41, 64, 16, 31, 16, 12, 22], ["+", 3, 4, 0, 28, 0, 41, 75, 16, 17, 48], ["+", 3, 4, 0, 28, 0, 41, 75, 16, 12, 22], ["+", 3, 4, 0, 28, 0, 41, 75, 16, 31, 203], ["+", 0, 99, 8, 254, 0, 239, 0, 93, 0, 94], ["+", 0, 99, 8, 254, 0, 239, 0, 93, 0, 35], ["+", 0, 99, 8, 254, 0, 239, 0, 265, 0, 162], ["+", 0, 99, 8, 254, 0, 239, 0, 265, 0, 102]]
8
202
32
using System; using System.Collections.Generic; using System.Linq; using static Input; public class Prog { public struct Pair { public int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } } public static void Solve() { int D = NextInt(); int N = NextInt(); Console.WriteLine(Math.Pow(100, D) * N); } public static void Main() { var sw = new System.IO.StreamWriter( Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); Solve(); Console.Out.Flush(); } } public class Input { public const long MOD = 1000000007; private static Queue<string> q = new Queue<string>(); private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); } public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); } public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); } public static string NextString() { Confirm(); return q.Dequeue(); } public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); } public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); } public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); } public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); } public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); } }
using System; using System.Collections.Generic; using System.Linq; using static Input; public class Prog { public struct Pair { public int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } } public static void Solve() { int D = NextInt(); int N = NextInt(); Console.WriteLine(Math.Pow(100, D) * (N == 100 ? 101 : N)); } public static void Main() { var sw = new System.IO.StreamWriter( Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); Solve(); Console.Out.Flush(); } } public class Input { public const long MOD = 1000000007; private static Queue<string> q = new Queue<string>(); private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); } public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); } public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); } public static string NextString() { Confirm(); return q.Dequeue(); } public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); } public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); } public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); } public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); } public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); } }
[["+", 3, 4, 0, 28, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 12, 23, 0, 41, 15, 16, 31, 22], ["+", 0, 16, 12, 23, 0, 41, 15, 16, 17, 60], ["+", 0, 16, 12, 23, 0, 41, 15, 16, 12, 203], ["+", 0, 28, 0, 16, 12, 23, 0, 41, 0, 101], ["+", 0, 28, 0, 16, 12, 23, 0, 41, 64, 203], ["+", 0, 28, 0, 16, 12, 23, 0, 41, 0, 102], ["+", 3, 4, 0, 28, 0, 16, 12, 23, 0, 25]]
8
438
8
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(); int N = 0; if (n[0] == 0) N = 1; else if (n[0] == 1) N = 100; else if (n[0] == 2) N = 10000; Console.WriteLine(N * n[1]); } } 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 intRead() { 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(); int N = 0; if (n[0] == 0) N = 1; else if (n[0] == 1) N = 100; else if (n[0] == 2) N = 10000; int ans = N * n[1]; if (n[1] == 100) ans = N * (n[1] + 1); Console.WriteLine(ans); } } 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 intRead() { 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, 1, 0, 213, 63, 214, 205, 22], ["-", 8, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["-", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 31, 22], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 48], ["+", 0, 200, 0, 212, 0, 16, 12, 204, 205, 22], ["+", 0, 212, 0, 16, 12, 204, 206, 207, 0, 70], ["+", 0, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 212, 0, 16, 12, 204, 206, 207, 0, 73], ["+", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 57, 15, 16, 31, 204, 205, 22], ["+", 0, 57, 15, 16, 31, 204, 206, 207, 0, 70], ["+", 15, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 57, 15, 16, 31, 204, 206, 207, 0, 73], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 0, 202, 0, 32], ["+", 64, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 12, 23, 0, 16, 12, 203], ["+", 64, 1, 0, 11, 12, 16, 12, 23, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
8
374
33
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 ABC100B { static public void Solve() { var D = NN; var N = NN; if (D == 0) { Console.WriteLine(N); return; } Console.WriteLine((N - 1) * Pow(100, D)); } //_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // TEST _/ //_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ class BT<T> where T : IComparable { private class Node { public Node left; public Node right; public T val; public bool isBlack; } private Comparison<T> c; private Node root; private bool change; public BT(Comparison<T> _c) { c = _c; } public BT() : this((x, y) => x.CompareTo(y)) {} private bool Red(Node n) => n != null && !n.isBlack; private bool Black(Node n) => n != null && n.isBlack; private Node RotateL(Node n) { Node m = n.right, t = m.left; m.left = n; n.right = t; return m; } private Node RotateR(Node n) { Node m = n.left, t = m.right; m.right = n; n.left = t; return m; } private Node RotateLR(Node n) { n.left = RotateL(n.left); return RotateR(n); } private Node RotateRL(Node n) { n.right = RotateR(n.right); return RotateL(n); } public void Add(T x) { root = Add(root, x); root.isBlack = true; } private Node Add(Node n, T x) { if (n == null) { change = true; return new Node() { val = x }; } var r = c(x, n.val); if (r < 0) { n.left = Add(n.left, x); return Balance(n); } if (r > 0) { n.right = Add(n.right, x); return Balance(n); } change = false; return n; } private Node Balance(Node n) { if (!change) return n; if (!Black(n)) return n; if (Red(n.left) && Red(n.left.left)) { n = RotateR(n); n.left.isBlack = true; } else if (Red(n.left) && Red(n.left.right)) { n = RotateLR(n); n.left.isBlack = true; } else if (Red(n.right) && Red(n.right.left)) { n = RotateRL(n); n.right.isBlack = true; } else if (Red(n.right) && Red(n.right.right)) { n = RotateL(n); n.right.isBlack = true; } else { change = false; } return n; } public void Remove(T x) { root = Remove(root, x); if (root != null) root.isBlack = true; } private Node Remove(Node n, T x) { if (n == null) { change = false; return n; } var r = c(x, n.val); if (r < 0) { n.left = Remove(n.left, x); return BalanceL(n); } if (r > 0) { n.right = Remove(n.right, x); return BalanceR(n); } if (n.left == null) { change = n.isBlack; return n.right; } n.left = RemoveMax(n.left); n.val = lmax; return BalanceL(n); } private T lmax; private Node RemoveMax(Node n) { if (n.right != null) { n.right = RemoveMax(n.right); return BalanceR(n); } lmax = n.val; change = n.isBlack; return n.left; } private Node BalanceL(Node n) { if (!change) return n; if (Black(n.right) && Red(n.right.left)) { var b = n.isBlack; n = RotateRL(n); n.isBlack = b; n.left.isBlack = true; change = false; } else if (Black(n.right) && Red(n.right.right)) { var b = n.isBlack; n = RotateL(n); n.isBlack = b; n.right.isBlack = true; n.left.isBlack = true; change = false; } else if (Black(n.right)) { change = n.isBlack; n.isBlack = true; n.right.isBlack = false; } else { n = RotateL(n); n.isBlack = true; n.left.isBlack = false; n.left = BalanceL(n.left); change = false; } return n; } private Node BalanceR(Node n) { if (!change) return n; if (Black(n.left) && Red(n.left.right)) { var b = n.isBlack; n = RotateLR(n); n.isBlack = b; n.right.isBlack = true; change = false; } else if (Black(n.left) && Red(n.left.left)) { var b = n.isBlack; n = RotateR(n); n.isBlack = b; n.left.isBlack = true; n.right.isBlack = true; change = false; } else if (Black(n.left)) { change = n.isBlack; n.isBlack = true; n.left.isBlack = false; } else { n = RotateR(n); n.isBlack = true; n.right.isBlack = false; n.right = BalanceR(n.right); change = false; } return n; } public Tuple<bool, T> FindUpper(T x) { var v = FindUpper(root, x); if (v == null) return Tuple.Create(false, default(T)); return v; } private Tuple<bool, T> FindUpper(Node n, T x) { if (n == null) return null; var r = c(x, n.val); if (r < 0) { var v = FindUpper(n.left, x); if (v == null) return Tuple.Create(true, n.val); return v; } else if (r > 0) return FindUpper(n.right, x); else return Tuple.Create(true, x); } public Tuple<bool, T> FindLower(T x) { var v = FindLower(root, x); if (v == null) return Tuple.Create(false, default(T)); return v; } private Tuple<bool, T> FindLower(Node n, T x) { if (n == null) return null; var r = c(x, n.val); if (r < 0) return FindLower(n.left, x); else if (r > 0) { var v = FindLower(n.right, x); if (v == null) return Tuple.Create(true, n.val); return v; } else return Tuple.Create(true, x); } public T Min() { Node n = root, p = null; while (n != null) { p = n; n = n.left; } return p == null ? default(T) : p.val; } public T Max() { Node n = root, p = null; while (n != null) { p = n; n = n.right; } return p == null ? default(T) : p.val; } public bool Any() => root != null; public int CountSlow() => List(root).Count(); public IEnumerable<T> List() => List(root); private IEnumerable<T> List(Node n) { if (n == null) yield break; foreach (var i in List(n.left)) yield return i; yield return n.val; foreach (var i in List(n.right)) yield return i; } } //_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // TEST END _/ //_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ 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_ { private 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); class PQ<T> where T : IComparable { private List<T> h; private Comparison<T> c; [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; } public T Peek => h[0]; public int Count => h.Count; [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<TKey, TValue> where TKey : IComparable { private PQ<Tuple<TKey, TValue>> q; [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(int cap, Comparison<TKey> c, bool asc = true) { q = new PQ<Tuple<TKey, TValue>>(cap, (x, y) => c(x.Item1, y.Item1), asc); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(Comparison<TKey> c, bool asc = true) { q = new PQ<Tuple<TKey, TValue>>((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(TKey k, TValue v) => q.Push(Tuple.Create(k, v)); public Tuple<TKey, TValue> Peek => q.Peek; public int Count => q.Count; [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<TKey, TValue> Pop() => q.Pop(); } struct Mod : IEquatable<object> { static public long _mod = 1000000007; private 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 private List<Mod> _fact = new List<Mod>() { 1 }; [MethodImpl(MethodImplOptions.AggressiveInlining)] static private void Build(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) { Build(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]; } } struct Mat<T> { private 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; } } [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 _Build(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) { _Build(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]; } } }
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 ABC100B { static public void Solve() { var D = NN; var N = NN; if (N == 100) { Console.WriteLine((N + 1) * Pow(100, D)); return; } Console.WriteLine(N * Pow(100, D)); } //_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // TEST _/ //_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ class BT<T> where T : IComparable { private class Node { public Node left; public Node right; public T val; public bool isBlack; } private Comparison<T> c; private Node root; private bool change; public BT(Comparison<T> _c) { c = _c; } public BT() : this((x, y) => x.CompareTo(y)) {} private bool Red(Node n) => n != null && !n.isBlack; private bool Black(Node n) => n != null && n.isBlack; private Node RotateL(Node n) { Node m = n.right, t = m.left; m.left = n; n.right = t; return m; } private Node RotateR(Node n) { Node m = n.left, t = m.right; m.right = n; n.left = t; return m; } private Node RotateLR(Node n) { n.left = RotateL(n.left); return RotateR(n); } private Node RotateRL(Node n) { n.right = RotateR(n.right); return RotateL(n); } public void Add(T x) { root = Add(root, x); root.isBlack = true; } private Node Add(Node n, T x) { if (n == null) { change = true; return new Node() { val = x }; } var r = c(x, n.val); if (r < 0) { n.left = Add(n.left, x); return Balance(n); } if (r > 0) { n.right = Add(n.right, x); return Balance(n); } change = false; return n; } private Node Balance(Node n) { if (!change) return n; if (!Black(n)) return n; if (Red(n.left) && Red(n.left.left)) { n = RotateR(n); n.left.isBlack = true; } else if (Red(n.left) && Red(n.left.right)) { n = RotateLR(n); n.left.isBlack = true; } else if (Red(n.right) && Red(n.right.left)) { n = RotateRL(n); n.right.isBlack = true; } else if (Red(n.right) && Red(n.right.right)) { n = RotateL(n); n.right.isBlack = true; } else { change = false; } return n; } public void Remove(T x) { root = Remove(root, x); if (root != null) root.isBlack = true; } private Node Remove(Node n, T x) { if (n == null) { change = false; return n; } var r = c(x, n.val); if (r < 0) { n.left = Remove(n.left, x); return BalanceL(n); } if (r > 0) { n.right = Remove(n.right, x); return BalanceR(n); } if (n.left == null) { change = n.isBlack; return n.right; } n.left = RemoveMax(n.left); n.val = lmax; return BalanceL(n); } private T lmax; private Node RemoveMax(Node n) { if (n.right != null) { n.right = RemoveMax(n.right); return BalanceR(n); } lmax = n.val; change = n.isBlack; return n.left; } private Node BalanceL(Node n) { if (!change) return n; if (Black(n.right) && Red(n.right.left)) { var b = n.isBlack; n = RotateRL(n); n.isBlack = b; n.left.isBlack = true; change = false; } else if (Black(n.right) && Red(n.right.right)) { var b = n.isBlack; n = RotateL(n); n.isBlack = b; n.right.isBlack = true; n.left.isBlack = true; change = false; } else if (Black(n.right)) { change = n.isBlack; n.isBlack = true; n.right.isBlack = false; } else { n = RotateL(n); n.isBlack = true; n.left.isBlack = false; n.left = BalanceL(n.left); change = false; } return n; } private Node BalanceR(Node n) { if (!change) return n; if (Black(n.left) && Red(n.left.right)) { var b = n.isBlack; n = RotateLR(n); n.isBlack = b; n.right.isBlack = true; change = false; } else if (Black(n.left) && Red(n.left.left)) { var b = n.isBlack; n = RotateR(n); n.isBlack = b; n.left.isBlack = true; n.right.isBlack = true; change = false; } else if (Black(n.left)) { change = n.isBlack; n.isBlack = true; n.left.isBlack = false; } else { n = RotateR(n); n.isBlack = true; n.right.isBlack = false; n.right = BalanceR(n.right); change = false; } return n; } public Tuple<bool, T> FindUpper(T x) { var v = FindUpper(root, x); if (v == null) return Tuple.Create(false, default(T)); return v; } private Tuple<bool, T> FindUpper(Node n, T x) { if (n == null) return null; var r = c(x, n.val); if (r < 0) { var v = FindUpper(n.left, x); if (v == null) return Tuple.Create(true, n.val); return v; } else if (r > 0) return FindUpper(n.right, x); else return Tuple.Create(true, x); } public Tuple<bool, T> FindLower(T x) { var v = FindLower(root, x); if (v == null) return Tuple.Create(false, default(T)); return v; } private Tuple<bool, T> FindLower(Node n, T x) { if (n == null) return null; var r = c(x, n.val); if (r < 0) return FindLower(n.left, x); else if (r > 0) { var v = FindLower(n.right, x); if (v == null) return Tuple.Create(true, n.val); return v; } else return Tuple.Create(true, x); } public T Min() { Node n = root, p = null; while (n != null) { p = n; n = n.left; } return p == null ? default(T) : p.val; } public T Max() { Node n = root, p = null; while (n != null) { p = n; n = n.right; } return p == null ? default(T) : p.val; } public bool Any() => root != null; public int CountSlow() => List(root).Count(); public IEnumerable<T> List() => List(root); private IEnumerable<T> List(Node n) { if (n == null) yield break; foreach (var i in List(n.left)) yield return i; yield return n.val; foreach (var i in List(n.right)) yield return i; } } //_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // TEST END _/ //_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ 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_ { private 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); class PQ<T> where T : IComparable { private List<T> h; private Comparison<T> c; [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; } public T Peek => h[0]; public int Count => h.Count; [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<TKey, TValue> where TKey : IComparable { private PQ<Tuple<TKey, TValue>> q; [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(int cap, Comparison<TKey> c, bool asc = true) { q = new PQ<Tuple<TKey, TValue>>(cap, (x, y) => c(x.Item1, y.Item1), asc); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public PQ(Comparison<TKey> c, bool asc = true) { q = new PQ<Tuple<TKey, TValue>>((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(TKey k, TValue v) => q.Push(Tuple.Create(k, v)); public Tuple<TKey, TValue> Peek => q.Peek; public int Count => q.Count; [MethodImpl(MethodImplOptions.AggressiveInlining)] public Tuple<TKey, TValue> Pop() => q.Pop(); } struct Mod : IEquatable<object> { static public long _mod = 1000000007; private 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 private List<Mod> _fact = new List<Mod>() { 1 }; [MethodImpl(MethodImplOptions.AggressiveInlining)] static private void Build(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) { Build(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]; } } struct Mat<T> { private 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; } } [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 _Build(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) { _Build(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]; } } }
[["-", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 3, 4, 0, 28, 0, 16, 31, 23, 0, 24], ["+", 0, 28, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 28, 0, 16, 31, 23, 0, 16, 12, 203], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 48], ["+", 3, 4, 0, 28, 0, 16, 12, 213, 63, 22], ["+", 0, 28, 0, 16, 12, 213, 3, 4, 0, 24], ["+", 0, 16, 12, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 28, 0, 16, 12, 213, 3, 4, 0, 21], ["+", 0, 16, 12, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 28, 0, 16, 12, 213, 3, 4, 0, 25], ["+", 64, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["-", 3, 4, 0, 28, 0, 16, 31, 23, 0, 24], ["-", 0, 28, 0, 16, 31, 23, 0, 16, 17, 33], ["-", 0, 28, 0, 16, 31, 23, 0, 16, 12, 203], ["-", 3, 4, 0, 28, 0, 16, 31, 23, 0, 25]]
8
5,385
19
using System; using System.Collections.Generic; using System.Linq; using static System.Console; using System.Runtime.CompilerServices; using static MyUtil; class MyUtil { public static int[] ReadIntArray() { return ReadLine().Split().Select(x => int.Parse(x)).ToArray(); } } class Program { public static void Main() { var tmp = ReadIntArray(); int d = tmp[0], n = tmp[1]; string ans = n.ToString(); for (int i = 0; i < d; i++) { ans += "00"; } WriteLine(ans); } }
using System; using System.Collections.Generic; using System.Linq; using static System.Console; using System.Runtime.CompilerServices; using static MyUtil; class MyUtil { public static int[] ReadIntArray() { return ReadLine().Split().Select(x => int.Parse(x)).ToArray(); } } class Program { public static void Main() { var tmp = ReadIntArray(); int d = tmp[0], n = tmp[1]; if (n == 100) { n++; } string ans = n.ToString(); for (int i = 0; i < d; i++) { ans += "00"; } WriteLine(ans); } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 29], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
8
141
11
using System; using System.Collections.Generic; using System.Linq; class Procon { public Procon() {} static void Main(string[] agrs) { new Procon().Do(); } Scanner cin; public void Do() { cin = new Scanner(); int D = cin.nextInt(); long N = cin.nextLong(); long ret = 1; for (int i = 0; i < D; i++) { ret *= 100; } Console.WriteLine(ret * N); } } class Scanner { string[] s; int i; int max_i; public Scanner() { s = new string[0]; max_i = 0; i = 0; } public string nextString() { if (i >= s.Length) { s = Console.ReadLine().Split(' '); max_i = s.Length; i = 0; if (max_i == 0) { return ""; } return s[i++]; } else { return s[i++]; } } public int nextInt() { return int.Parse(nextString()); } public long nextLong() { return long.Parse(nextString()); } public double nextDouble() { return double.Parse(nextString()); } public string[] arrayString() { return Console.ReadLine().Split(' '); } public int[] arrayInt() { string[] str = Console.ReadLine().Split(' '); int[] array = new int[str.Length]; for (int i = 0; i < str.Length; i++) { array[i] = int.Parse(str[i]); } return array; } public long[] arrayLong() { string[] str = Console.ReadLine().Split(' '); long[] array = new long[str.Length]; for (int i = 0; i < str.Length; i++) { array[i] = long.Parse(str[i]); } return array; } public double[] arrayDouble() { string[] str = Console.ReadLine().Split(' '); double[] array = new double[str.Length]; for (int i = 0; i < str.Length; i++) { array[i] = double.Parse(str[i]); } return array; } }
using System; using System.Collections.Generic; using System.Linq; class Procon { public Procon() {} static void Main(string[] agrs) { new Procon().Do(); } Scanner cin; public void Do() { cin = new Scanner(); int D = cin.nextInt(); long N = cin.nextLong(); long ret = 1; for (int i = 0; i < D; i++) { ret *= 100; } if (N == 100) { Console.WriteLine(ret * 101); } else { Console.WriteLine(ret * N); } } } class Scanner { string[] s; int i; int max_i; public Scanner() { s = new string[0]; max_i = 0; i = 0; } public string nextString() { if (i >= s.Length) { s = Console.ReadLine().Split(' '); max_i = s.Length; i = 0; if (max_i == 0) { return ""; } return s[i++]; } else { return s[i++]; } } public int nextInt() { return int.Parse(nextString()); } public long nextLong() { return long.Parse(nextString()); } public double nextDouble() { return double.Parse(nextString()); } public string[] arrayString() { return Console.ReadLine().Split(' '); } public int[] arrayInt() { string[] str = Console.ReadLine().Split(' '); int[] array = new int[str.Length]; for (int i = 0; i < str.Length; i++) { array[i] = int.Parse(str[i]); } return array; } public long[] arrayLong() { string[] str = Console.ReadLine().Split(' '); long[] array = new long[str.Length]; for (int i = 0; i < str.Length; i++) { array[i] = long.Parse(str[i]); } return array; } public double[] arrayDouble() { string[] str = Console.ReadLine().Split(' '); double[] array = new double[str.Length]; for (int i = 0; i < str.Length; i++) { array[i] = double.Parse(str[i]); } return array; } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 64, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 48], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203], ["+", 64, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 46]]
8
524
20
using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(' '); int D = int.Parse(s[0]); int N = int.Parse(s[1]); int num = 1; for (int i = 0; i < D; i++) num *= 100; Console.WriteLine(num * N); } }
using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(' '); int D = int.Parse(s[0]); int N = int.Parse(s[1]); int num = 1; for (int i = 0; i < D; i++) num *= 100; Console.WriteLine(N == 100 ? num * (N + 1) : num * N); } }
[["+", 3, 4, 0, 28, 0, 41, 15, 16, 31, 22], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 17, 60], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 12, 203], ["+", 0, 213, 3, 4, 0, 28, 0, 41, 0, 101], ["+", 3, 4, 0, 28, 0, 41, 64, 16, 31, 22], ["+", 3, 4, 0, 28, 0, 41, 64, 16, 17, 48], ["+", 0, 28, 0, 41, 64, 16, 12, 23, 0, 24], ["+", 0, 41, 64, 16, 12, 23, 0, 16, 31, 22], ["+", 0, 41, 64, 16, 12, 23, 0, 16, 17, 72], ["+", 0, 41, 64, 16, 12, 23, 0, 16, 12, 203], ["+", 0, 28, 0, 41, 64, 16, 12, 23, 0, 25], ["+", 0, 213, 3, 4, 0, 28, 0, 41, 0, 102]]
8
106
12
using System; using System.Collections.Generic; using System.Linq; namespace AtCoder { class Program { static void Main(string[] args) { //[summary]B - Ringo's Favorite Numbers var line = ReadLine(); int d = line[0]; int n = line[1]; int baseNum = (int)Math.Pow(100, d); Console.WriteLine(baseNum * n); } static List<int> ReadLine() { var line = Console.ReadLine(); var array = line.Split(' '); return array.Select(x => int.Parse(x)).ToList(); } } }
using System; using System.Collections.Generic; using System.Linq; namespace AtCoder { class Program { static void Main(string[] args) { //[summary]B - Ringo's Favorite Numbers var line = ReadLine(); int d = line[0]; int n = line[1]; int baseNum = (int)Math.Pow(100, d); if (n == 100) { n++; } Console.WriteLine(baseNum * n); } static List<int> ReadLine() { var line = Console.ReadLine(); var array = line.Split(' '); return array.Select(x => int.Parse(x)).ToList(); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 223, 0, 29], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
8
132
11
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Text.RegularExpressions; namespace AtCoder { class Program { static void Main(string[] args) { var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); var d = input[0]; var n = input[1]; var ans = Math.Pow(100, d) * n; if (d == 0) { ans = n; } Console.WriteLine(ans); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Text.RegularExpressions; namespace AtCoder { class Program { static void Main(string[] args) { var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); var d = input[0]; var n = input[1]; if (n >= 100) { n = 101; } var ans = Math.Pow(100, d) * n; Console.WriteLine(ans); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 12, 203], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["-", 0, 198, 0, 200, 0, 212, 0, 16, 12, 22], ["-", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["-", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["-", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["-", 64, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["-", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46]]
8
134
24
using System; namespace ABC100B { class Program { static void Main(string[] args) { var aaa = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); var N = Math.Pow(100, aaa[0]); if (aaa[0] == 0) { Console.WriteLine(aaa[1]); } else if (aaa[1] == 100) { Console.WriteLine(N * (aaa[1] + 1)); } else { Console.WriteLine(N * aaa[1]); } } } }
using System; namespace ABC100B { class Program { static void Main(string[] args) { var aaa = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); var N = Math.Pow(100, aaa[0]); if (aaa[1] == 100) { Console.WriteLine(N * (aaa[1] + 1)); } else { Console.WriteLine(N * aaa[1]); } } } }
[["-", 15, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["-", 0, 57, 15, 16, 31, 204, 206, 207, 0, 73], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["-", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["-", 64, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["-", 64, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["-", 64, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["-", 64, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["-", 0, 213, 3, 4, 0, 28, 0, 204, 205, 22], ["-", 3, 4, 0, 28, 0, 204, 206, 207, 0, 70], ["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["-", 3, 4, 0, 28, 0, 204, 206, 207, 0, 73], ["-", 64, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["-", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["-", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["-", 0, 195, 8, 196, 0, 57, 75, 57, 0, 121], ["-", 0, 195, 8, 196, 0, 57, 75, 57, 0, 24], ["-", 0, 57, 75, 57, 15, 16, 31, 204, 205, 22], ["-", 75, 57, 15, 16, 31, 204, 206, 207, 0, 70]]
8
126
22
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; class Program { static void Main() { int[] dn = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); int D = dn[0]; int N = dn[1]; if (N != 100) { Console.WriteLine((int)Math.Pow(100, D) * N); } else { Console.WriteLine((int)Math.Pow(100, D) * N + 1); } } } static class MathUtil { public static IEnumerable<IEnumerable<int>> GetPermutation(int n) { if (n == 0) { yield return Single(0); yield break; } for (int i = 0; i <= n; i++) { foreach (var x in GetPermutation(n - 1)) { yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1)); } } } private static IEnumerable<int> Single(int x) { yield return x; } public static IEnumerable<int> EnumeratePrimeNumbers() { List<int> primes = new List<int>() { 2 }; yield return 2; for (int i = 3; i < int.MaxValue; i++) { bool isPrime = true; int Sqrt = (int)Math.Sqrt(i) + 1; foreach (var prime in primes) { if (prime > Sqrt) { break; } if (i % prime == 0) { isPrime = false; break; } } if (isPrime) { primes.Add(i); yield return i; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; class Program { static void Main() { int[] dn = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); int D = dn[0]; int N = dn[1]; if (N != 100) { Console.WriteLine((int)Math.Pow(100, D) * N); } else { Console.WriteLine((int)Math.Pow(100, D) * N + (int)Math.Pow(100, D)); } } } static class MathUtil { public static IEnumerable<IEnumerable<int>> GetPermutation(int n) { if (n == 0) { yield return Single(0); yield break; } for (int i = 0; i <= n; i++) { foreach (var x in GetPermutation(n - 1)) { yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1)); } } } private static IEnumerable<int> Single(int x) { yield return x; } public static IEnumerable<int> EnumeratePrimeNumbers() { List<int> primes = new List<int>() { 2 }; yield return 2; for (int i = 3; i < int.MaxValue; i++) { bool isPrime = true; int Sqrt = (int)Math.Sqrt(i) + 1; foreach (var prime in primes) { if (prime > Sqrt) { break; } if (i % prime == 0) { isPrime = false; break; } } if (isPrime) { primes.Add(i); yield return i; } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203], ["+", 3, 4, 0, 28, 0, 16, 12, 74, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 12, 74, 39, 199], ["+", 3, 4, 0, 28, 0, 16, 12, 74, 0, 25], ["+", 0, 16, 12, 74, 51, 213, 63, 214, 205, 22], ["+", 0, 16, 12, 74, 51, 213, 63, 214, 0, 131], ["+", 0, 16, 12, 74, 51, 213, 63, 214, 141, 22], ["+", 0, 16, 12, 74, 51, 213, 3, 4, 0, 24], ["+", 12, 74, 51, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 16, 12, 74, 51, 213, 3, 4, 0, 21], ["+", 12, 74, 51, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 16, 12, 74, 51, 213, 3, 4, 0, 25]]
8
381
12
using System; using System.Collections.Generic; using System.Linq; using static System.Math; using static AtCoderTemplate.MyExtensions; using static AtCoderTemplate.MyInputOutputs; using static AtCoderTemplate.MyNumericFunctions; namespace AtCoderTemplate { public class Program { public static void Main(string[] args) { var DN = ReadInts(); var D = DN[0]; var N = DN[1]; Print(N * (long)Pow(100, D)); } } static class MyInputOutputs { /* Input & Output*/ public static int ReadInt() { return int.Parse(Console.ReadLine()); } public static long ReadLong() { return long.Parse(Console.ReadLine()); } public static List<int> ReadInts() { return Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList(); } public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(c => long.Parse(c)).ToList(); } public static List<List<int>> ReadIntColumns(int n) { /* 入力例 A1 B1 A2 B2 ... An Bn 出力例 [[A1,A2,...,An], [B1,B2,...,Bn]] */ var rows = Enumerable.Range(0, n).Select(i => ReadInts()).ToList(); var m = rows.FirstOrDefault()?.Count() ?? 0; return Enumerable.Range(0, m) .Select(i => rows.Select(items => items[i]).ToList()) .ToList(); } public static List<List<long>> ReadLongColumns(int n) { /* 入力例 A1 B1 A2 B2 ... An Bn 出力例 [[A1,A2,...,An], [B1,B2,...,Bn]] */ var rows = Enumerable.Range(0, n).Select(i => ReadLongs()).ToList(); var m = rows.FirstOrDefault()?.Count() ?? 0; return Enumerable.Range(0, m) .Select(i => rows.Select(items => items[i]).ToList()) .ToList(); } public static void Print<T>(T item) { Console.WriteLine(item); } public static void PrintIf<T1, T2>(bool condition, T1 trueResult, T2 falseResult) { if (condition) { Console.WriteLine(trueResult); } else { Console.WriteLine(falseResult); } } public static void PrintRow<T>(IEnumerable<T> list) { /* 横ベクトルで表示 A B C D ... */ if (!list.IsEmpty()) { Console.Write(list.First()); foreach (var item in list.Skip(1)) { Console.Write($" {item}"); } } Console.Write("\n"); } public static void PrintColomn<T>(IEnumerable<T> list) { /* 縦ベクトルで表示 A B C D ... */ foreach (var item in list) { Console.WriteLine(item); } } public static void Print2DArray<T>(IEnumerable<IEnumerable<T>> sources) { foreach (var row in sources) { PrintRow(row); } } } static class MyNumericFunctions { public static bool isEven(int a) { return a % 2 == 0; } public static bool isEven(long a) { return a % 2 == 0; } public static bool isOdd(int a) { return !isEven(a); } public static bool isOdd(long a) { return !isEven(a); } public static long nPk(int n, int k) { if (k > n) { return 0; } else { return Enumerable.Range(n - k + 1, k) .Aggregate((long)1, ((i, m) => i * m)); } } public static long Fact(int n) { return nPk(n, n); } public static long nCk(int n, int k) { if (k > n) { return 0; } else { return nPk(n, k) / Fact(k); } } // 最大公約数 public static long GCD(long m, long n) { if (m < n) { return GCD(n, m); } else if (n == 0) { return m; } else { return GCD(n, m % n); } } // 最小公倍数 public static long LCM(long m, long n) { if (m < n) { return LCM(n, m); } else { return (m * n) / GCD(m, n); } } } static class MyExtensions { // AppendとPrependが、.NET Standard 1.6からの追加で、Mono 4.6.2 // はそれに対応して仕様はあるが、実装がない public static IEnumerable<T> Append<T>(this IEnumerable<T> source, T element) { return source.Concat(Enumerable.Repeat(element, 1)); } public static IEnumerable<T> Prepend<T>(this IEnumerable<T> source, T element) { return Enumerable.Repeat(element, 1).Concat(source); } // TakeLastとSkipLastが、.Net Standard 2.1からの追加で、Mono 4.6.2 // はそれに対応していない public static IEnumerable<T> TakeLast<T>(this IEnumerable<T> source, int count) { return source.Skip(source.Count() - count); } public static IEnumerable<T> SkipLast<T>(this IEnumerable<T> source, int count) { return source.Take(source.Count() - count); } public static bool IsEmpty<T>(this IEnumerable<T> source) { return !source.Any(); } /// <summary> /// インデックスiの位置の要素からk個取り除く /// O(N) /// </summary> public static IEnumerable<T> TakeAwayRange<T>(this IEnumerable<T> source, int i, int count) { return source.Take(i).Concat(source.Skip(i + count)); } /// <summary> /// インデックスiの位置の要素を取り除く /// O(N) /// </summary> public static IEnumerable<T> TakeAwayAt<T>(this IEnumerable<T> source, int i) { return source.TakeAwayRange(i, 1); } /// <summary> /// インデックスiの位置にシーケンスを挿入する /// O(N + K) /// </summary> public static IEnumerable<T> InsertEnumAt<T>(this IEnumerable<T> source, int i, IEnumerable<T> inserted) { return source.Take(i).Concat(inserted).Concat(source.Skip(i)); } /// <summary> /// 順列を得る /// O(N!) /// </summary> public static IEnumerable<IEnumerable<T>> Perm<T>(this IEnumerable<T> source, int n) { if (n == 0 || source.IsEmpty() || source.Count() < n) { return Enumerable.Empty<IEnumerable<T>>(); } else if (n == 1) { return source.Select(i => new List<T> { i }); } else { var nexts = source.Select( (x, i) => new { next = source.Take(i).Concat(source.Skip(i + 1)), selected = source.Take(i + 1).Last() }); return nexts.SelectMany( next => Perm(next.next, n - 1) .Select(item => item.Prepend(next.selected))); } } /// <summary> /// シーケンスの隣り合う要素を2引数の関数に適用したシーケンスを得る /// </summary> /// <para>O(N)</para> /// <param name="source">元のシーケンス</param> /// <param name="func">2引数関数</param> /// <example>[1,2,3,4].MapAdjacent(f) => [f(1,2), f(2,3), f(3,4)]</example> public static IEnumerable<TR> MapAdjacent<T1, TR>(this IEnumerable<T1> source, Func<T1, T1, TR> func) { var list = source.ToList(); return Enumerable.Range(1, list.Count - 1) .Select(i => func(list[i], list[i - 1])); } /// <summary> /// 累積項を要素にもつシーケンスを得る(初項は、first) /// <para>O(N)</para> /// </summary> /// <param name="source">元のシーケンス</param> /// <param name="func">2引数関数f</param> /// <param name="first">func(first, source[0])のための初項</param> /// <example> [1,2,3].Scanl1(f,0) => [0, f(0,1), f(f(0,1),2), /// f(f(f(0,1),2),3)]</example> public static IEnumerable<TR> Scanl<T, TR>(this IEnumerable<T> source, Func<TR, T, TR> func, TR first) { var list = source.ToList(); var result = new List<TR> { first }; foreach (var i in Enumerable.Range(1, source.Count())) { result.Add(func(result[i - 1], list[i])); } return result; } /// <summary> /// 累積項を要素にもつシーケンスを得る(初項は、source.First()) /// <para>O(N)</para> /// </summary> /// <param name="source">元のシーケンス</param> /// <param name="func">2引数関数f</param> /// <example> [1,2,3].Scanl1(f) => [1, f(1,2), f(f(1,2),3)]</example> public static IEnumerable<T> Scanl1<T>(this IEnumerable<T> source, Func<T, T, T> func) { var list = source.ToList(); var result = new List<T> { list[0] }; foreach (var i in Enumerable.Range(1, source.Count() - 1)) { result.Add(func(result[i - 1], list[i])); } return result; } /// <summary> /// 昇順にソートしたインデックスを得る /// </summary> /// <para>O(N * log N)</para> public static IEnumerable<int> SortIndex<T>(this IEnumerable<T> source) { return source.Select((item, i) => new { Item = item, Index = i }) .OrderBy(x => x.Item) .Select(x => x.Index); } } }
using System; using System.Collections.Generic; using System.Linq; using static System.Math; using static AtCoderTemplate.MyExtensions; using static AtCoderTemplate.MyInputOutputs; using static AtCoderTemplate.MyNumericFunctions; namespace AtCoderTemplate { public class Program { public static void Main(string[] args) { var DN = ReadInts(); var D = DN[0]; var N = DN[1]; if (N == 100) { Print((N + 1) * Pow(100, D)); } else { Print(N * Pow(100, D)); } } } static class MyInputOutputs { /* Input & Output*/ public static int ReadInt() { return int.Parse(Console.ReadLine()); } public static long ReadLong() { return long.Parse(Console.ReadLine()); } public static List<int> ReadInts() { return Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToList(); } public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(c => long.Parse(c)).ToList(); } public static List<List<int>> ReadIntColumns(int n) { /* 入力例 A1 B1 A2 B2 ... An Bn 出力例 [[A1,A2,...,An], [B1,B2,...,Bn]] */ var rows = Enumerable.Range(0, n).Select(i => ReadInts()).ToList(); var m = rows.FirstOrDefault()?.Count() ?? 0; return Enumerable.Range(0, m) .Select(i => rows.Select(items => items[i]).ToList()) .ToList(); } public static List<List<long>> ReadLongColumns(int n) { /* 入力例 A1 B1 A2 B2 ... An Bn 出力例 [[A1,A2,...,An], [B1,B2,...,Bn]] */ var rows = Enumerable.Range(0, n).Select(i => ReadLongs()).ToList(); var m = rows.FirstOrDefault()?.Count() ?? 0; return Enumerable.Range(0, m) .Select(i => rows.Select(items => items[i]).ToList()) .ToList(); } public static void Print<T>(T item) { Console.WriteLine(item); } public static void PrintIf<T1, T2>(bool condition, T1 trueResult, T2 falseResult) { if (condition) { Console.WriteLine(trueResult); } else { Console.WriteLine(falseResult); } } public static void PrintRow<T>(IEnumerable<T> list) { /* 横ベクトルで表示 A B C D ... */ if (!list.IsEmpty()) { Console.Write(list.First()); foreach (var item in list.Skip(1)) { Console.Write($" {item}"); } } Console.Write("\n"); } public static void PrintColomn<T>(IEnumerable<T> list) { /* 縦ベクトルで表示 A B C D ... */ foreach (var item in list) { Console.WriteLine(item); } } public static void Print2DArray<T>(IEnumerable<IEnumerable<T>> sources) { foreach (var row in sources) { PrintRow(row); } } } static class MyNumericFunctions { public static bool isEven(int a) { return a % 2 == 0; } public static bool isEven(long a) { return a % 2 == 0; } public static bool isOdd(int a) { return !isEven(a); } public static bool isOdd(long a) { return !isEven(a); } public static long nPk(int n, int k) { if (k > n) { return 0; } else { return Enumerable.Range(n - k + 1, k) .Aggregate((long)1, ((i, m) => i * m)); } } public static long Fact(int n) { return nPk(n, n); } public static long nCk(int n, int k) { if (k > n) { return 0; } else { return nPk(n, k) / Fact(k); } } // 最大公約数 public static long GCD(long m, long n) { if (m < n) { return GCD(n, m); } else if (n == 0) { return m; } else { return GCD(n, m % n); } } // 最小公倍数 public static long LCM(long m, long n) { if (m < n) { return LCM(n, m); } else { return (m * n) / GCD(m, n); } } } static class MyExtensions { // AppendとPrependが、.NET Standard 1.6からの追加で、Mono 4.6.2 // はそれに対応して仕様はあるが、実装がない public static IEnumerable<T> Append<T>(this IEnumerable<T> source, T element) { return source.Concat(Enumerable.Repeat(element, 1)); } public static IEnumerable<T> Prepend<T>(this IEnumerable<T> source, T element) { return Enumerable.Repeat(element, 1).Concat(source); } // TakeLastとSkipLastが、.Net Standard 2.1からの追加で、Mono 4.6.2 // はそれに対応していない public static IEnumerable<T> TakeLast<T>(this IEnumerable<T> source, int count) { return source.Skip(source.Count() - count); } public static IEnumerable<T> SkipLast<T>(this IEnumerable<T> source, int count) { return source.Take(source.Count() - count); } public static bool IsEmpty<T>(this IEnumerable<T> source) { return !source.Any(); } /// <summary> /// インデックスiの位置の要素からk個取り除く /// O(N) /// </summary> public static IEnumerable<T> TakeAwayRange<T>(this IEnumerable<T> source, int i, int count) { return source.Take(i).Concat(source.Skip(i + count)); } /// <summary> /// インデックスiの位置の要素を取り除く /// O(N) /// </summary> public static IEnumerable<T> TakeAwayAt<T>(this IEnumerable<T> source, int i) { return source.TakeAwayRange(i, 1); } /// <summary> /// インデックスiの位置にシーケンスを挿入する /// O(N + K) /// </summary> public static IEnumerable<T> InsertEnumAt<T>(this IEnumerable<T> source, int i, IEnumerable<T> inserted) { return source.Take(i).Concat(inserted).Concat(source.Skip(i)); } /// <summary> /// 順列を得る /// O(N!) /// </summary> public static IEnumerable<IEnumerable<T>> Perm<T>(this IEnumerable<T> source, int n) { if (n == 0 || source.IsEmpty() || source.Count() < n) { return Enumerable.Empty<IEnumerable<T>>(); } else if (n == 1) { return source.Select(i => new List<T> { i }); } else { var nexts = source.Select( (x, i) => new { next = source.Take(i).Concat(source.Skip(i + 1)), selected = source.Take(i + 1).Last() }); return nexts.SelectMany( next => Perm(next.next, n - 1) .Select(item => item.Prepend(next.selected))); } } /// <summary> /// シーケンスの隣り合う要素を2引数の関数に適用したシーケンスを得る /// </summary> /// <para>O(N)</para> /// <param name="source">元のシーケンス</param> /// <param name="func">2引数関数</param> /// <example>[1,2,3,4].MapAdjacent(f) => [f(1,2), f(2,3), f(3,4)]</example> public static IEnumerable<TR> MapAdjacent<T1, TR>(this IEnumerable<T1> source, Func<T1, T1, TR> func) { var list = source.ToList(); return Enumerable.Range(1, list.Count - 1) .Select(i => func(list[i], list[i - 1])); } /// <summary> /// 累積項を要素にもつシーケンスを得る(初項は、first) /// <para>O(N)</para> /// </summary> /// <param name="source">元のシーケンス</param> /// <param name="func">2引数関数f</param> /// <param name="first">func(first, source[0])のための初項</param> /// <example> [1,2,3].Scanl1(f,0) => [0, f(0,1), f(f(0,1),2), /// f(f(f(0,1),2),3)]</example> public static IEnumerable<TR> Scanl<T, TR>(this IEnumerable<T> source, Func<TR, T, TR> func, TR first) { var list = source.ToList(); var result = new List<TR> { first }; foreach (var i in Enumerable.Range(1, source.Count())) { result.Add(func(result[i - 1], list[i])); } return result; } /// <summary> /// 累積項を要素にもつシーケンスを得る(初項は、source.First()) /// <para>O(N)</para> /// </summary> /// <param name="source">元のシーケンス</param> /// <param name="func">2引数関数f</param> /// <example> [1,2,3].Scanl1(f) => [1, f(1,2), f(f(1,2),3)]</example> public static IEnumerable<T> Scanl1<T>(this IEnumerable<T> source, Func<T, T, T> func) { var list = source.ToList(); var result = new List<T> { list[0] }; foreach (var i in Enumerable.Range(1, source.Count() - 1)) { result.Add(func(result[i - 1], list[i])); } return result; } /// <summary> /// 昇順にソートしたインデックスを得る /// </summary> /// <para>O(N * log N)</para> public static IEnumerable<int> SortIndex<T>(this IEnumerable<T> source) { return source.Select((item, i) => new { Item = item, Index = i }) .OrderBy(x => x.Item) .Select(x => x.Index); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 3, 4, 0, 28, 0, 16, 31, 23, 0, 24], ["+", 0, 28, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 28, 0, 16, 31, 23, 0, 16, 12, 203], ["+", 3, 4, 0, 28, 0, 16, 31, 23, 0, 25], ["+", 3, 4, 0, 28, 0, 16, 12, 213, 63, 22], ["-", 3, 4, 0, 28, 0, 16, 12, 74, 39, 199], ["+", 0, 16, 12, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 28, 0, 16, 12, 213, 3, 4, 0, 21], ["+", 0, 16, 12, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 28, 0, 16, 12, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 57, 75, 196, 0, 1, 0, 213, 63, 22], ["+", 75, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 48], ["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 46]]
8
1,778
26
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { const int MOD = 1000000007; const int INF = 1 << 30; static void Main(string[] args) { Solve(); } static void Solve() { Scan sc = new Scan(); write wr = new write(); int[] x = sc.intarr; int D = x[0]; int N = x[1]; int ans = (int)Math.Pow(100, D) * N; if (N == 100) ans /= 100; wr.wri(ans); } } class Scan { public string str => Console.ReadLine(); public string[] strarr => str.Split(' '); public long[] longarr => strarr.Select(long.Parse).ToArray(); public int[] intarr => strarr.Select(int.Parse).ToArray(); public char[] chararr => str.ToArray(); } class write { public void wri<Type>(Type x) { Console.WriteLine(x); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { const int MOD = 1000000007; const int INF = 1 << 30; static void Main(string[] args) { Solve(); } static void Solve() { Scan sc = new Scan(); write wr = new write(); int[] x = sc.intarr; int D = x[0]; int N = x[1]; int ans = (int)Math.Pow(100, D) * N; if (N == 100) ans += (int)Math.Pow(100, D); wr.wri(ans); } } class Scan { public string str => Console.ReadLine(); public string[] strarr => str.Split(' '); public long[] longarr => strarr.Select(long.Parse).ToArray(); public int[] intarr => strarr.Select(int.Parse).ToArray(); public char[] chararr => str.ToArray(); } class write { public void wri<Type>(Type x) { Console.WriteLine(x); } }
[["-", 0, 57, 64, 1, 0, 11, 0, 202, 0, 90], ["+", 0, 57, 64, 1, 0, 11, 0, 202, 0, 107], ["+", 0, 57, 64, 1, 0, 11, 12, 74, 0, 24], ["+", 0, 57, 64, 1, 0, 11, 12, 74, 39, 199], ["+", 0, 57, 64, 1, 0, 11, 12, 74, 0, 25], ["+", 0, 11, 12, 74, 51, 213, 63, 214, 205, 22], ["+", 0, 11, 12, 74, 51, 213, 63, 214, 0, 131], ["+", 0, 11, 12, 74, 51, 213, 63, 214, 141, 22], ["+", 0, 11, 12, 74, 51, 213, 3, 4, 0, 24], ["+", 0, 11, 12, 74, 51, 213, 3, 4, 0, 21], ["+", 12, 74, 51, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 11, 12, 74, 51, 213, 3, 4, 0, 25]]
8
244
12
using System; using System.Linq; namespace B.Ringo_s_Favorite_Numbers { class Program { static void Main(string[] args) { var DN = Console.ReadLine().Split().Select(int.Parse).ToArray(); int D = DN[0]; int N = DN[1] == 100 ? 101 : DN[1]; Console.WriteLine(Math.Pow(100, DN[0]) * DN[1]); } } }
using System; using System.Linq; namespace B.Ringo_s_Favorite_Numbers { class Program { static void Main(string[] args) { var DN = Console.ReadLine().Split().Select(int.Parse).ToArray(); int D = DN[0]; int N = DN[1] == 100 ? 101 : DN[1]; Console.WriteLine(Math.Pow(100, D) * N); } } }
[["-", 31, 213, 3, 4, 0, 28, 0, 204, 205, 22], ["-", 3, 4, 0, 28, 0, 204, 206, 207, 0, 70], ["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["-", 3, 4, 0, 28, 0, 204, 206, 207, 0, 73], ["+", 0, 16, 31, 213, 3, 4, 0, 28, 0, 22], ["-", 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], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
8
100
10
using System; using System.Linq; public class Test { public static void Main() => Console.WriteLine(Console.ReadLine() .Split(' ') .Select(i => int.Parse(i)) .Select((v, i) => i == 0 ? Math.Pow(100, v) : v) .Aggregate((calc, val) => calc * val)); }
using System; using System.Linq; public class Test { public static void Main() => Console.WriteLine( Console.ReadLine() .Split(' ') .Select(i => int.Parse(i)) .Select((v, i) => i == 0 ? Math.Pow(100, v) : (v == 100 ? 101 : v)) .Aggregate((calc, val) => calc * val)); }
[["+", 0, 28, 0, 218, 8, 41, 75, 23, 0, 24], ["+", 8, 41, 75, 23, 0, 41, 15, 16, 31, 22], ["+", 8, 41, 75, 23, 0, 41, 15, 16, 17, 60], ["+", 8, 41, 75, 23, 0, 41, 15, 16, 12, 203], ["+", 0, 218, 8, 41, 75, 23, 0, 41, 0, 101], ["+", 0, 218, 8, 41, 75, 23, 0, 41, 64, 203], ["+", 0, 218, 8, 41, 75, 23, 0, 41, 0, 102], ["+", 0, 28, 0, 218, 8, 41, 75, 23, 0, 25]]
8
87
8
using System; using System.Collections.Generic; using System.Linq; namespace CSharpSample01 { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(' '); int D = int.Parse(str[0]); int K = int.Parse(str[1]); string ans = ""; if (D == 0) { Console.WriteLine(K); return; } for (int i = 1; i <= D; i++) { ans += "00"; } Console.WriteLine($"{K}" + ans); } } }
using System; using System.Collections.Generic; using System.Linq; namespace CSharpSample01 { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(' '); int D = int.Parse(str[0]); int K = int.Parse(str[1]); string ans = ""; for (int i = 1; i <= D; i++) { ans += "00"; } if (K == 100) K++; Console.WriteLine($"{K}" + ans); } } }
[["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["-", 0, 195, 8, 196, 0, 57, 64, 196, 0, 45], ["-", 64, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["-", 64, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["-", 64, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["-", 64, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["-", 64, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["-", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 38], ["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 35], ["-", 0, 195, 8, 196, 0, 57, 64, 196, 0, 46], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 22], ["+", 8, 196, 0, 57, 64, 1, 0, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35]]
8
136
26
using System; class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(' '); int D = int.Parse(s[0]), N = int.Parse(s[1]); Console.WriteLine((N * Math.Pow(100, D)).ToString()); } }
using System; class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(' '); int D = int.Parse(s[0]), N = int.Parse(s[1]); N = N == 100 ? 101 : N; Console.WriteLine((N * Math.Pow(100, D)).ToString()); } }
[["+", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 8, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 0, 1, 0, 11, 12, 41, 15, 16, 31, 22], ["+", 0, 1, 0, 11, 12, 41, 15, 16, 17, 60], ["+", 0, 1, 0, 11, 12, 41, 15, 16, 12, 203], ["+", 8, 196, 0, 1, 0, 11, 12, 41, 0, 101], ["+", 8, 196, 0, 1, 0, 11, 12, 41, 64, 203], ["+", 8, 196, 0, 1, 0, 11, 12, 41, 0, 102], ["+", 8, 196, 0, 1, 0, 11, 12, 41, 75, 22], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35]]
8
83
10
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC098A { class Program { static void Main(string[] args) { int A, B, max; var word = Console.ReadLine().Split(' '); A = int.Parse(word[0]); B = int.Parse(word[1]); max = A + B; if (max < A - B) max = A - B; if (max < A * B) max = A * B; if (A + B > A - B) max = A + B; else max = A - B; Console.WriteLine(max); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC098A { class Program { static void Main(string[] args) { int A, B, max; var word = Console.ReadLine().Split(' '); A = int.Parse(word[0]); B = int.Parse(word[1]); max = A + B; if (max < A - B) max = A - B; if (max < A * B) max = A * B; Console.WriteLine(max); Console.ReadKey(); } } }
[["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 72], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 12, 22], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 47], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 12, 22], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["-", 8, 196, 0, 57, 64, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 1, 0, 11, 0, 202, 0, 32], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 17, 72], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22], ["-", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35], ["-", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95], ["-", 8, 196, 0, 57, 75, 1, 0, 11, 31, 22], ["-", 0, 57, 75, 1, 0, 11, 0, 202, 0, 32], ["-", 0, 57, 75, 1, 0, 11, 12, 16, 31, 22], ["-", 0, 57, 75, 1, 0, 11, 12, 16, 17, 33], ["-", 0, 57, 75, 1, 0, 11, 12, 16, 12, 22], ["-", 0, 195, 8, 196, 0, 57, 75, 1, 0, 35]]
8
163
23
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC098A { class Program { static void Main(string[] args) { int a, b, c, d, e, max; var word = Console.ReadLine().Split(' '); //整数A,Bの入力 a = int.Parse(word[0]); b = int.Parse(word[1]); c = a + b; d = a - b; e = a * b; //最大値maxを求める if (c >= d && c >= e) max = a; max = a * b; if (c <= d && d >= e) max = d; else max = e; Console.WriteLine(max); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC098A { class Program { static void Main(string[] args) { int a, b, c, d, e, max; var word = Console.ReadLine().Split(' '); //整数A,Bの入力 a = int.Parse(word[0]); b = int.Parse(word[1]); c = a + b; d = a - b; e = a * b; //最大値maxを求める if (c >= d && c >= e) max = c; else if (c <= d && d >= e) max = d; else max = e; Console.WriteLine(max); Console.ReadKey(); } } }
[["-", 8, 196, 0, 57, 64, 1, 0, 11, 12, 22], ["-", 0, 195, 8, 196, 0, 57, 64, 1, 0, 35], ["-", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22], ["-", 8, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["-", 8, 196, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 8, 196, 0, 1, 0, 11, 12, 16, 17, 48], ["-", 8, 196, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 196, 0, 57, 64, 1, 0, 11, 12, 22], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95]]
8
171
9
using System; namespace ConsoleApp2 { class Program { static void Main(string[] args) { int a, b, A, B, C, max; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); A = a + b; B = a - b; C = a * b; if (A > B && A > C) max = A; else if (B > A && B > C) max = B; else max = C; Console.WriteLine(max); Console.ReadKey(); } } }
using System; namespace ConsoleApp2 { class Program { static void Main(string[] args) { int a, b, A, B, C, max; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); A = a + b; B = a - b; C = a * b; if (A >= B) if (A > C) max = A; else max = C; else if (B > A) if (B > C) max = B; else max = C; else max = C; Console.WriteLine(max); Console.ReadKey(); } } }
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 20], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25], ["+", 0, 195, 8, 196, 0, 57, 64, 57, 0, 121], ["+", 0, 195, 8, 196, 0, 57, 64, 57, 0, 24], ["+", 8, 196, 0, 57, 64, 57, 64, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 57, 64, 57, 0, 95], ["+", 0, 57, 64, 57, 75, 1, 0, 11, 31, 22], ["+", 64, 57, 75, 1, 0, 11, 0, 202, 0, 32], ["+", 0, 57, 64, 57, 75, 1, 0, 11, 12, 22], ["-", 8, 196, 0, 57, 75, 57, 15, 16, 17, 98], ["+", 0, 195, 8, 196, 0, 57, 75, 57, 0, 25], ["+", 8, 196, 0, 57, 75, 57, 64, 57, 0, 121], ["+", 8, 196, 0, 57, 75, 57, 64, 57, 0, 24], ["+", 0, 57, 75, 57, 64, 57, 64, 1, 0, 35], ["+", 8, 196, 0, 57, 75, 57, 64, 57, 0, 95], ["+", 75, 57, 64, 57, 75, 1, 0, 11, 31, 22], ["+", 75, 57, 64, 57, 75, 1, 0, 11, 12, 22]]
8
140
22
using System; namespace ConsoleApp2 { class Program { static void Main(string[] args) { int a, b, A, B, C, max; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); A = a + b; B = a - b; C = a * b; if (A > B && A > C) max = A; else if (B > A && B > C) max = B; else max = C; Console.WriteLine(max); Console.ReadKey(); } } }
using System; namespace ConsoleApp2 { class Program { static void Main(string[] args) { int a, b, A, B, C, max; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); A = a + b; B = a - b; C = a * b; max = 0; if (A >= B && A >= C) max = A; else if (B >= A && B >= C) max = B; else if (C >= A && C >= B) max = C; Console.WriteLine(max); Console.ReadKey(); } } }
[["+", 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, 196, 0, 57, 15, 16, 31, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 20], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 20], ["-", 0, 57, 75, 57, 15, 16, 31, 16, 17, 47], ["+", 0, 57, 75, 57, 15, 16, 31, 16, 17, 20], ["-", 0, 57, 75, 57, 15, 16, 12, 16, 17, 47], ["+", 0, 57, 75, 57, 15, 16, 12, 16, 17, 20], ["+", 8, 196, 0, 57, 75, 57, 75, 57, 0, 121], ["+", 8, 196, 0, 57, 75, 57, 75, 57, 0, 24], ["+", 75, 57, 75, 57, 15, 16, 31, 16, 31, 22], ["+", 75, 57, 75, 57, 15, 16, 31, 16, 17, 20], ["+", 75, 57, 75, 57, 15, 16, 31, 16, 12, 22], ["+", 0, 57, 75, 57, 75, 57, 15, 16, 17, 98], ["+", 75, 57, 75, 57, 15, 16, 12, 16, 31, 22], ["+", 75, 57, 75, 57, 15, 16, 12, 16, 17, 20], ["+", 75, 57, 75, 57, 15, 16, 12, 16, 12, 22], ["+", 8, 196, 0, 57, 75, 57, 75, 57, 0, 25]]
8
140
22
using System; namespace ConsoleApp2 { class Program { static void Main(string[] args) { int a, b, c, A, B, C, max; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); c = int.Parse(word[2]); A = a + b; B = a - b; C = a * b; if (A >= B && A >= C) max = A; else if (B >= A && B >= C) max = B; else max = C; Console.WriteLine(max); Console.ReadKey(); } } }
using System; namespace ConsoleApp2 { class Program { static void Main(string[] args) { int a, b, A, B, C, max; var word = Console.ReadLine().Split(' '); a = int.Parse(word[0]); b = int.Parse(word[1]); A = a + b; B = a - b; C = a * b; if (A >= B && A >= C) max = A; else if (B > A && B > C) max = B; else max = C; Console.WriteLine(max); Console.ReadKey(); } } }
[["-", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["-", 0, 195, 8, 196, 0, 197, 0, 198, 0, 21], ["-", 3, 4, 0, 28, 0, 204, 206, 207, 0, 73], ["-", 0, 1, 0, 11, 12, 213, 3, 4, 0, 25], ["-", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35], ["-", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22], ["-", 8, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["-", 0, 1, 0, 11, 12, 213, 63, 214, 0, 131], ["-", 0, 1, 0, 11, 12, 213, 63, 214, 141, 22], ["-", 0, 1, 0, 11, 12, 213, 3, 4, 0, 24], ["-", 12, 213, 3, 4, 0, 28, 0, 204, 205, 22], ["-", 3, 4, 0, 28, 0, 204, 206, 207, 0, 70], ["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["-", 0, 57, 75, 57, 15, 16, 31, 16, 17, 20], ["+", 0, 57, 75, 57, 15, 16, 31, 16, 17, 47], ["-", 0, 57, 75, 57, 15, 16, 12, 16, 17, 20], ["+", 0, 57, 75, 57, 15, 16, 12, 16, 17, 47]]
8
154
18