buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
using System; using System.Collections.Generic; using System.Linq; using System.Text; public class AtCoderA { static void Main() { var sc = new Scanner(); int a = sc.NextInt(); int b = sc.NextInt(); string answer; if ((a < 0 && b < 0) || (a > 0 && b > 0)) { answer = "Positive"; } else if (a <= 0 && b >= 0) { answer = "Zero"; } else { answer = "Negative"; } 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(); string answer; if (a > 0 && b > 0) { answer = "Positive"; } else if (a <= 0 && b >= 0) { answer = "Zero"; } else { int count = b - a; if (count % 2 == 0) { answer = "Negative"; } else { answer = "Positive"; } } 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, 57, 15, 16, 31, 23, 0, 24], ["-", 15, 16, 31, 23, 0, 16, 31, 16, 17, 18], ["-", 15, 16, 31, 23, 0, 16, 31, 16, 12, 203], ["-", 0, 57, 15, 16, 31, 23, 0, 16, 17, 98], ["-", 15, 16, 31, 23, 0, 16, 12, 16, 31, 22], ["-", 15, 16, 31, 23, 0, 16, 12, 16, 17, 18], ["-", 15, 16, 31, 23, 0, 16, 12, 16, 12, 203], ["-", 8, 196, 0, 57, 15, 16, 31, 23, 0, 25], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 106], ["-", 8, 196, 0, 57, 15, 16, 12, 23, 0, 24], ["-", 15, 16, 12, 23, 0, 16, 31, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 12, 23, 0, 25], ["+", 8, 196, 0, 57, 75, 57, 75, 196, 0, 45], ["+", 75, 57, 75, 196, 0, 197, 0, 198, 39, 199], ["+", 75, 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, 33], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 22], ["+", 0, 57, 75, 57, 75, 196, 0, 197, 0, 35], ["+", 0, 57, 75, 57, 75, 196, 0, 57, 0, 121], ["+", 0, 57, 75, 57, 75, 196, 0, 57, 0, 24], ["+", 75, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["+", 75, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 75, 196, 0, 57, 15, 16, 31, 16, 12, 203], ["+", 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], ["+", 64, 196, 0, 1, 0, 11, 12, 5, 0, 62], ["+", 75, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 75, 57, 75, 196, 0, 57, 64, 196, 0, 46], ["+", 0, 57, 75, 57, 75, 196, 0, 57, 0, 95], ["+", 75, 57, 75, 196, 0, 57, 75, 196, 0, 45], ["+", 0, 57, 75, 196, 0, 1, 0, 11, 31, 22], ["+", 75, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 75, 196, 0, 1, 0, 11, 12, 5, 0, 222], ["+", 75, 196, 0, 1, 0, 11, 12, 5, 0, 62], ["+", 75, 57, 75, 196, 0, 57, 75, 196, 0, 46]]
8
420
38
using System; using System.Linq; class A { static void Main() { var n = Console.ReadLine().Split().Select(int.Parse).ToArray(); if (n[0] > 0) { Console.WriteLine("Positive"); } else if (n[0] <= 0 && n[0] + n[1] >= 0) { Console.WriteLine("Zero"); } else if (n[1] % 2 == 0) { Console.WriteLine("Positive"); } else { Console.WriteLine("Negative"); } } }
using System; using System.Linq; class A { static void Main() { var n = Console.ReadLine().Split().Select(int.Parse).ToArray(); if (n[0] > 0) { Console.WriteLine("Positive"); } else if (n[0] <= 0 && n[1] >= 0) { Console.WriteLine("Zero"); } else if ((n[1] - n[0]) % 2 == 1) { Console.WriteLine("Positive"); } else { Console.WriteLine("Negative"); } } }
[["-", 31, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["-", 12, 16, 31, 16, 31, 204, 206, 207, 0, 73], ["-", 75, 57, 15, 16, 12, 16, 31, 16, 17, 72], ["-", 15, 16, 12, 16, 31, 16, 12, 204, 205, 22], ["-", 12, 16, 31, 16, 12, 204, 206, 207, 0, 70], ["+", 75, 57, 15, 16, 31, 16, 31, 23, 0, 24], ["+", 31, 23, 0, 16, 31, 204, 206, 207, 0, 73], ["+", 15, 16, 31, 16, 31, 23, 0, 16, 17, 33], ["+", 31, 16, 31, 23, 0, 16, 12, 204, 205, 22], ["+", 31, 23, 0, 16, 12, 204, 206, 207, 0, 70], ["+", 0, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 75, 57, 15, 16, 31, 16, 31, 23, 0, 25], ["-", 0, 57, 75, 57, 75, 57, 15, 16, 12, 203], ["+", 0, 57, 75, 57, 75, 57, 15, 16, 12, 203]]
8
131
14
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class _C { void _() { var n = _Ns(); var a = n[0]; var b = n[1]; long c = (long)a * (long)b; if (c <= 0) Console.WriteLine("Zero"); else if (a > 0) Console.WriteLine("Positive"); else Console.WriteLine("Negative"); } static void Main(string[] args) { new _C()._(); } #region string _S() { return Console.ReadLine(); } string[] _Ss() { return Console.ReadLine().Split(); } int[] _N(int n) { var x = new int[n]; for (var i = 0; i < n; i++) { x[i] = int.Parse(Console.ReadLine()); } return x; } int[] _Ns() { var ss = Console.ReadLine().Split(); var x = new int[ss.Length]; for (var i = 0; i < ss.Length; i++) x[i] = int.Parse(ss[i]); return x; } #endregion }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class _C { void _() { var n = _Ns(); var a = n[0]; var b = n[1]; long c = (long)a * (long)b; if (c <= 0) Console.WriteLine("Zero"); else if (a > 0) Console.WriteLine("Positive"); else { if (Math.Abs((long)a - (long)b) % 2 == 0) Console.WriteLine("Negative"); else Console.WriteLine("Positive"); } } static void Main(string[] args) { new _C()._(); } #region string _S() { return Console.ReadLine(); } string[] _Ss() { return Console.ReadLine().Split(); } int[] _N(int n) { var x = new int[n]; for (var i = 0; i < n; i++) { x[i] = int.Parse(Console.ReadLine()); } return x; } int[] _Ns() { var ss = Console.ReadLine().Split(); var x = new int[ss.Length]; for (var i = 0; i < ss.Length; i++) x[i] = int.Parse(ss[i]); return x; } #endregion }
[["+", 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], ["+", 15, 16, 31, 16, 31, 213, 63, 214, 205, 22], ["+", 15, 16, 31, 16, 31, 213, 63, 214, 0, 131], ["+", 15, 16, 31, 16, 31, 213, 63, 214, 141, 22], ["+", 15, 16, 31, 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, 33], ["+", 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], ["+", 3, 4, 0, 28, 0, 16, 12, 74, 51, 22], ["+", 15, 16, 31, 16, 31, 213, 3, 4, 0, 25], ["+", 75, 196, 0, 57, 15, 16, 31, 16, 17, 109], ["+", 75, 196, 0, 57, 15, 16, 31, 16, 12, 203], ["+", 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], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 62], ["+", 0, 57, 64, 1, 0, 213, 3, 4, 0, 25], ["+", 75, 57, 75, 196, 0, 57, 64, 1, 0, 35], ["+", 0, 57, 75, 57, 75, 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, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 8, 196, 0, 57, 75, 57, 75, 196, 0, 46]]
8
290
33
using System; class Program { static void Main(string[] args) { int ans = 0; // 整数の入力 // int a = int.Parse(Console.ReadLine()); // スペース区切りの整数の入力 string[] input = Console.ReadLine().Split(' '); int N = int.Parse(input[0]); int M = int.Parse(input[1]); int[] arrB = { 1, 1 }; Array.Resize(ref arrB, N + 1); int[] arrR = { 1, 0 }; Array.Resize(ref arrR, N + 1); for (int i = 2; i < N; i++) { arrB[i] = 1; arrR[i] = 0; } for (int i = 0; i < M; i++) { string[] input2 = Console.ReadLine().Split(' '); int x = int.Parse(input[0]); int y = int.Parse(input[1]); if (arrR[x] == 1) { if (arrB[x] == 1) { arrR[x] = 0; arrR[y] = 1; } else { arrR[x] = 1; arrR[y] = 1; } } arrB[x]--; arrB[y]++; } for (int i = 0; i < N; i++) { ans += arrR[i]; } // 文字列の入力 string s = Console.ReadLine(); //出力 Console.WriteLine(ans); } }
using System; class Program { static void Main(string[] args) { int ans = 0; // 整数の入力 // int a = int.Parse(Console.ReadLine()); // スペース区切りの整数の入力 string[] input = Console.ReadLine().Split(' '); int N = int.Parse(input[0]); int M = int.Parse(input[1]); int[] arrB = { 0, 1, 1 }; Array.Resize(ref arrB, N + 1); int[] arrR = { 0, 1, 0 }; Array.Resize(ref arrR, N + 1); for (int i = 2; i <= N; i++) { arrB[i] = 1; arrR[i] = 0; } for (int i = 0; i < M; i++) { string[] input2 = Console.ReadLine().Split(' '); int x = int.Parse(input2[0]); int y = int.Parse(input2[1]); if (arrR[x] == 1) { if (arrB[x] == 1) { arrR[x] = 0; arrR[y] = 1; } else { arrR[x] = 1; arrR[y] = 1; } } arrB[x]--; arrB[y]++; } for (int i = 1; i <= N; i++) { ans += arrR[i]; } // 文字列の入力 string s = Console.ReadLine(); //出力 Console.WriteLine(ans); Console.ReadLine(); } }
[["+", 0, 198, 0, 200, 0, 212, 0, 229, 0, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 229, 0, 21], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19], ["-", 0, 213, 3, 4, 0, 28, 0, 204, 205, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 204, 205, 22], ["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 201, 0, 195, 8, 196, 0, 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]]
8
312
20
using System; using System.Text.RegularExpressions; using System.Linq; using System.Collections.Generic; using System.IO; using System.Numerics; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var str = Console.ReadLine().Split(); var n = Int32.Parse(str[0]); var l = Int32.Parse(str[1]); str = Console.ReadLine().Split(); var a = str.Select(s => Int32.Parse(s)).ToList(); var tgt = -1; for (int i = 0; i < n - 1; i++) { if (a[i] + a[i + 1] >= l) { tgt = i; break; } } if (tgt == -1) { Console.WriteLine("Impossible"); return; } for (int i = 0; i < tgt; i++) { Console.WriteLine(i + 1); } for (int i = n - 1; i > tgt; i--) { Console.WriteLine(i); } } } }
using System; using System.Text.RegularExpressions; using System.Linq; using System.Collections.Generic; using System.IO; using System.Numerics; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var str = Console.ReadLine().Split(); var n = Int32.Parse(str[0]); var l = Int32.Parse(str[1]); str = Console.ReadLine().Split(); var a = str.Select(s => Int32.Parse(s)).ToList(); var tgt = -1; for (int i = 0; i < n - 1; i++) { if (a[i] + a[i + 1] >= l) { tgt = i; break; } } if (tgt == -1) { Console.WriteLine("Impossible"); return; } Console.WriteLine("Possible"); for (int i = 0; i < tgt; i++) { Console.WriteLine(i + 1); } for (int i = n - 1; i > tgt; i--) { Console.WriteLine(i); } } } }
[["+", 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, 213, 3, 4, 0, 28, 0, 5, 0, 62], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35]]
8
241
9
using System; using System.Linq; using System.Linq.Expressions; using System.Collections.Generic; using Debug = System.Diagnostics.Debug; using StringBuilder = System.Text.StringBuilder; using System.Numerics; using Number = System.Int64; namespace Program { public class Solver { public void Solve() { var n = sc.Integer(); var a = sc.Integer(n).ToList(); a.Sort(); a.Reverse(); for (int i = 0; i < n; i++) a[i]--; var p = 0; for (;;) { if (p + 1 >= n) break; if (p + 1 > a[p + 1]) break; p++; } var u = a[p] - p; var v = p; for (;;) { if (v + 1 >= n) break; if (v > a[v + 1]) break; v++; } v -= p; if (u % 2 == 0 && v % 2 == 0) IO.Printer.Out.WriteLine("Second"); else IO.Printer.Out.WriteLine("First"); } public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput()); static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; } static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; } } } #region main static class Ex { static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); } static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); } static public void Main() { var solver = new Program.Solver(); solver.Solve(); Program.IO.Printer.Out.Flush(); } } #endregion #region Ex namespace Program.IO { using System.IO; using System.Text; using System.Globalization; public class Printer : StreamWriter { static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; } public static Printer Out { get; set; } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) {} public Printer(System.IO.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()); } } public class StreamScanner { public StreamScanner(Stream stream) { str = stream; } public 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) return 0; 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) && !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 = 0; 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 (; true; b = read()) { if (b < '0' || '9' < b) return ng ? -ret : ret; else 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; } private 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); } } } #endregion
using System; using System.Linq; using System.Linq.Expressions; using System.Collections.Generic; using Debug = System.Diagnostics.Debug; using StringBuilder = System.Text.StringBuilder; using System.Numerics; using Number = System.Int64; namespace Program { public class Solver { public void Solve() { var n = sc.Integer(); var a = sc.Integer(n); for (int i = 0; i < n; i++) a[i]--; Array.Sort(a); Array.Reverse(a); var p = 0; for (;;) { if (p + 1 >= n) break; if (p + 1 > a[p + 1]) break; p++; } var u = a[p] - p; var v = p; for (;;) { if (v + 1 >= n) break; if (p > a[v + 1]) break; v++; } v -= p; if (u % 2 == 0 && v % 2 == 0) IO.Printer.Out.WriteLine("Second"); else IO.Printer.Out.WriteLine("First"); } public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput()); static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; } static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; } } } #region main static class Ex { static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); } static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); } static public void Main() { var solver = new Program.Solver(); solver.Solve(); Program.IO.Printer.Out.Flush(); } } #endregion #region Ex namespace Program.IO { using System.IO; using System.Text; using System.Globalization; public class Printer : StreamWriter { static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; } public static Printer Out { get; set; } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) {} public Printer(System.IO.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()); } } public class StreamScanner { public StreamScanner(Stream stream) { str = stream; } public 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) return 0; 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) && !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 = 0; 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 (; true; b = read()) { if (b < '0' || '9' < b) return ng ? -ret : ret; else 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; } private 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); } } } #endregion
[["-", 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, 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], ["-", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["-", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35], ["+", 0, 195, 8, 196, 0, 7, 8, 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, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35], ["-", 0, 7, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 31, 22]]
8
1,311
32
using System; class Program { static void Main() { int i = 0; while (i++ < 9) { int j = 0; while (j < 9 * i) { Console.WriteLine(i + "x" + j + "=" + (j += i)); } } } }
using System; class Program { static void Main() { int i = 0; while (i++ < 9) { int j = 0; while (j++ < 9) { Console.WriteLine(i + "x" + j + "=" + i * j); } } } }
[["+", 8, 196, 0, 52, 15, 16, 31, 223, 0, 29], ["-", 8, 196, 0, 52, 15, 16, 12, 16, 17, 48], ["-", 8, 196, 0, 52, 15, 16, 12, 16, 12, 22], ["-", 3, 4, 0, 28, 0, 16, 12, 23, 0, 24], ["-", 0, 28, 0, 16, 12, 23, 0, 11, 31, 22], ["-", 0, 16, 12, 23, 0, 11, 0, 202, 0, 107], ["-", 3, 4, 0, 28, 0, 16, 12, 23, 0, 25], ["+", 3, 4, 0, 28, 0, 16, 12, 16, 17, 48], ["+", 3, 4, 0, 28, 0, 16, 12, 16, 12, 22]]
8
66
11
using System; class Program { static void Main() { int i = 0; while (i++ < 9) { int j = 0; while (j < 9 * i) { Console.WriteLine(i + "x" + j + "=" + (j += i)); } } } }
using System; class Program { static void Main() { int i = 0; while (i++ < 9) { int j = 0; while (j++ < 9) Console.WriteLine(i + "x" + j + "=" + i * j); } } }
[["+", 8, 196, 0, 52, 15, 16, 31, 223, 0, 29], ["-", 8, 196, 0, 52, 15, 16, 12, 16, 17, 48], ["-", 8, 196, 0, 52, 15, 16, 12, 16, 12, 22], ["-", 0, 52, 8, 196, 0, 52, 8, 196, 0, 45], ["-", 3, 4, 0, 28, 0, 16, 12, 23, 0, 24], ["-", 0, 28, 0, 16, 12, 23, 0, 11, 31, 22], ["-", 0, 16, 12, 23, 0, 11, 0, 202, 0, 107], ["-", 3, 4, 0, 28, 0, 16, 12, 23, 0, 25], ["+", 3, 4, 0, 28, 0, 16, 12, 16, 17, 48], ["+", 3, 4, 0, 28, 0, 16, 12, 16, 12, 22], ["-", 0, 52, 8, 196, 0, 52, 8, 196, 0, 46]]
8
66
11
using System; namespace hellounihara { class MainClass { public static void Main(string[] args) { int[] arr = new int[10]; Random rmd = new Random(); for (int i = 0; i < 10; i++) { arr[i] = rmd.Next(10000); // Console.WriteLine(arr[i]); } for (int i = 0; i < arr.Length - 1; i++) { for (int j = arr.Length - 1; i < j; j--) { if (arr[j] < arr[j - 1]) { int t = arr[j]; arr[j] = arr[j - 1]; arr[j - 1] = t; } } } for (int k = 9; k > 6; k--) { Console.WriteLine(arr[k]); } } } }
using System; namespace hellounihara { class MainClass { public static void Main(string[] args) { int[] arr = new int[10]; // Random rmd = new Random (); for (int i = 0; i < 10; i++) { arr[i] = int.Parse(Console.ReadLine()); // Console.WriteLine(arr[i]); } for (int i = 0; i < arr.Length - 1; i++) { for (int j = arr.Length - 1; i < j; j--) { if (arr[j] < arr[j - 1]) { int t = arr[j]; arr[j] = arr[j - 1]; arr[j - 1] = t; } } } for (int k = 9; k > 6; k--) { Console.WriteLine(arr[k]); } } } }
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 22], ["-", 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, 230, 0, 228], ["-", 0, 198, 0, 200, 0, 212, 0, 230, 39, 22], ["-", 0, 200, 0, 212, 0, 230, 3, 4, 0, 24], ["-", 0, 200, 0, 212, 0, 230, 3, 4, 0, 25], ["-", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35], ["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 22], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["-", 0, 1, 0, 11, 12, 213, 63, 214, 141, 22], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 141, 22], ["-", 0, 11, 12, 213, 3, 4, 0, 28, 0, 203], ["+", 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, 213, 3, 4, 0, 25]]
8
182
18
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class ListofTop3Hills { static void Main(string[] args) { List<int> param = new List<int>(); for (int i = 0; i < 10; i++) { param.Add(int.Parse(System.Console.ReadLine())); } param.Sort(); for (int j = 9; j >= 0; j--) { System.Console.WriteLine(param[j]); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class ListofTop3Hills { static void Main(string[] args) { List<int> param = new List<int>(); for (int i = 0; i < 10; i++) { param.Add(int.Parse(System.Console.ReadLine())); } param.Sort(); for (int j = 9; j > 6; j--) { System.Console.WriteLine(param[j]); } System.Console.ReadLine(); } } }
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 20], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 1, 0, 213, 63, 214, 205, 214, 205, 22], ["+", 0, 1, 0, 213, 63, 214, 205, 214, 0, 131], ["+", 0, 1, 0, 213, 63, 214, 205, 214, 141, 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], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35]]
8
121
12
using System; class Test { static void Main() { int m1 = 0, m2 = 0, m3 = 0, h; int i; for (i = 0; i < 10; i++) { h = int.Parse(Console.ReadLine()); if (m1 < h) { m3 = m2; m2 = m1; m1 = h; } else if (m2 < h) { m3 = m2; m2 = h; } else m3 = h; } Console.WriteLine("{0}\n{1}\n{2}", m1, m2, m3); } }
using System; class Test { static void Main() { int m1 = 0, m2 = 0, m3 = 0, h; int i; for (i = 0; i < 10; i++) { h = int.Parse(Console.ReadLine()); if (m1 < h) { m3 = m2; m2 = m1; m1 = h; } else if (m2 < h) { m3 = m2; m2 = h; } else if (m3 < h) { m3 = h; } } Console.WriteLine("{0}\n{1}\n{2}", m1, m2, m3); } }
[["+", 8, 196, 0, 57, 75, 57, 75, 57, 0, 121], ["+", 8, 196, 0, 57, 75, 57, 75, 57, 0, 24], ["+", 0, 57, 75, 57, 75, 57, 15, 16, 31, 22], ["+", 0, 57, 75, 57, 75, 57, 15, 16, 17, 18], ["+", 0, 57, 75, 57, 75, 57, 15, 16, 12, 22], ["+", 8, 196, 0, 57, 75, 57, 75, 57, 0, 25], ["+", 0, 57, 75, 57, 75, 57, 64, 196, 0, 45], ["+", 0, 57, 75, 57, 75, 57, 64, 196, 0, 46]]
8
121
8
using System; using System.Collections.Generic; using System.IO; namespace Hill { class Program { static void Main(string[] args) { List<int> list = new List<int>(); var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; string str; Console.SetOut(sw); for (int i = 0; i < 3; i++) { str = Console.ReadLine(); list.Add(int.Parse(str)); } list.Reverse(); for (int i = 0; i < list.Count; i++) { Console.WriteLine(list[i]); } Console.Out.Flush(); } } }
using System; using System.Collections.Generic; using System.IO; namespace Hill { class Program { static void Main() { var list = new List<int>(); var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; string str; Console.SetOut(sw); for (int i = 0; i < 10; i++) { str = Console.ReadLine(); list.Add(int.Parse(str)); } list.Sort(); list.Reverse(); for (int i = 0; i < 3; i++) { Console.WriteLine(list[i]); } Console.Out.Flush(); } } }
[["-", 0, 195, 54, 55, 0, 220, 39, 224, 39, 199], ["-", 54, 55, 0, 220, 39, 224, 225, 226, 0, 70], ["-", 54, 55, 0, 220, 39, 224, 225, 226, 0, 73], ["-", 8, 201, 0, 195, 54, 55, 0, 220, 141, 22], ["-", 8, 196, 0, 197, 0, 198, 39, 236, 141, 22], ["-", 0, 197, 0, 198, 39, 236, 237, 238, 0, 18], ["-", 0, 197, 0, 198, 39, 236, 237, 238, 0, 199], ["-", 0, 197, 0, 198, 39, 236, 237, 238, 0, 47], ["+", 8, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 201, 0, 195, 8, 196, 0, 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, 7, 15, 16, 12, 214, 205, 22], ["-", 8, 196, 0, 7, 15, 16, 12, 214, 0, 131], ["-", 8, 196, 0, 7, 15, 16, 12, 214, 141, 22]]
8
154
21
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { int a = int.Parse(Console.ReadLine()); int b = int.Parse(Console.ReadLine()); int c = int.Parse(Console.ReadLine()); int d = int.Parse(Console.ReadLine()); int e = int.Parse(Console.ReadLine()); int f = int.Parse(Console.ReadLine()); int g = int.Parse(Console.ReadLine()); int h = int.Parse(Console.ReadLine()); int i = int.Parse(Console.ReadLine()); int j = int.Parse(Console.ReadLine()); int[] sss = { a, b, c, d, e, f, g, h, i, j }; Array.Sort(sss); Array.Reverse(sss); Console.Write("{0}\n", sss[9]); Console.Write("{0}\n", sss[8]); Console.Write("{0}\n", sss[7]); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { int a = int.Parse(Console.ReadLine()); int b = int.Parse(Console.ReadLine()); int c = int.Parse(Console.ReadLine()); int d = int.Parse(Console.ReadLine()); int e = int.Parse(Console.ReadLine()); int f = int.Parse(Console.ReadLine()); int g = int.Parse(Console.ReadLine()); int h = int.Parse(Console.ReadLine()); int i = int.Parse(Console.ReadLine()); int j = int.Parse(Console.ReadLine()); int[] sss = { a, b, c, d, e, f, g, h, i, j }; Array.Sort(sss); Console.Write("{0}\n", sss[9]); Console.Write("{0}\n", sss[8]); Console.Write("{0}\n", sss[7]); } } }
[["-", 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
265
7
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication32 { class Program { static void Main() { int[] a = new int[10]; for (int b = 0; b < 10; b++) a[b] = int.Parse(Console.ReadLine()); Array.Sort(a); Console.WriteLine(a[0]); Console.WriteLine(a[1]); Console.WriteLine(a[2]); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication32 { class Program { static void Main() { int[] a = new int[10]; for (int b = 0; b < 10; b++) a[b] = int.Parse(Console.ReadLine()); Array.Sort(a); Console.WriteLine(a[9]); Console.WriteLine(a[8]); Console.WriteLine(a[7]); } } }
[["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203]]
8
113
6
using System; namespace ListofTop3Hills { class Program { static void Main(string[] args) { string str; int strint; string[] m = new string[10]; int i; for (i = 0; i < 10; ++i) { str = Console.ReadLine(); strint = int.Parse(str); if (strint >= 0 && strint <= 10000) { m[i] = strint.ToString(); } } Array.Sort(m); Array.Reverse(m); for (i = 0; i < 3; ++i) { Console.WriteLine(m[i]); } } } }
using System; namespace ListofTop3Hills { class Program { static void Main(string[] args) { string str; int strint; int[] m = new int[10]; int i; for (i = 0; i < 10; ++i) { str = Console.ReadLine(); strint = int.Parse(str); m[i] = strint; } Array.Sort(m); Array.Reverse(m); for (i = 0; i < 3; ++i) { Console.WriteLine(m[i]); } } } }
[["-", 8, 196, 0, 197, 0, 198, 39, 224, 39, 199], ["+", 8, 196, 0, 197, 0, 198, 39, 224, 39, 199], ["-", 0, 200, 0, 212, 0, 227, 39, 224, 39, 199], ["+", 0, 200, 0, 212, 0, 227, 39, 224, 39, 199], ["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 8, 196, 0, 7, 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, 20], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203], ["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 98], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 31, 22], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 19], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 12, 203], ["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 25], ["-", 0, 7, 8, 196, 0, 57, 64, 196, 0, 45], ["-", 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], ["-", 0, 1, 0, 11, 12, 213, 3, 4, 0, 25], ["-", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46]]
8
136
20
using System; public class two { public static void Main() { int[] heights = new int[10]; for (int i = 0; i < 10; i++) { heights[i] = int.Parse(Console.ReadLine()); } sort(heights); Console.WriteLine(heights[0]); Console.WriteLine(heights[1]); Console.WriteLine(heights[2]); } private static int[] sort(int[] val) { //??????????????? for (int i = 0; i < val.Length - 1; ++i) { if (val[i] < val[i + 1]) { int temp = val[i]; val[i] = val[i + 1]; val[i + 1] = temp; } } return val; } }
using System; public class two { public static void Main() { int[] heights = new int[10]; for (int i = 0; i < 10; i++) { heights[i] = int.Parse(Console.ReadLine()); } sort(heights); Console.WriteLine(heights[0]); Console.WriteLine(heights[1]); Console.WriteLine(heights[2]); } private static int[] sort(int[] val) { //??????????????? for (int j = 0; j < val.Length - 1; ++j) { for (int i = 0; i < val.Length - 1; ++i) { if (val[i] < val[i + 1]) { int temp = val[i]; val[i] = val[i + 1]; val[i + 1] = temp; } } } return val; } }
[["+", 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, 7, 15, 16, 12, 16, 31, 214, 205, 22], ["+", 0, 7, 15, 16, 12, 16, 31, 214, 0, 131], ["+", 0, 7, 15, 16, 12, 16, 31, 214, 141, 22], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 26, 241, 0, 29], ["+", 0, 195, 8, 196, 0, 7, 26, 241, 0, 22], ["+", 8, 201, 0, 195, 8, 196, 0, 7, 0, 25], ["+", 0, 195, 8, 196, 0, 7, 8, 196, 0, 45], ["+", 8, 196, 0, 7, 8, 196, 0, 7, 0, 88], ["+", 8, 196, 0, 7, 8, 196, 0, 7, 0, 24], ["+", 0, 7, 8, 196, 0, 7, 10, 198, 39, 199], ["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46]]
8
177
20
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int[] data = new int[10]; for (int i = 0; i < 10; i++) { data[i] = int.Parse(Console.ReadLine()); } Array.Sort(data); for (int i = 0; i < 3; i++) { Console.WriteLine(data[i]); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int[] data = new int[10]; for (int i = 0; i < 10; i++) { data[i] = int.Parse(Console.ReadLine()); } Array.Sort(data); for (int i = 9; i > 6; i--) { Console.WriteLine(data[i]); } } } }
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 47], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["-", 0, 195, 8, 196, 0, 7, 26, 223, 0, 29], ["+", 0, 195, 8, 196, 0, 7, 26, 223, 0, 68]]
8
115
8
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var list = args.Select(int.Parse).ToList(); list.Sort(); Console.WriteLine(list.AsEnumerable() .Reverse() .Take(3) .Select(_ => _.ToString()) .Aggregate((a, b) => a + Environment.NewLine + b)); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var list = Enumerable.Range(0, 10) .Select(_ => int.Parse(Console.ReadLine())) .ToList(); list.Sort(); Console.WriteLine(list.AsEnumerable() .Reverse() .Take(3) .Select(_ => _.ToString()) .Aggregate((a, b) => a + Environment.NewLine + b)); } } }
[["-", 0, 213, 63, 214, 205, 213, 63, 214, 205, 22], ["+", 205, 213, 63, 214, 205, 213, 63, 214, 205, 22], ["+", 205, 213, 63, 214, 205, 213, 63, 214, 0, 131], ["+", 205, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 205, 213, 63, 214, 205, 213, 3, 4, 0, 24], ["+", 63, 214, 205, 213, 3, 4, 0, 28, 0, 203], ["+", 205, 213, 63, 214, 205, 213, 3, 4, 0, 21], ["+", 205, 213, 63, 214, 205, 213, 3, 4, 0, 25], ["+", 0, 28, 0, 218, 54, 219, 0, 220, 141, 22], ["+", 205, 213, 3, 4, 0, 28, 0, 218, 0, 221], ["+", 0, 28, 0, 218, 8, 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], ["+", 3, 4, 0, 28, 0, 213, 3, 4, 0, 25], ["+", 0, 28, 0, 218, 8, 213, 3, 4, 0, 25]]
8
109
18
using System; class main { static void Main(string[] args) { int[] a = new int[10]; for (int i = 0; i < a.Length; ++i) { a[i - 1] = int.Parse(Console.ReadLine()); } Array.Sort(a); Array.Reverse(a); for (int r = 0; r < 3; ++r) { Console.WriteLine(a[r]); } /*for (int a = 1; a <= 9; ++a) { for (int b = 1; b <= 9; ++b) { Console.WriteLine(a + "x" + b + "=" + (a*b)); } }*/ // Console.WriteLine((j*j*Math.PI) + " " + (2*j*Math.PI)); /*int d = a[0] / a[1]; int r = a[0] % a[1]; decimal f = (decimal)a[0] / (decimal)a[1]; Console.WriteLine(d + " " + r + " " + f);*/ /*int i = 1; while (true) { string[] s = Console.ReadLine().Split(' '); a[0] = int.Parse(s[0]); a[1] = int.Parse(s[1]); if (a[0] == 0 && a[1] == 0) break; Array.Sort(a); Console.WriteLine(a[0] + " " + a[1]); i++; }*/ /*if (y < x) { Console.WriteLine("a" + " < " + "b"); } if (y > x) { Console.WriteLine("a" + " > " + "b"); } if (y == x) { Console.WriteLine("a" + " == " + "b"); }*/ // Array.Sort(a); /*Console.WriteLine(a[0] + " " + a[1] + " " + a[2]); while(g <= 1000) { Console.WriteLine("Hello World"); ++g; }*/ /*int i = 1; while (true) { string s = Console.ReadLine(); if (s == "0") break; Console.WriteLine("Case {0}: {1}", i, s); i++; }*/ /*for (int s = 0; s < j.Length; ++s) { Console.WriteLine("Case " + (s+1) + ": " + j[s]); } Console.WriteLine(g);*/ Console.ReadKey(); } }
using System; class main { static void Main(string[] args) { int[] a = new int[10]; for (int i = 0; i < a.Length; ++i) { a[i] = int.Parse(Console.ReadLine()); } Array.Sort(a); Array.Reverse(a); for (int i = 0; i < 3; ++i) { Console.WriteLine(a[i]); } // Console.ReadKey(); } }
[["-", 31, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["-", 31, 204, 206, 207, 0, 28, 0, 16, 12, 203], ["-", 8, 196, 0, 7, 10, 198, 0, 200, 141, 22], ["+", 8, 196, 0, 7, 10, 198, 0, 200, 141, 22], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 31, 22], ["-", 0, 195, 8, 196, 0, 7, 26, 241, 0, 22], ["+", 0, 195, 8, 196, 0, 7, 26, 241, 0, 22], ["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 22], ["+", 0, 28, 0, 204, 206, 207, 0, 28, 0, 22], ["-", 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], ["-", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["-", 8, 201, 0, 195, 8, 196, 0, 1, 0, 35]]
8
120
16
using System; using System.Collections.Generic; using System.Text; namespace mondai0002 { class Program { static void Main(string[] args) { string input; int a = 0; int b = 0; while (true) { input = Console.ReadLine(); if (input.Equals("")) { break; } a = int.Parse(input.Split(' ')[0]); b = int.Parse(input.Split(' ')[1]); Console.Write((a + b).ToString().Length); } } } }
using System; using System.Collections.Generic; using System.Text; namespace mondai0002 { class Program { static void Main(string[] args) { string input; int a = 0; int b = 0; int sum = 0; while (true) { input = Console.ReadLine(); if (input == null || input.Equals("")) { break; } a = int.Parse(input.Split(' ')[0]); b = int.Parse(input.Split(' ')[1]); sum = a + b; Console.WriteLine(sum.ToString().Length); } } } }
[["+", 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, 57, 15, 16, 31, 16, 17, 60], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 215], ["+", 0, 52, 8, 196, 0, 57, 15, 16, 17, 106], ["+", 0, 57, 15, 16, 12, 213, 63, 214, 205, 22], ["-", 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, 214, 205, 213, 63, 214, 205, 23, 0, 24], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 8, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["-", 0, 214, 205, 213, 63, 214, 205, 23, 0, 25], ["+", 8, 196, 0, 52, 8, 196, 0, 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, 28, 0, 214, 205, 213, 63, 214, 205, 22]]
8
130
23
using System; namespace hellounihara { class MainClass { public static void Main(string[] args) { for (int i = 0; i < 200; i++) { int a = 0; string arr02 = Console.ReadLine(); if (arr02 == null) { break; } string[] starr02 = arr02.Split(); foreach (var item in starr02) { a += int.Parse(item); } Console.WriteLine(a); } } } }
using System; namespace hellounihara { class MainClass { public static void Main(string[] args) { for (int i = 0; i < 200; i++) { int a = 0; string arr02 = Console.ReadLine(); if (arr02 == null) { break; } string[] starr02 = arr02.Split(); foreach (var item in starr02) { a += int.Parse(item); } int digit = a.ToString().Length; Console.WriteLine(digit); } } } }
[["+", 0, 7, 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, 212, 0, 214, 205, 213, 63, 214, 205, 22], ["+", 0, 212, 0, 214, 205, 213, 63, 214, 0, 131], ["+", 0, 212, 0, 214, 205, 213, 63, 214, 141, 22], ["+", 0, 212, 0, 214, 205, 213, 3, 4, 0, 24], ["+", 0, 212, 0, 214, 205, 213, 3, 4, 0, 25], ["+", 0, 198, 0, 200, 0, 212, 0, 214, 0, 131], ["+", 0, 198, 0, 200, 0, 212, 0, 214, 141, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 197, 0, 35], ["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
8
99
13
using System; namespace AIZUJudge { class Disit { static void Main(string[] args) { string data = Console.ReadLine(); string[] tmp = data.Split(' '); int a = int.Parse(tmp[0]); int b = int.Parse(tmp[1]); int sum = a + b; int i = 1; while (true) { if (sum < Math.Pow(10, i)) { Console.WriteLine(i); break; } i++; } } } }
using System; namespace AIZUJudge { class Disit { static void Main(string[] args) { while (true) { string data = Console.ReadLine(); if (string.IsNullOrEmpty(data)) break; string[] tmp = data.Split(' '); int a = int.Parse(tmp[0]); int b = int.Parse(tmp[1]); int sum = a + b; int i = 1; while (true) { if (sum < Math.Pow(10, i)) { Console.WriteLine(i); break; } i++; } } } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 52, 0, 89], ["+", 8, 201, 0, 195, 8, 196, 0, 52, 0, 24], ["+", 0, 195, 8, 196, 0, 52, 15, 211, 0, 146], ["+", 8, 201, 0, 195, 8, 196, 0, 52, 0, 25], ["+", 0, 195, 8, 196, 0, 52, 8, 196, 0, 45], ["+", 8, 196, 0, 52, 8, 196, 0, 57, 0, 121], ["+", 8, 196, 0, 52, 8, 196, 0, 57, 0, 24], ["+", 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], ["+", 0, 57, 15, 213, 3, 4, 0, 28, 0, 22], ["+", 8, 196, 0, 57, 15, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 52, 8, 196, 0, 57, 0, 25], ["+", 0, 52, 8, 196, 0, 57, 64, 93, 0, 94], ["+", 0, 52, 8, 196, 0, 57, 64, 93, 0, 35], ["+", 8, 196, 0, 197, 0, 198, 39, 224, 39, 199], ["+", 0, 52, 8, 196, 0, 52, 8, 196, 0, 46]]
8
116
17
using System; using System.Linq; using System.Collections.Generic; namespace _0002 { class Program { static void Main(string[] args) { List<int> b = new List<int>(); string input; for (int i = 0; i < 10; i++) { input = Console.ReadLine(); if (input == "") { break; } int[] x = input.Split().Select(int.Parse).ToArray(); b.Add((x[0] + x[1]).ToString().Length); } foreach (var i in b) { Console.WriteLine(i); } } } }
using System; using System.Linq; using System.Collections.Generic; namespace _0002 { class Program { static void Main(string[] args) { List<int> b = new List<int>(); string input; while (true) { input = Console.ReadLine(); if (input == null) { break; } int[] x = input.Split().Select(int.Parse).ToArray(); b.Add((x[0] + x[1]).ToString().Length); } foreach (var i in b) { Console.WriteLine(i); } } } }
[["-", 8, 201, 0, 195, 8, 196, 0, 7, 0, 88], ["+", 8, 201, 0, 195, 8, 196, 0, 52, 0, 89], ["-", 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, 203], ["-", 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, 52, 15, 211, 0, 146], ["-", 8, 196, 0, 57, 15, 16, 12, 5, 0, 62], ["+", 0, 52, 8, 196, 0, 57, 15, 16, 12, 215]]
8
147
17
using System; using System.Collections.Generic; using System.Linq; namespace AOJ0002 { class Program { static void Main(string[] args) { var inputStr = (Console.ReadLine()); var q = inputStr.Split(' '); var i = q.Sum(s => Convert.ToInt32(s)); Console.WriteLine(i.ToString().Length); } } }
using System; using System.Collections.Generic; using System.Linq; namespace AOJ0002 { class Program { private static void Main(string[] args) { for (;;) { var inputStr = Console.ReadLine(); if (inputStr == null) break; var q = inputStr.Split(' '); var i = q.Sum(s => Convert.ToInt32(s)); Console.WriteLine(i.ToString().Length); } } } }
[["+", 0, 235, 8, 201, 0, 195, 0, 251, 0, 261], ["+", 0, 235, 8, 201, 0, 195, 54, 55, 0, 25], ["+", 0, 235, 8, 201, 0, 195, 8, 196, 0, 45], ["+", 8, 201, 0, 195, 8, 196, 0, 7, 0, 88], ["+", 8, 201, 0, 195, 8, 196, 0, 7, 0, 24], ["+", 8, 201, 0, 195, 8, 196, 0, 7, 0, 35], ["-", 0, 198, 0, 200, 0, 212, 0, 23, 0, 24], ["+", 8, 196, 0, 7, 8, 196, 0, 197, 0, 35], ["+", 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, 215], ["+", 0, 7, 8, 196, 0, 57, 64, 93, 0, 94], ["+", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46]]
8
87
16
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication40 { class Program { static void Main() { int A, B; A = B = 0; while (true) { string C = Console.ReadLine(); if (C == null) break; int[] D = C.Split(',').Select(int.Parse).ToArray(); if (D[0] * D[0] + D[1] * D[1] == D[2] * D[2]) A++; if (D[0] == D[1]) B++; } Console.WriteLine(A + " " + B); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication40 { class Program { static void Main() { int A, B; A = B = 0; while (true) { string C = Console.ReadLine(); if (C == null) break; int[] D = C.Split(',').Select(int.Parse).ToArray(); if (D[0] * D[0] + D[1] * D[1] == D[2] * D[2]) A++; if (D[0] == D[1]) B++; } Console.WriteLine(A); Console.WriteLine(B); } } }
[["-", 3, 4, 0, 28, 0, 16, 31, 16, 17, 72], ["-", 0, 28, 0, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 28, 0, 16, 31, 16, 12, 5, 0, 222], ["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 201, 0, 195, 8, 196, 0, 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]]
8
157
11
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class triangle { static void Main(string[] args) { int num = int.Parse(System.Console.ReadLine()); List<int> param = new List<int> { 0, 0, 0 }; for (int i = 0; i < num; i++) { string[] tmp = System.Console.ReadLine().Split(' '); param[0] = int.Parse(tmp[0]); param[1] = int.Parse(tmp[1]); param[2] = int.Parse(tmp[2]); param.Sort(); System.Console.WriteLine( Math.Pow(param[2], 2) == Math.Pow(param[1], 2) + Math.Pow(param[0], 2) ? "OK" : "NG"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class triangle { static void Main(string[] args) { int num = int.Parse(System.Console.ReadLine()); List<int> param = new List<int> { 0, 0, 0 }; for (int i = 0; i < num; i++) { string[] tmp = System.Console.ReadLine().Split(' '); param[0] = int.Parse(tmp[0]); param[1] = int.Parse(tmp[1]); param[2] = int.Parse(tmp[2]); param.Sort(); System.Console.WriteLine( Math.Pow(param[2], 2) == Math.Pow(param[1], 2) + Math.Pow(param[0], 2) ? "YES" : "NO"); } } } }
[["-", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["-", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222]]
8
212
4
using System; using System.Collections.Generic; namespace Volume0_0003 { class Program { static void Main(string[] args) { int len = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < len; i++) { var list = new List<int>(3); String[] inputs = Console.ReadLine().Split(' '); list.Add(Convert.ToInt32(inputs[0])); list.Add(Convert.ToInt32(inputs[1])); list.Add(Convert.ToInt32(inputs[2])); list.Sort(); if (list[0] * list[0] + list[1] * list[1] == list[2] * list[2]) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } } }
using System; using System.Collections.Generic; namespace Volume0_0003 { class Program { static void Main(string[] args) { int len = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < len; i++) { var list = new List<int>(3); String[] inputs = Console.ReadLine().Split(' '); list.Add(Convert.ToInt32(inputs[0])); list.Add(Convert.ToInt32(inputs[1])); list.Add(Convert.ToInt32(inputs[2])); list.Sort(); if (list[0] * list[0] + list[1] * list[1] == list[2] * list[2]) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
195
4
using System; namespace prime { class Program { static void Main() { while (true) { int n, ans = 0; if (int.TryParse(Console.ReadLine(), out n)) { for (int i = 2; i <= n; ++i) { if (IsPrime(i)) ans += i; } Console.WriteLine(ans); } else break; } } public static bool IsPrime(int a) { if (a == 1) return false; else if (a < 4) return true; else { bool prime = true; int ma = (int)Math.Sqrt(a + 1); int i = 3; if (a % 2 == 0) prime = false; else { for (; i <= ma; i += 2) { if (a % i == 0) { prime = false; break; } } } return prime; } } } }
using System; namespace prime { class Program { static void Main() { while (true) { int n, ans = 0; if (int.TryParse(Console.ReadLine(), out n)) { for (int i = 2; i <= n; ++i) { if (IsPrime(i)) ++ans; } Console.WriteLine(ans); } else break; } } public static bool IsPrime(int a) { if (a == 1) return false; else if (a < 4) return true; else { bool prime = true; int ma = (int)Math.Sqrt(a + 1); int i = 3; if (a % 2 == 0) prime = false; else { for (; i <= ma; i += 2) { if (a % i == 0) { prime = false; break; } } } return prime; } } } }
[["+", 8, 196, 0, 57, 64, 1, 0, 241, 0, 29], ["-", 0, 57, 64, 1, 0, 11, 0, 202, 0, 107], ["-", 8, 196, 0, 57, 64, 1, 0, 11, 12, 22]]
8
190
3
using System; class test { public static void Main() { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { Console.WriteLine(i + "x" + j + "=" + i * j); } } } }
using System; class test { public static void Main() { for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { Console.WriteLine(i + "x" + j + "=" + i * j); } } } }
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
8
68
4
using System; using System.Linq; namespace _0032 { class Program { static void Main(string[] args) { int a = 0; int b = 0; while (true) { string s = Console.ReadLine(); if (s == null) { break; } int[] x = s.Split(',').Select(int.Parse).ToArray(); if (x[0] * x[0] == x[1] * x[1] + x[2] * x[2]) { a++; } if (x[0] == x[1]) { b++; } } Console.WriteLine(a); Console.WriteLine(b); } } }
using System; using System.Linq; namespace _0032 { class Program { static void Main(string[] args) { int a = 0; int b = 0; while (true) { string s = Console.ReadLine(); if (s == null) { break; } int[] x = s.Split(',').Select(int.Parse).ToArray(); if (x[0] * x[0] + x[1] * x[1] == x[2] * x[2]) { a++; } if (x[0] == x[1]) { b++; } } Console.WriteLine(a); Console.WriteLine(b); } } }
[["-", 0, 52, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 72], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 72], ["+", 0, 52, 8, 196, 0, 57, 15, 16, 17, 60]]
8
155
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace QQ { class Program { static void Main(string[] args) { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { Console.WriteLine(i + "*" + j + "=" + i * j); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace QQ { class Program { static void Main(string[] args) { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { Console.WriteLine(i + "x" + j + "=" + i * j); } } } } }
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222]]
8
92
2
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { for (int i = 0; i <= 9; i++) { for (int j = 0; j <= 9; j++) { Console.WriteLine(i.ToString() + "x" + j.ToString() + "=" + i * j); } } Console.ReadLine(); } } }
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { Console.WriteLine(i.ToString() + "x" + j.ToString() + "=" + i * j); } } Console.ReadLine(); } } }
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
8
89
4
using System; class Program { static void Main(string[] args) { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { int answer = i * j; System.Console.WriteLine(i.ToString() + "*" + j.ToString() + "=" + answer.ToString()); } } } }
using System; class Program { static void Main(string[] args) { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { int answer = i * j; System.Console.WriteLine(i.ToString() + "x" + j.ToString() + "=" + answer.ToString()); } } } }
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222]]
8
90
2
using System; class Program { static void Main() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { int re = i * j; Console.Write("{0}X{1}={2}", i, j, re); Console.WriteLine(); } } } }
using System; class Test { static void Main() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { int re = i * j; Console.Write("{0}x{1}={2}", i, j, re); Console.WriteLine(); } } } }
[["-", 36, 36, 36, 36, 0, 208, 0, 235, 141, 22], ["+", 36, 36, 36, 36, 0, 208, 0, 235, 141, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
74
4
class MainClass { static void Main() { for (int i = 1; i <= 9; ++i) { for (int j = 1; j <= 9; ++j) { System.Console.WriteLine(i + "x" + j + "=" + i + j); } } } }
class MainClass { static void Main() { for (int i = 1; i <= 9; ++i) { for (int j = 1; j <= 9; ++j) { System.Console.WriteLine(i + "x" + j + "=" + i * j); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["+", 3, 4, 0, 28, 0, 16, 12, 16, 17, 48]]
8
66
2
using System; using System.Collections.Generic; using System.Linq; namespace Problem0003 { class Program { static void Main(string[] args) { var triples = GetInputLines().Skip(1).Select( line => line.Split().Select(word => int.Parse(word)).ToArray()); foreach (int[] triple in triples) { if (IsRightTriangle(triple)) { Console.WriteLine("YES"); } else { Console.WriteLine("No"); } } } static IEnumerable<string> GetInputLines() { string line; while (!string.IsNullOrEmpty(line = System.Console.ReadLine())) { yield return line; } } static bool IsRightTriangle(int[] triple) { int[] sortedTriple = triple.OrderBy(n => n).ToArray(); int a = sortedTriple[0], b = sortedTriple[1], c = sortedTriple[2]; return a * a + b * b == c * c; } } }
using System; using System.Collections.Generic; using System.Linq; namespace Problem0003 { class Program { static void Main(string[] args) { var triples = GetInputLines().Skip(1).Select( line => line.Split().Select(word => int.Parse(word)).ToArray()); foreach (int[] triple in triples) { if (IsRightTriangle(triple)) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } static IEnumerable<string> GetInputLines() { string line; while (!string.IsNullOrEmpty(line = System.Console.ReadLine())) { yield return line; } } static bool IsRightTriangle(int[] triple) { int[] sortedTriple = triple.OrderBy(n => n).ToArray(); int a = sortedTriple[0], b = sortedTriple[1], c = sortedTriple[2]; return a * a + b * b == c * c; } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
215
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { while (true) { int g = 0; string a = Console.ReadLine(); if (a == null) break; int b = int.Parse(a); for (int e = 2; b >= e; e++) { bool f = false; int h = (int)(Math.Sqrt((double)e)); if (e % 2 == 0) f = true; for (int d = 3; d <= h; d += 2) { if (e % d == 0) f = true; if (f) break; } if (f == false) g++; } Console.WriteLine(g); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { while (true) { int g = 0; string a = Console.ReadLine(); if (a == null) break; int b = int.Parse(a); for (int e = 2; b >= e; e++) { bool f = false; int h = (int)(Math.Sqrt((double)e)); if (e % 2 == 0 && e > 2) f = true; for (int d = 3; d <= h; d += 2) { if (e % d == 0) f = true; if (f) break; } if (f == false) g++; } Console.WriteLine(g); } } } }
[["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 98], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 12, 203]]
8
179
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication40 { class Program { static void Main() { int C = int.Parse(Console.ReadLine()); for (int D = 0; D < C; D++) { int[] E = Console.ReadLine().Split().Select(int.Parse).ToArray(); int[] S = { 0, 0 }; for (int W = 0; W < 10; W++) { Array.Sort(S); if (S[1] < E[W]) S[1] = E[W]; else if (S[0] < E[W]) S[0] = E[W]; else { Console.WriteLine("NO"); break; } } Console.WriteLine("YES"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication40 { class Program { static void Main() { int C = int.Parse(Console.ReadLine()); for (int D = 0; D < C; D++) { int[] E = Console.ReadLine().Split().Select(int.Parse).ToArray(); int[] S = { 0, 0 }; for (int W = 0; W < 10; W++) { Array.Sort(S); if (S[1] < E[W]) S[1] = E[W]; else if (S[0] < E[W]) S[0] = E[W]; else { Console.WriteLine("NO"); goto J; } } Console.WriteLine("YES"); J:; } } } }
[["-", 0, 57, 75, 57, 75, 196, 0, 93, 0, 94], ["+", 0, 57, 75, 57, 75, 196, 0, 126, 0, 127], ["+", 0, 57, 75, 57, 75, 196, 0, 126, 0, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 1, 0, 35], ["+", 8, 196, 0, 7, 8, 196, 0, 97, 0, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 97, 0, 102]]
8
193
6
using System; using System.Collections.Generic; using System.Linq; namespace Miscelleneous { class Program { public static int cin() { return int.Parse(Console.ReadLine()); } static HashSet<int> Prime; static void Main(string[] args) { Filt(50000); int n, Res = 0; while (true) { n = cin(); if (n == 0) return; if ((n & 1) == 1) Res = Prime.Contains(n - 2) ? 1 : 0; else for (int j = 3; j <= n / 2; j++) if (Prime.Contains(j) && Prime.Contains(n - j)) Res++; Console.WriteLine(Res); Res = 0; } } static void Filt(int a) { bool[] Compose = new bool[a]; Compose[0] = true; for (int j = 2; j <= Math.Sqrt(a); j++) { if (Compose[j - 1]) continue; for (int k = 2; k * j <= a; k++) Compose[k * j - 1] = true; } Prime = new HashSet<int>( Compose.Select((i, j) => (i ? 0 : j + 1)).Where(i => i > 0)); } } }
using System; using System.Collections.Generic; using System.Linq; namespace Miscelleneous { class Program { public static int cin() { return int.Parse(Console.ReadLine()); } static HashSet<int> Prime; static void Main(string[] args) { Filt(50000); int n, Res = 0; while (true) { n = cin(); if (n == 0) return; if ((n & 1) == 1) Res = Prime.Contains(n - 2) ? 1 : 0; else for (int j = 2; j <= n / 2; j++) if (Prime.Contains(j) && Prime.Contains(n - j)) Res++; Console.WriteLine(Res); Res = 0; } } static void Filt(int a) { bool[] Compose = new bool[a]; Compose[0] = true; for (int j = 2; j <= Math.Sqrt(a); j++) { if (Compose[j - 1]) continue; for (int k = 2; k * j <= a; k++) Compose[k * j - 1] = true; } Prime = new HashSet<int>( Compose.Select((i, j) => (i ? 0 : j + 1)).Where(i => i > 0)); } } }
[["-", 75, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 75, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
8
292
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace straight_line { class Program { static void Main(string[] args) { string line; while ((line = Console.ReadLine()) != null) { var ab = line.Split().Select(int.Parse).ToArray(); int a = ab[0]; int c = 0; for (int b = 1; b < a + 1; b++) { c += b + 1; } Console.WriteLine(c); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace straight_line { class Program { static void Main(string[] args) { string line; while ((line = Console.ReadLine()) != null) { var ab = line.Split().Select(int.Parse).ToArray(); int a = ab[0]; int c = 0; for (int b = 1; b < a + 1; b++) { c += b + 1; } c -= a - 1; Console.WriteLine(c); } } } }
[["+", 0, 52, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 8, 196, 0, 1, 0, 11, 0, 202, 0, 110], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 12, 203], ["+", 8, 196, 0, 52, 8, 196, 0, 1, 0, 35]]
8
122
6
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace PokerPlaying { class Player { static void Main(string[] args) { int iter = int.Parse(Console.ReadLine()); for (int i = 0; i < iter; i++) { string data = Console.ReadLine(); string[] splitData = data.Split(' '); int[] intHand = toIntData(splitData); Bottol b = new Bottol(); string result = b.fallBall(intHand); Console.WriteLine(result); } } public static int[] toIntData(string[] data) { int[] intData = new int[data.Length]; for (int i = 0; i < data.Length; i++) { intData[i] = int.Parse(data[i]); } return intData; } } class Bottol { int[] perm_Ball; List<int> leftBottom; List<int> rightBottom; public Bottol() { perm_Ball = new int[10]; leftBottom = new List<int>(); leftBottom.Add(0); rightBottom = new List<int>(); rightBottom.Add(0); } public string fallBall(int[] balls) { perm_Ball = balls; for (int i = 0; i < perm_Ball.Length; i++) { bool isAbleToLeft = false; bool isAbleToRight = false; if (i == 0 || perm_Ball[i] > leftBottom.Last()) { isAbleToLeft = true; } if (i == 0 || perm_Ball[i] > rightBottom.Last()) { isAbleToRight = true; } if (!isAbleToLeft && !isAbleToRight) { break; } if (isAbleToLeft) { leftBottom.Add(perm_Ball[i]); } else if (!isAbleToLeft && isAbleToRight) { rightBottom.Add(perm_Ball[i]); } if (i == perm_Ball.Length - 1) { return "Yes"; } } return "No"; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace PokerPlaying { class Player { static void Main(string[] args) { int iter = int.Parse(Console.ReadLine()); for (int i = 0; i < iter; i++) { string data = Console.ReadLine(); string[] splitData = data.Split(' '); int[] intHand = toIntData(splitData); Bottol b = new Bottol(); string result = b.fallBall(intHand); Console.WriteLine(result); } } public static int[] toIntData(string[] data) { int[] intData = new int[data.Length]; for (int i = 0; i < data.Length; i++) { intData[i] = int.Parse(data[i]); } return intData; } } class Bottol { int[] perm_Ball; List<int> leftBottom; List<int> rightBottom; public Bottol() { perm_Ball = new int[10]; leftBottom = new List<int>(); leftBottom.Add(0); rightBottom = new List<int>(); rightBottom.Add(0); } public string fallBall(int[] balls) { perm_Ball = balls; for (int i = 0; i < perm_Ball.Length; i++) { bool isAbleToLeft = false; bool isAbleToRight = false; if (i == 0 || perm_Ball[i] > leftBottom.Last()) { isAbleToLeft = true; } if (i == 0 || perm_Ball[i] > rightBottom.Last()) { isAbleToRight = true; } if (!isAbleToLeft && !isAbleToRight) { break; } if (isAbleToLeft) { leftBottom.Add(perm_Ball[i]); } else if (!isAbleToLeft && isAbleToRight) { rightBottom.Add(perm_Ball[i]); } if (i == perm_Ball.Length - 1) { return "YES"; } } return "NO"; } } }
[["-", 0, 57, 64, 196, 0, 37, 0, 5, 0, 222], ["+", 0, 57, 64, 196, 0, 37, 0, 5, 0, 222], ["-", 0, 195, 8, 196, 0, 37, 0, 5, 0, 222], ["+", 0, 195, 8, 196, 0, 37, 0, 5, 0, 222]]
8
418
4
using System; namespace _0033 { class Program { static void Main(string[] args) { var dataNumber = int.Parse(Console.ReadLine()); for (int i = 0; i < dataNumber; i++) { var input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { break; } var inputsAString = input.Split(' '); var BTop = 0; var CTop = 0; var answer = "YES"; foreach (var inputA in inputsAString) { if (BTop > int.Parse(inputA)) { BTop = int.Parse(inputA); } else if (CTop > int.Parse(inputA)) { CTop = int.Parse(inputA); } else { answer = "NO"; } } Console.WriteLine(answer); } } } }
using System; namespace _0033 { class Program { static void Main(string[] args) { var dataNumber = int.Parse(Console.ReadLine()); for (int i = 0; i < dataNumber; i++) { var input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { break; } var inputsAString = input.Split(' '); var BTop = 0; var CTop = 0; var answer = "YES"; foreach (var inputA in inputsAString) { if (BTop < int.Parse(inputA)) { BTop = int.Parse(inputA); } else if (CTop < int.Parse(inputA)) { CTop = int.Parse(inputA); } else { answer = "NO"; break; } } Console.WriteLine(answer); } } } }
[["-", 0, 210, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 210, 8, 196, 0, 57, 15, 16, 17, 18], ["-", 8, 196, 0, 57, 75, 57, 15, 16, 17, 47], ["+", 8, 196, 0, 57, 75, 57, 15, 16, 17, 18], ["+", 0, 57, 75, 57, 75, 196, 0, 1, 0, 35], ["+", 0, 57, 75, 57, 75, 196, 0, 93, 0, 94]]
8
173
6
using System; namespace AOJ.Volume0 { public class CardGame { public static int Main() { while (true) { string input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { break; } var sep = input.Split(' '); int c1 = int.Parse(sep[0]); int c2 = int.Parse(sep[1]); int c3 = int.Parse(sep[2]); // 自分の手 int my_hand = c1 + c2; // 合計20以下になる枚数を調べる int cnt = 0; for (int i = 1; i <= 10; i++) { if (i == c1 || i == c2 || i == c3) { continue; } if (my_hand + i <= 20) { cnt++; } } // 20以下になる枚数が4枚以上ならOK Console.WriteLine(cnt >= 4 ? "OK" : "NO"); } return 0; } } }
using System; namespace AOJ.Volume0 { public class CardGame { public static int Main() { while (true) { string input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { break; } var sep = input.Split(' '); int c1 = int.Parse(sep[0]); int c2 = int.Parse(sep[1]); int c3 = int.Parse(sep[2]); // 自分の手 int my_hand = c1 + c2; // 合計20以下になる枚数を調べる int cnt = 0; for (int i = 1; i <= 10; i++) { if (i == c1 || i == c2 || i == c3) { continue; } if (my_hand + i <= 20) { cnt++; } } // 20以下になる枚数が3枚以上ならOK Console.WriteLine(cnt >= 4 ? "YES" : "NO"); } return 0; } } }
[["-", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222]]
8
183
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication40 { class Program { static void Main() { while (true) { string a = Console.ReadLine(); if (a == null) break; int[] b = a.Split().Select(int.Parse).ToArray(); int c = 21 - a[0] - a[1]; int r = 0; for (int q = 1; q < 11; q++) { if (q == b[0] || q == a[1] || q == a[2]) continue; if (q < c) r++; } if (r > 3) Console.WriteLine("YES"); else Console.WriteLine("NO"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication40 { class Program { static void Main() { while (true) { string a = Console.ReadLine(); if (a == null) break; int[] b = a.Split().Select(int.Parse).ToArray(); int c = 21 - b[0] - b[1]; int r = 0; for (int q = 1; q < 11; q++) { if (q == b[0] || q == a[1] || q == a[2]) continue; if (q < c) r++; } if (r > 3) Console.WriteLine("YES"); else Console.WriteLine("NO"); } } } }
[["-", 0, 212, 0, 16, 31, 16, 12, 204, 205, 22], ["+", 0, 212, 0, 16, 31, 16, 12, 204, 205, 22], ["-", 0, 200, 0, 212, 0, 16, 12, 204, 205, 22], ["+", 0, 200, 0, 212, 0, 16, 12, 204, 205, 22]]
8
175
4
using System; class AOJ { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { int[] x = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); Array.Sort(x); if (x[2] * x[2] == x[0] * x[0] + x[1] * x[1]) Console.WriteLine("Yes"); else Console.WriteLine("No"); } } }
using System; class AOJ { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { int[] x = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); Array.Sort(x); if (x[2] * x[2] == x[0] * x[0] + x[1] * x[1]) Console.WriteLine("YES"); else Console.WriteLine("NO"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
133
4
using System; class AOJ { static void Main(string[] args) { const int MAX_N = 1000001; bool[] IsPrime = new bool[MAX_N]; int[] cnt = new int[MAX_N]; for (int i = 0; i < MAX_N; i++) { IsPrime[i] = true; cnt[i] = 0; } IsPrime[0] = IsPrime[1] = false; for (int i = 2; i * i < MAX_N; i++) { if (IsPrime[i]) { for (int j = i * i; j <= MAX_N; j += i) { IsPrime[j] = false; } } } for (int i = 0; i < MAX_N; i++) { if (IsPrime[i]) { cnt[i]++; } } for (int i = 1; i < MAX_N; i++) { cnt[i] += cnt[i - 1]; } string s; while ((s = Console.ReadLine()) != null) { int n = int.Parse(s); Console.WriteLine(cnt[n]); } } }
using System; class AOJ { static void Main(string[] args) { const int MAX_N = 1000001; bool[] IsPrime = new bool[MAX_N]; int[] cnt = new int[MAX_N]; for (int i = 0; i < MAX_N; i++) { IsPrime[i] = true; cnt[i] = 0; } IsPrime[0] = IsPrime[1] = false; for (int i = 2; i * i < MAX_N; i++) { if (IsPrime[i]) { for (int j = i * i; j < MAX_N; j += i) { IsPrime[j] = false; } } } for (int i = 0; i < MAX_N; i++) { if (IsPrime[i]) { cnt[i]++; } } for (int i = 1; i < MAX_N; i++) { cnt[i] += cnt[i - 1]; } string s; while ((s = Console.ReadLine()) != null) { int n = int.Parse(s); Console.WriteLine(cnt[n]); } } }
[["-", 0, 57, 64, 196, 0, 7, 15, 16, 17, 19], ["+", 0, 57, 64, 196, 0, 7, 15, 16, 17, 18]]
8
239
2
using System; namespace AIZUJudge { class PrimeNumber { static void Main(string[] args) { const int MAX = 1000000; bool[] primeList = new bool[MAX]; for (int i = 2; i < MAX; i++) { if (checkPrime(i)) { primeList[i] = true; } } for (string n; (n = Console.ReadLine()) != null;) { if (n == "" || n == null) break; int upper = int.Parse(n); int numPrime = 0; for (int i = 2; i < upper; i++) { if (primeList[i]) { numPrime++; } } Console.WriteLine(numPrime); } } static bool checkPrime(int a) { int range = (int)Math.Sqrt(a); bool isPrime = true; for (int i = 2; i <= range; i++) { if (a % i == 0) { isPrime = false; break; } } return isPrime; } } }
using System; namespace AIZUJudge { class PrimeNumber { static void Main(string[] args) { const int MAX = 1000000; bool[] primeList = new bool[MAX]; for (int i = 2; i < MAX; i++) { if (checkPrime(i)) { primeList[i] = true; } } for (string n; (n = Console.ReadLine()) != null;) { if (n == "" || n == null) break; int upper = int.Parse(n); int numPrime = 0; for (int i = 2; i <= upper; i++) { if (primeList[i]) { numPrime++; } } Console.WriteLine(numPrime); } } static bool checkPrime(int a) { int range = (int)Math.Sqrt(a); bool isPrime = true; for (int i = 2; i <= range; i++) { if (a % i == 0) { isPrime = false; break; } } return isPrime; } } }
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 17, 19]]
8
216
2
using System; class main { static int[] p = new int[1000001]; static int max; static void Prime(int n) { for (int i = max; i * i < n; ++i) { if (p[i] == 1) continue; for (int j = i * 2; j < 1000001; j += i) p[j] = 1; } } static void Main() { string s; int count; p[0] = 1; p[1] = 1; max = 2; while ((s = Console.ReadLine()) != null) { int n = int.Parse(s); Prime(n); count = 0; for (int i = 0; i <= n; i++) if (p[i] == 0) count++; Console.WriteLine(count); } } }
using System; class main { static int[] p = new int[1000001]; static int max; static void Prime(int n) { for (int i = max; i * i <= n; ++i) { if (p[i] == 1) continue; for (int j = i * 2; j < 1000001; j += i) p[j] = 1; } } static void Main() { string s; int count; p[0] = 1; p[1] = 1; max = 2; while ((s = Console.ReadLine()) != null) { int n = int.Parse(s); Prime(n); count = 0; for (int i = 0; i <= n; i++) if (p[i] == 0) count++; Console.WriteLine(count); } } }
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
8
184
2
using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { List<int> n = new List<int>(); int r, i; string s; int[] v = new int[] { 2, 3, 5, 7 }; while (true) { s = Console.ReadLine(); if (string.IsNullOrEmpty(s)) break; n.Add(int.Parse(s)); } foreach (int n1 in n) { r = 0; for (i = 1; i <= n1; i++) { if (IsPrime(i, v)) r++; } Console.WriteLine(r); } } static bool IsPrime(int x, int[] v) { bool b = true; if (x < 2) return false; if (x % 2 == 0) return false; for (int i = 3; i < 1000; i += 2) { if (x % i == 0 && x / i > 1) { b = false; break; } } return b; } }
using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { List<int> n = new List<int>(); int r, i; string s; int[] v = new int[] { 2, 3, 5, 7 }; while (true) { s = Console.ReadLine(); if (string.IsNullOrEmpty(s)) break; n.Add(int.Parse(s)); } foreach (int n1 in n) { r = 0; for (i = 1; i <= n1; i++) { if (IsPrime(i, v)) r++; } Console.WriteLine(r); } } static bool IsPrime(int x, int[] v) { bool b = true; if (x < 2) return false; if (x % 2 == 0 && x != 2) return false; for (int i = 3; i < 1000; i += 2) { if (x % i == 0 && x / i > 1) { b = false; break; } } return b; } }
[["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 79], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 12, 203]]
8
236
4
using System.Linq; using System.Collections.Generic; using System; public class Hello { public static void Main() { string line; for (; (line = Console.ReadLine()) != null;) { var n = int.Parse(line.Trim()); Console.WriteLine(getPcount(n)); } } public static int getPcount(int m) { var p = new List<int>(); int prime; var sqrtMax = Math.Sqrt(m); var searchList = Enumerable.Range(2, m - 1).ToList(); do { prime = searchList.First(); p.Add(prime); searchList.RemoveAll(n => n % prime == 0); } while (prime < sqrtMax); p.AddRange(searchList); return p.Count(); } }
using System.Linq; using System.Collections.Generic; using System; public class Hello { public static void Main() { string line; for (; (line = Console.ReadLine()) != null;) { var n = int.Parse(line.Trim()); Console.WriteLine(n == 1 ? 0 : getPcount(n)); } } public static int getPcount(int m) { var p = new List<int>(); int prime; var sqrtMax = Math.Sqrt(m); var searchList = Enumerable.Range(2, m - 1).ToList(); do { prime = searchList.First(); p.Add(prime); searchList.RemoveAll(n => n % prime == 0); } while (prime < sqrtMax); p.AddRange(searchList); return p.Count(); } }
[["+", 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], ["+", 0, 213, 3, 4, 0, 28, 0, 41, 64, 203], ["+", 0, 213, 3, 4, 0, 28, 0, 41, 0, 102]]
8
177
6
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class Program { static void Main(string[] args) { var dic = new Dictionary<int, int>(); var lis = new List<int>(); var cnt = 0; dic.Add(0, 0); dic.Add(1, 1); for (int i = 2; i < 1000000; i++) { bool isPrime = true; foreach (var j in lis) { if (j > Math.Sqrt(i)) break; if (i % j == 0) { isPrime = false; break; } } if (isPrime) { lis.Add(i); cnt++; }; dic.Add(i, cnt); } int n; string s; while ((s = Console.ReadLine()) != null) { n = int.Parse(s); Console.WriteLine(dic[n]); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class Program { static void Main(string[] args) { var dic = new Dictionary<int, int>(); var lis = new List<int>(); var cnt = 0; dic.Add(0, 0); dic.Add(1, 0); for (int i = 2; i < 1000000; i++) { bool isPrime = true; foreach (var j in lis) { if (j > Math.Sqrt(i)) break; if (i % j == 0) { isPrime = false; break; } } if (isPrime) { lis.Add(i); cnt++; }; dic.Add(i, cnt); } int n; string s; while ((s = Console.ReadLine()) != null) { n = int.Parse(s); Console.WriteLine(dic[n]); } } } }
[["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 203]]
8
212
2
using System; class Program { static void Main() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { Console.WriteLine(i.ToString() + "*" + j.ToString() + "=" + (i * j).ToString()); } } } }
using System; class Program { static void Main() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { Console.WriteLine(i.ToString() + "x" + j.ToString() + "=" + (i * j).ToString()); } } } }
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222]]
8
81
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApp5 { class Program { static void Main(string[] args) { { int a, b; for (a = 1; a <= 9; a++) { for (b = 1; b <= 9; b++) { Console.WriteLine("{0}*{1}={2}", a, b, a * b); } } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApp5 { class Program { static void Main(string[] args) { { int a, b; for (a = 1; a <= 9; a++) { for (b = 1; b <= 9; b++) { Console.WriteLine("{0}x{1}={2}", a, b, a * b); } } } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
93
2
using System; class main { public static int n = 1000001; static void Main() { string s; int c, q = 0; int[] p = new int[n]; for (int i = 2; i < 1001; ++i) for (int j = i * 2; j < n; j += i) p[j] = 1; while ((s = Console.ReadLine()) != null) { c = int.Parse(s); for (int i = 2; i <= c; ++i) if (p[i] != 1) ++q; Console.WriteLine("{0}", q); } } }
using System; class main { public static int n = 1000001; static void Main() { string s; int c, q; int[] p = new int[n]; for (int i = 2; i < 1001; ++i) for (int j = i * 2; j < n; j += i) p[j] = 1; while ((s = Console.ReadLine()) != null) { c = int.Parse(s); q = 0; for (int i = 2; i <= c; ++i) if (p[i] != 1) ++q; Console.WriteLine("{0}", q); } } }
[["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 32], ["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["+", 8, 196, 0, 52, 8, 196, 0, 1, 0, 35], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 31, 22], ["+", 8, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 12, 203]]
8
142
6
using System; class AOJ { public static void Main() { int[] l = new int[10]; int v1, v2; string str; double time, pos; while ((str = Console.ReadLine()) != null) { int suml = 0, com = 0; string[] s = str.Split(','); for (int i = 0; i < 10; i++) { l[i] = int.Parse(s[i]); suml += l[i]; } v1 = int.Parse(s[10]); v2 = int.Parse(s[11]); time = (double)suml / (v1 + v2); pos = v1 * time; for (int i = 0; i < 10; i++) { com += l[i]; if (com > pos) { Console.WriteLine(i); break; } } } } }
using System; class AOJ { public static void Main() { int[] l = new int[10]; int v1, v2; string str; double time, pos; while ((str = Console.ReadLine()) != null) { int suml = 0, com = 0; string[] s = str.Split(','); for (int i = 0; i < 10; i++) { l[i] = int.Parse(s[i]); suml += l[i]; } v1 = int.Parse(s[10]); v2 = int.Parse(s[11]); time = (double)suml / (v1 + v2); pos = v1 * time; for (int i = 0; i < 10; i++) { com += l[i]; if (com >= pos) { Console.WriteLine(i + 1); break; } } } } }
[["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
8
199
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _0036 { public class Program { public static void Main(string[] args) { Dictionary<string, char[,]> patterns = new Dictionary<string, char[,]>(); patterns.Add("A", new char[2, 2] { { '1', '1' }, { '1', '1' } }); patterns.Add("B", new char[4, 1] { { '1' }, { '1' }, { '1' }, { '1' } }); patterns.Add("C", new char[1, 4] { { '1', '1', '1', '1' } }); patterns.Add("D", new char[3, 2] { { '0', '1' }, { '1', '1' }, { '1', '0' } }); patterns.Add("E", new char[2, 3] { { '1', '1', '0' }, { '0', '1', '1' } }); patterns.Add("F", new char[3, 2] { { '1', '0' }, { '1', '1' }, { '0', '1' } }); patterns.Add("G", new char[2, 3] { { '0', '1', '1' }, { '1', '1', '0' } }); while (true) { char[,] map = new char[8, 8]; for (int i = 0; i < 8; i++) { string item = RSt(); for (int j = 0; j < 8; j++) { map[i, j] = item[j]; } } foreach (var item in patterns) { StringBuilder sb = new StringBuilder(); PatternMatch(map, item.Value, sb); if (sb.Length > 0) { Console.Write(item.Key); break; } } string line = RSt(); if (line == null) break; } } public static void PatternMatch(char[,] target, char[,] pattern, StringBuilder sb) { const long B1 = 100000007; const long B2 = 100000009; int tRowCnt = target.GetLength(0); int pRowCnt = pattern.GetLength(0); int tColCnt = target.GetLength(1); int pColCnt = pattern.GetLength(1); if (pRowCnt > tRowCnt || pColCnt > tColCnt) return; //パターンのハッシュ値 long pHash = 0; long[] tmp = new long[pRowCnt]; for (int i = 0; i < pRowCnt; i++) { for (int j = 0; j < pColCnt; j++) { tmp[i] = tmp[i] * B1 + pattern[i, j]; } } for (int i = 0; i < pRowCnt; i++) pHash = pHash * B2 + tmp[i]; //ターゲットのハッシュ値 long t1 = 1; for (int i = 0; i < pColCnt; i++) t1 *= B1; long t2 = 1; for (int i = 0; i < pRowCnt; i++) t2 *= B2; long[,] tmp2 = new long[tRowCnt, tColCnt - pColCnt + 1]; bool[,] matchTbl = new bool[tRowCnt - pRowCnt + 1, tColCnt - pColCnt + 1]; for (int i = 0; i < tRowCnt; i++) { long e = 0; for (int j = 0; j < pColCnt; j++) e = e * B1 + target[i, j]; for (int j = 0; j + pColCnt <= tColCnt; j++) { tmp2[i, j] = e; if (j + pColCnt < tColCnt) e = e * B1 - t1 * target[i, j] + target[i, j + pColCnt]; } } for (int j = 0; j + pColCnt <= tColCnt; j++) { long e = 0; for (int i = 0; i < pRowCnt; i++) e = e * B2 + tmp2[i, j]; for (int i = 0; i + pRowCnt <= tRowCnt; i++) { if (e == pHash) matchTbl[i, j] = true; if (i + pRowCnt < tRowCnt) e = e * B2 - t2 * tmp2[i, j] + tmp2[i + pRowCnt, j]; } } for (int i = 0; i < matchTbl.GetLength(0); i++) { for (int j = 0; j < matchTbl.GetLength(1); j++) { if (matchTbl[i, j]) sb.AppendLine(i.ToString() + " " + j.ToString()); } } } static string RSt() { return Console.ReadLine(); } static int RInt() { return int.Parse(Console.ReadLine().Trim()); } static long RLong() { return long.Parse(Console.ReadLine().Trim()); } static double RDouble() { return double.Parse(Console.ReadLine()); } static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); } static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); } static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); } static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); } static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _0036 { public class Program { public static void Main(string[] args) { Dictionary<string, char[,]> patterns = new Dictionary<string, char[,]>(); patterns.Add("A", new char[2, 2] { { '1', '1' }, { '1', '1' } }); patterns.Add("B", new char[4, 1] { { '1' }, { '1' }, { '1' }, { '1' } }); patterns.Add("C", new char[1, 4] { { '1', '1', '1', '1' } }); patterns.Add("D", new char[3, 2] { { '0', '1' }, { '1', '1' }, { '1', '0' } }); patterns.Add("E", new char[2, 3] { { '1', '1', '0' }, { '0', '1', '1' } }); patterns.Add("F", new char[3, 2] { { '1', '0' }, { '1', '1' }, { '0', '1' } }); patterns.Add("G", new char[2, 3] { { '0', '1', '1' }, { '1', '1', '0' } }); while (true) { char[,] map = new char[8, 8]; for (int i = 0; i < 8; i++) { string item = RSt(); for (int j = 0; j < 8; j++) { map[i, j] = item[j]; } } foreach (var item in patterns) { StringBuilder sb = new StringBuilder(); PatternMatch(map, item.Value, sb); if (sb.Length > 0) { Console.WriteLine(item.Key); break; } } string line = RSt(); if (line == null) break; } } public static void PatternMatch(char[,] target, char[,] pattern, StringBuilder sb) { const long B1 = 100000007; const long B2 = 100000009; int tRowCnt = target.GetLength(0); int pRowCnt = pattern.GetLength(0); int tColCnt = target.GetLength(1); int pColCnt = pattern.GetLength(1); if (pRowCnt > tRowCnt || pColCnt > tColCnt) return; //パターンのハッシュ値 long pHash = 0; long[] tmp = new long[pRowCnt]; for (int i = 0; i < pRowCnt; i++) { for (int j = 0; j < pColCnt; j++) { tmp[i] = tmp[i] * B1 + pattern[i, j]; } } for (int i = 0; i < pRowCnt; i++) pHash = pHash * B2 + tmp[i]; //ターゲットのハッシュ値 long t1 = 1; for (int i = 0; i < pColCnt; i++) t1 *= B1; long t2 = 1; for (int i = 0; i < pRowCnt; i++) t2 *= B2; long[,] tmp2 = new long[tRowCnt, tColCnt - pColCnt + 1]; bool[,] matchTbl = new bool[tRowCnt - pRowCnt + 1, tColCnt - pColCnt + 1]; for (int i = 0; i < tRowCnt; i++) { long e = 0; for (int j = 0; j < pColCnt; j++) e = e * B1 + target[i, j]; for (int j = 0; j + pColCnt <= tColCnt; j++) { tmp2[i, j] = e; if (j + pColCnt < tColCnt) e = e * B1 - t1 * target[i, j] + target[i, j + pColCnt]; } } for (int j = 0; j + pColCnt <= tColCnt; j++) { long e = 0; for (int i = 0; i < pRowCnt; i++) e = e * B2 + tmp2[i, j]; for (int i = 0; i + pRowCnt <= tRowCnt; i++) { if (e == pHash) matchTbl[i, j] = true; if (i + pRowCnt < tRowCnt) e = e * B2 - t2 * tmp2[i, j] + tmp2[i + pRowCnt, j]; } } for (int i = 0; i < matchTbl.GetLength(0); i++) { for (int j = 0; j < matchTbl.GetLength(1); j++) { if (matchTbl[i, j]) sb.AppendLine(i.ToString() + " " + j.ToString()); } } } static string RSt() { return Console.ReadLine(); } static int RInt() { return int.Parse(Console.ReadLine().Trim()); } static long RLong() { return long.Parse(Console.ReadLine().Trim()); } static double RDouble() { return double.Parse(Console.ReadLine()); } static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); } static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); } static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); } static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); } static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); } } }
[["-", 64, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 64, 196, 0, 1, 0, 213, 63, 214, 141, 22]]
8
1,356
2
using System; class aoj { static void Main() { char[] k = new char[50]; int l = 0; while (true) { bool[,] a = new bool[8, 8]; int c = 0, d = 0; bool f = true; for (int i = 0; i < 8; i++) { string b = Console.ReadLine(); if (String.IsNullOrEmpty(b)) goto stop; for (int j = 0; j < 8; j++) { if (b[j] == '0') { a[i, j] = false; } else { a[i, j] = true; if (f) { c = i; d = j; f = false; } } } } if (c < 7 && d < 7 && a[c, d] && a[c + 1, d] && a[c, d + 1] && a[c + 1, d + 1]) { k[l] = 'A'; l++; } else if (c < 5 && a[c, d] && a[c + 1, d] && a[c + 2, d] && a[c + 3, d]) { k[l] = 'B'; l++; } else if (d < 5 && a[c, d] && a[c, d + 1] && a[c, d + 2] && a[c, d + 2]) { k[l] = 'C'; l++; } else if (c < 6 && d > 0 && a[c, d] && a[c + 1, d - 1] && a[c + 1, d] && a[c + 2, d - 1]) { k[l] = 'D'; l++; } else if (c < 7 && d < 6 && a[c, d] && a[c, d + 1] && a[c + 1, d + 1] && a[c + 1, d + 2]) { k[l] = 'E'; l++; } else if (c < 6 && d < 7 && a[c, d] && a[c + 1, d] && a[c + 1, d + 1] && a[c + 2, d + 1]) { k[l] = 'F'; l++; } else if (c < 7 && d > 7 && d < 0 && a[c, d] && a[c, d + 1] && a[c + 1, d - 1] && a[c + 1, d]) { k[l] = 'G'; l++; } Console.ReadLine(); } stop:; for (int i = 0; i < l; i++) { Console.WriteLine(k[i]); } } }
using System; class aoj { static void Main() { char[] k = new char[50]; int l = 0; while (true) { bool[,] a = new bool[8, 8]; int c = 0, d = 0; bool f = true; for (int i = 0; i < 8; i++) { string b = Console.ReadLine(); if (String.IsNullOrEmpty(b)) goto stop; for (int j = 0; j < 8; j++) { if (b[j] == '0') { a[i, j] = false; } else { a[i, j] = true; if (f) { c = i; d = j; f = false; } } } } if (c < 7 && d < 7 && a[c, d] && a[c + 1, d] && a[c, d + 1] && a[c + 1, d + 1]) { k[l] = 'A'; l++; } else if (c < 5 && a[c, d] && a[c + 1, d] && a[c + 2, d] && a[c + 3, d]) { k[l] = 'B'; l++; } else if (d < 5 && a[c, d] && a[c, d + 1] && a[c, d + 2] && a[c, d + 2]) { k[l] = 'C'; l++; } else if (c < 6 && d > 0 && a[c, d] && a[c + 1, d - 1] && a[c + 1, d] && a[c + 2, d - 1]) { k[l] = 'D'; l++; } else if (c < 7 && d < 6 && a[c, d] && a[c, d + 1] && a[c + 1, d + 1] && a[c + 1, d + 2]) { k[l] = 'E'; l++; } else if (c < 6 && d < 7 && a[c, d] && a[c + 1, d] && a[c + 1, d + 1] && a[c + 2, d + 1]) { k[l] = 'F'; l++; } else if (c < 7 && d < 7 && d > 0 && a[c, d] && a[c, d + 1] && a[c + 1, d - 1] && a[c + 1, d]) { k[l] = 'G'; l++; } Console.ReadLine(); } stop:; for (int i = 0; i < l; i++) { Console.WriteLine(k[i]); } } }
[["-", 31, 16, 31, 16, 31, 16, 12, 16, 17, 47], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 18], ["-", 31, 16, 31, 16, 31, 16, 12, 16, 17, 18], ["+", 31, 16, 31, 16, 31, 16, 12, 16, 17, 47]]
8
628
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class Program { static void Main(string[] args) { string[] pattern = { "1100000011", "1000000010000000100000001", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011" }; while (true) { var str = Console.ReadLine(); if (str == null) break; for (int i = 0; i < 7; i++) str += Console.ReadLine(); for (int i = 0; i < pattern.Length; i++) { if (str.Contains(pattern[i])) Console.WriteLine((char)('A' + i)); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class Program { static void Main(string[] args) { string[] pattern = { "1100000011", "1000000010000000100000001", "1111", "1000000110000001", "11000000011", "100000001100000001", "110000011" }; while (true) { var str = Console.ReadLine(); if (str == null) break; for (int i = 0; i < 7; i++) str += Console.ReadLine(); Console.ReadLine(); for (int i = 0; i < pattern.Length; i++) { if (str.Contains(pattern[i])) Console.WriteLine((char)('A' + i)); } } } } }
[["+", 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], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 52, 8, 196, 0, 1, 0, 35]]
8
165
6
using System; using System.Text; using System.Collections.Generic; namespace aizu { class OnlineJudge { static void Main() { Dictionary<string, string> pattern = new Dictionary<string, string> { { "A", "1100000011" }, { "B", "1000000010000000100000001" }, { "C", "1111" }, { "D", "1000000110000001" }, { "E", "11000000011" }, { "F", "100000001100000001" }, { "G", "110000011" }, }; string input; while ((input = Console.ReadLine()) != null) { StringBuilder figure = new StringBuilder(input); for (int i = 0; i < 7; ++i) { figure.Append(Console.ReadLine()); } foreach (var item in pattern) { if (figure.ToString().Contains(item.Value)) { Console.WriteLine(item.Key); break; } } } } } }
using System; using System.Text; using System.Collections.Generic; namespace aizu { class OnlineJudge { static void Main() { Dictionary<string, string> pattern = new Dictionary<string, string> { { "A", "1100000011" }, { "B", "1000000010000000100000001" }, { "C", "1111" }, { "D", "1000000110000001" }, { "E", "11000000011" }, { "F", "100000001100000001" }, { "G", "110000011" }, }; string input; while ((input = Console.ReadLine()) != null) { StringBuilder figure = new StringBuilder(input); for (int i = 0; i < 7; ++i) { figure.Append(Console.ReadLine()); } Console.ReadLine(); foreach (var item in pattern) { if (figure.ToString().Contains(item.Value)) { Console.WriteLine(item.Key); break; } } } } } }
[["+", 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], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 52, 8, 196, 0, 1, 0, 35]]
8
210
6
using System; class aoj { static void Main() { string[] k = new string[50]; int l = 0; while (true) { string c; string a = Console.ReadLine(); if (String.IsNullOrEmpty(a)) break; string[] b = a.Split(','); int[] d = new int[5]; for (int i = 0; i < 5; i++) { d[i] = int.Parse(b[i]); } Array.Sort(d); if ((d[0] == d[1] && d[0] == d[2] && d[0] == d[3]) || (d[1] == d[2] && d[1] == d[3] && d[1] == d[4])) { c = "four card"; goto stop; } if ((d[0] == d[1] && d[1] == d[2] && d[3] == d[4]) || (d[0] == d[1] && d[2] == d[3] && d[3] == d[4])) { c = "full house"; goto stop; } bool g = true; for (int i = 1; i < 5; i++) { if (d[i] - d[i - 1] == 1) { } else { g = false; } if (d[0] == 1 && d[1] == 10 && d[2] == 11 && d[3] == 12 && d[4] == 13) { g = true; } } if (g) { c = "straight"; goto stop; } for (int i = 0; i < 2; i++) { if (d[i] == d[i + 1] && d[i] == d[i + 2]) { c = "three card"; goto stop; } } for (int i = 0; i < 4; i++) { for (int j = i + 1; j < 4; j++) { if (d[i] == d[i + 1] && d[j] == d[j + 1]) { c = "two pair"; goto stop; } } } for (int i = 0; i < 4; i++) { if (d[i] == d[i + 1]) { c = "one pair"; goto stop; } } c = "null"; stop:; k[l] = c; l++; } for (int i = 0; i < l; i++) { Console.WriteLine(k[i]); } } }
using System; class aoj { static void Main() { string[] k = new string[50]; int l = 0; while (true) { string c; string a = Console.ReadLine(); if (String.IsNullOrEmpty(a)) break; string[] b = a.Split(','); int[] d = new int[5]; for (int i = 0; i < 5; i++) { d[i] = int.Parse(b[i]); } Array.Sort(d); if ((d[0] == d[1] && d[0] == d[2] && d[0] == d[3]) || (d[1] == d[2] && d[1] == d[3] && d[1] == d[4])) { c = "four card"; goto stop; } if ((d[0] == d[1] && d[1] == d[2] && d[3] == d[4]) || (d[0] == d[1] && d[2] == d[3] && d[3] == d[4])) { c = "full house"; goto stop; } bool g = true; for (int i = 1; i < 5; i++) { if (d[i] - d[i - 1] == 1) { } else { g = false; } } if (d[0] == 1 && d[1] == 10 && d[2] == 11 && d[3] == 12 && d[4] == 13) { g = true; } if (g) { c = "straight"; goto stop; } for (int i = 0; i < 3; i++) { if (d[i] == d[i + 1] && d[i] == d[i + 2]) { c = "three card"; goto stop; } } for (int i = 0; i < 4; i++) { for (int j = i + 1; j < 4; j++) { if (d[i] == d[i + 1] && d[j] == d[j + 1]) { c = "two pair"; goto stop; } } } for (int i = 0; i < 4; i++) { if (d[i] == d[i + 1]) { c = "one pair"; goto stop; } } c = "null"; stop:; k[l] = c; l++; } for (int i = 0; i < l; i++) { Console.WriteLine(k[i]); } } }
[["+", 0, 52, 8, 196, 0, 7, 8, 196, 0, 46], ["-", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46], ["-", 0, 52, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 52, 8, 196, 0, 7, 15, 16, 12, 203]]
8
590
4
using System; class aoj { public static void Main(string[] args) { for (int i = 1; i <= 9; i++) { for (int j = 0; j <= 9; j++) Console.WriteLine(i + "x" + j + "=" + i * j); } } }
using System; class aoj { public static void Main(string[] args) { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) Console.WriteLine(i + "x" + j + "=" + i * j); } } }
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
8
70
2
using System; namespace Solution { class Solution { public static void Main(string[] args) { for (int i = 1; i <= 9; i++) { for (int j = 1; i <= 9; i++) { System.Console.WriteLine("{0}x{1}={2}", i, j, i * j); } } } } }
using System; namespace Solution { class Solution { public static void Main(string[] args) { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { System.Console.WriteLine("{0}x{1}={2}", i, j, i * j); } } } } }
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 196, 0, 7, 26, 223, 0, 22], ["+", 0, 7, 8, 196, 0, 7, 26, 223, 0, 22]]
8
74
4
using System; using System.Linq; class Program { static void Main() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { Console.WriteLine("{0}*{1}={2}", i, j, i * j); } } } }
using System; using System.Linq; class Program { static void Main() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { Console.WriteLine("{0}x{1}={2}", i, j, i * j); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
68
2
using System; using System.Linq; using System.IO; using System.Text; using System.Collections; using System.Collections.Generic; class Program { static void Main() { for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { Console.WriteLine(string.Format("{0}??{1}={2}", i, j, i * j)); } } } }
using System; using System.Linq; using System.IO; using System.Text; using System.Collections; using System.Collections.Generic; class Program { static void Main() { for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { Console.WriteLine(string.Format("{0}x{1}={2}", i, j, i * j)); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
95
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Programminng { class AOJ_Volume0010 { public static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string[] s = Console.ReadLine().Split(' '); double x1 = double.Parse(s[0]); double y1 = double.Parse(s[1]); double x2 = double.Parse(s[2]); double y2 = double.Parse(s[3]); double x3 = double.Parse(s[4]); double y3 = double.Parse(s[5]); double a1 = 2 * (x2 - x1); double b1 = 2 * (y2 - y1); double c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; double a2 = 2 * (x3 - x1); double b2 = 2 * (y3 - y1); double c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3; double x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1); double y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1); double r_2 = (x1 - x) * (x1 - x) + (y1 - y) * (y1 - y); double r = Math.Sqrt(r_2); Console.WriteLine("{0:F3} {1:F2} {2:F3}", x, y, r); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Programminng { class AOJ_Volume0010 { public static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string[] s = Console.ReadLine().Split(' '); double x1 = double.Parse(s[0]); double y1 = double.Parse(s[1]); double x2 = double.Parse(s[2]); double y2 = double.Parse(s[3]); double x3 = double.Parse(s[4]); double y3 = double.Parse(s[5]); double a1 = 2 * (x2 - x1); double b1 = 2 * (y2 - y1); double c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2; double a2 = 2 * (x3 - x1); double b2 = 2 * (y3 - y1); double c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3; double x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1); double y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1); double r_2 = (x1 - x) * (x1 - x) + (y1 - y) * (y1 - y); double r = Math.Sqrt(r_2); Console.WriteLine("{0:F3} {1:F3} {2:F3}", x, y, r); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
346
2
using System; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { for (int i = 1; i < 10; i++) { for (int w = 1; w < 10; w++) { Console.WriteLine(i + "X" + w + "=" + i * w); } } } } }
using System; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { for (int i = 1; i < 10; i++) { for (int w = 1; w < 10; w++) { Console.WriteLine(i + "x" + w + "=" + i * w); } } } } }
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222]]
8
75
2
using System; using System.Linq; public class Test { public static void Main() { for (int i = 1; i <= 9; i++) { { for (int j = 1; j <= 9; j++) { Console.WriteLine(i + "x" + j + "=" + j * j); } } } } }
using System; using System.Linq; public class Test { public static void Main() { for (int i = 1; i <= 9; i++) { { for (int j = 1; j <= 9; j++) { Console.WriteLine(i + "x" + j + "=" + i * j); } } } } }
[["-", 3, 4, 0, 28, 0, 16, 12, 16, 31, 22], ["+", 3, 4, 0, 28, 0, 16, 12, 16, 31, 22]]
8
76
2
using System; using System.Linq; using System.Collections.Generic; using System.Text; namespace Yasuo { class Yasuo { static void Main(string[] asrgs) { int n; int a, b, c; string s; string[] ss; bool flag = true; List<string> reslist = new List<string>(); n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { s = Console.ReadLine(); ss = s.Split(' '); a = int.Parse(ss[0]); b = int.Parse(ss[1]); c = int.Parse(ss[2]); flag = false; if (a >= b && a >= c) { if (a * a == b * b + c * c) flag = true; } else if (b >= a && b >= c) { if (b * b == a * a + c * c) flag = true; } else { if (c * c == a * a + b * b) flag = true; } } if (flag) { reslist.Add("YES"); } else { reslist.Add("NO"); } for (int i = 0; i < n; i++) { Console.WriteLine(reslist[i]); } } } }
using System; using System.Linq; using System.Collections.Generic; using System.Text; namespace Yasuo { class Yasuo { static void Main(string[] asrgs) { int n; int a, b, c; string s; string[] ss; bool flag = true; List<string> reslist = new List<string>(); n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { s = Console.ReadLine(); ss = s.Split(' '); a = int.Parse(ss[0]); b = int.Parse(ss[1]); c = int.Parse(ss[2]); flag = false; if (a >= b && a >= c) { if (a * a == b * b + c * c) flag = true; } else if (b >= a && b >= c) { if (b * b == a * a + c * c) flag = true; } else { if (c * c == a * a + b * b) flag = true; } if (flag) { reslist.Add("YES"); } else { reslist.Add("NO"); } } for (int i = 0; i < n; i++) { Console.WriteLine(reslist[i]); } } } }
[["-", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46], ["+", 0, 7, 8, 196, 0, 57, 75, 196, 0, 46]]
8
299
2
using System; class Program { public static void Main() { int w = int.Parse(Console.ReadLine()); int n = int.Parse(Console.ReadLine()); int[] m = new int[w]; while (w-- > 0) m[w] = w + 1; while (n-- > 0) { int[] a = Array.ConvertAll(Console.ReadLine().Split(','), int.Parse); int b = m[a[0] - 1]; m[a[0] - 1] = m[a[1] - 1]; m[a[1] - 1] = b; } foreach (int s in m) Console.Write(s); } }
using System; class Program { public static void Main() { int w = int.Parse(Console.ReadLine()); int n = int.Parse(Console.ReadLine()); int[] m = new int[w]; while (w-- > 0) m[w] = w + 1; while (n-- > 0) { int[] a = Array.ConvertAll(Console.ReadLine().Split(','), int.Parse); int b = m[a[0] - 1]; m[a[0] - 1] = m[a[1] - 1]; m[a[1] - 1] = b; } foreach (int s in m) Console.WriteLine(s); } }
[["-", 0, 210, 8, 1, 0, 213, 63, 214, 141, 22], ["+", 0, 210, 8, 1, 0, 213, 63, 214, 141, 22]]
8
165
2
using System; using System.Collections.Generic; using System.Linq; namespace _039_RomanFigure { class Program { static void Main(string[] args) { Dictionary<char, int> map = new Dictionary<char, int>(7); map.Add('I', 1); map.Add('V', 5); map.Add('X', 10); map.Add('L', 50); map.Add('C', 100); map.Add('D', 500); map.Add('M', 1000); string inputStr; while ((inputStr = Console.ReadLine()) != null) { int result = 0; int value = map[inputStr[0]]; result += value; for (int lp = 1; lp < inputStr.Length; lp++) { int nextValue = map[inputStr[lp]]; if (value > nextValue) { result += nextValue; } else { result += -value * 2 + nextValue; } value = nextValue; } Console.WriteLine(result); } } } }
using System; using System.Collections.Generic; using System.Linq; namespace _039_RomanFigure { class Program { static void Main(string[] args) { Dictionary<char, int> map = new Dictionary<char, int>(7); map.Add('I', 1); map.Add('V', 5); map.Add('X', 10); map.Add('L', 50); map.Add('C', 100); map.Add('D', 500); map.Add('M', 1000); string inputStr; while ((inputStr = Console.ReadLine()) != null) { int result = 0; int value = map[inputStr[0]]; result += value; for (int lp = 1; lp < inputStr.Length; lp++) { int nextValue = map[inputStr[lp]]; if (value >= nextValue) { result += nextValue; } else { result += -value * 2 + nextValue; } value = nextValue; } Console.WriteLine(result); } } } }
[["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 20]]
8
233
2
using System; class main { static void Main(string[] args) { string s; while ((s = Console.ReadLine()) != null) { double x1, y1, x2, y2, x3, y3, px, py, abc, abp, pbc, apc; string[] a = s.Split(' '); x1 = double.Parse(a[0]); y1 = double.Parse(a[1]); x2 = double.Parse(a[2]); y2 = double.Parse(a[3]); x3 = double.Parse(a[4]); y3 = double.Parse(a[5]); px = double.Parse(a[6]); py = double.Parse(a[7]); abc = Math.Abs(((x1 * (y2 - y3)) + (x2 * (y3 - y1)) + (x3 * (y1 - y2))) * 0.5); abp = Math.Abs(((x1 * (y2 - py)) + (x2 * (py - y1)) + (px * (y1 - y2))) * 0.5); pbc = Math.Abs(((px * (y2 - y3)) + (x2 * (y3 - py)) + (x3 * (py - y2))) * 0.5); apc = Math.Abs(((x1 * (py - y3)) + (px * (y3 - y1)) + (x3 * (y1 - py))) * 0.5); if (abp + pbc + apc == abc) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } }
using System; class main { static void Main(string[] args) { string s; while ((s = Console.ReadLine()) != null) { double x1, y1, x2, y2, x3, y3, px, py, abc, abp, pbc, apc; string[] a = s.Split(' '); x1 = double.Parse(a[0]); y1 = double.Parse(a[1]); x2 = double.Parse(a[2]); y2 = double.Parse(a[3]); x3 = double.Parse(a[4]); y3 = double.Parse(a[5]); px = double.Parse(a[6]); py = double.Parse(a[7]); abc = Math.Abs(((x1 * (y2 - y3)) + (x2 * (y3 - y1)) + (x3 * (y1 - y2))) * 0.5); abp = Math.Abs(((x1 * (y2 - py)) + (x2 * (py - y1)) + (px * (y1 - y2))) * 0.5); pbc = Math.Abs(((px * (y2 - y3)) + (x2 * (y3 - py)) + (x3 * (py - y2))) * 0.5); apc = Math.Abs(((x1 * (py - y3)) + (px * (y3 - y1)) + (x3 * (y1 - py))) * 0.5); if ((abp + pbc + apc) - abc < 0.001) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } }
[["+", 0, 57, 15, 16, 31, 16, 31, 23, 0, 24], ["-", 0, 52, 8, 196, 0, 57, 15, 16, 17, 60], ["+", 0, 57, 15, 16, 31, 16, 31, 23, 0, 25], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 17, 33], ["+", 0, 52, 8, 196, 0, 57, 15, 16, 17, 18], ["+", 0, 52, 8, 196, 0, 57, 15, 16, 12, 250]]
8
369
6
using System; class Program { static void Main() { int N = int.Parse(Console.ReadLine()); int[] answer = new int[N]; for (int i = 0; i < N; i++) { string[] str = Console.ReadLine().Split(' '); int x = int.Parse(str[0]); int y = int.Parse(str[1]); int z = int.Parse(str[2]); int x2y = x * x + y * y; int y2z = y * y + z * z; int z2x = z * z + x * x; if ((Math.Sqrt(x2y) == z) || (Math.Sqrt(y2z) == x)) { answer[i] = 1; } else { if (Math.Sqrt(z2x) == y) answer[i] = 1; } } for (int i = 0; i < N; i++) { if (answer[i] == 1) Console.WriteLine("Yes"); else Console.WriteLine("No"); } } }
using System; class Program { static void Main() { int N = int.Parse(Console.ReadLine()); int[] answer = new int[N]; for (int i = 0; i < N; i++) { string[] str = Console.ReadLine().Split(' '); int x = int.Parse(str[0]); int y = int.Parse(str[1]); int z = int.Parse(str[2]); int x2y = x * x + y * y; int y2z = y * y + z * z; int z2x = z * z + x * x; if ((Math.Sqrt(x2y) == z) || (Math.Sqrt(y2z) == x)) { answer[i] = 1; } else { if (Math.Sqrt(z2x) == y) answer[i] = 1; } } for (int i = 0; i < N; i++) { if (answer[i] == 1) Console.WriteLine("YES"); else Console.WriteLine("NO"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
243
4
using System; class Program { static void Main() { int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; ++i) { string[] input = Console.ReadLine().Split(' '); int[] input_int = new int[3]; for (int j = 0; j < 3; j++) { input_int[j] = int.Parse(input[j]); } Array.Sort(input_int); if (input_int[2] * input_int[2] == input_int[0] * input_int[0] + input_int[1] * input_int[1]) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; class Program { static void Main() { int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; ++i) { string[] input = Console.ReadLine().Split(' '); int[] input_int = new int[3]; for (int j = 0; j < 3; j++) { input_int[j] = int.Parse(input[j]); } Array.Sort(input_int); if (input_int[2] * input_int[2] == input_int[0] * input_int[0] + input_int[1] * input_int[1]) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
166
4
using System; class p0003 { static void Main(string[] args) { int cnt = int.Parse(Console.ReadLine()); while (0 < cnt--) { int[] intAry = new int[3]; var ary = Console.ReadLine().Split(' '); for (int i = 0; i < 3; i++) { intAry[i] = int.Parse(ary[0]); intAry[i] = intAry[i] * intAry[i]; } Array.Sort(intAry); // var x = int.Parse(ary[0]) * int.Parse(ary[0]); // var y = int.Parse(ary[1]) * int.Parse(ary[1]); // var z = int.Parse(ary[2]) * int.Parse(ary[2]); Console.WriteLine((intAry[0] + intAry[1] == intAry[2]) ? "YES" : "NO"); } } }
using System; class p0003 { static void Main(string[] args) { int cnt = int.Parse(Console.ReadLine()); while (0 < cnt--) { int[] intAry = new int[3]; var ary = Console.ReadLine().Split(' '); for (int i = 0; i < 3; i++) { intAry[i] = int.Parse(ary[i]); intAry[i] = intAry[i] * intAry[i]; } Array.Sort(intAry); // var x = int.Parse(ary[0]) * int.Parse(ary[0]); // var y = int.Parse(ary[1]) * int.Parse(ary[1]); // var z = int.Parse(ary[2]) * int.Parse(ary[2]); Console.WriteLine((intAry[0] + intAry[1] == intAry[2]) ? "YES" : "NO"); } } }
[["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 28, 0, 204, 206, 207, 0, 28, 0, 22]]
8
154
2
using System; public class Test { public static void Main() { for (int i = 1; i < 9; i++) for (int j = 1; j < 9; j++) { Console.WriteLine(string.Format("{0}x{1}={2}", i, j, i * j)); } } }
using System; public class Test { public static void Main() { for (int i = 1; i < 10; i++) for (int j = 1; j < 10; j++) { Console.WriteLine(string.Format("{0}x{1}={2}", i, j, i * j)); } } }
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 203], ["-", 8, 196, 0, 7, 8, 7, 15, 16, 12, 203], ["+", 8, 196, 0, 7, 8, 7, 15, 16, 12, 203]]
8
68
4
using System; class Program { static void Main(string[] args) { int i, j; for (i = 1; i < 10; i++) { for (j = 1; j < 10; j++) { Console.WriteLine("{0}*{1}={2}", i, j, i * j); } } } }
using System; class Program { static void Main(string[] args) { int i, j; for (i = 1; i < 10; i++) { for (j = 1; j < 10; j++) { Console.WriteLine("{0}x{1}={2}", i, j, i * j); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
70
2
using System; using System.Linq; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { foreach (int i in Enumerable.Range(1, 9)) { foreach (int j in Enumerable.Range(1, 9)) { Console.WriteLine(i + " x " + j + " = " + i * j); } } } } }
using System; using System.Linq; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { foreach (int i in Enumerable.Range(1, 9)) { foreach (int j in Enumerable.Range(1, 9)) { Console.WriteLine(i + "x" + j + "=" + i * j); } } } } }
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222], ["-", 0, 28, 0, 16, 31, 16, 12, 5, 0, 222], ["+", 0, 28, 0, 16, 31, 16, 12, 5, 0, 222]]
8
80
4
using System; namespace QQ { class Program { static void Main(string[] args) { int i, j; for (i = 1; i <= 9; ++i) { for (j = 1; j <= 9; ++j) { Console.WriteLine("{0}??{1}???{2}", i, j, i * j); } } } } }
using System; namespace QQ { class Program { static void Main(string[] args) { int i, j; for (i = 1; i <= 9; ++i) { for (j = 1; j <= 9; ++j) { Console.WriteLine("{0}x{1}={2}", i, j, i * j); } } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
74
2
using System; using System.Collections.Generic; namespace AOJ.Volume0 { public class Trading { public static void Main() { var company = new Dictionary<int, int>(); var output = new List<int>(); // 今月 while (true) { var input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { break; } int id = int.Parse(input.Substring(0, input.IndexOf(','))); if (company.ContainsKey(id)) { company[id]++; } else { company.Add(id, 1); } } // 先月 while (true) { var input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { break; } int id = int.Parse(input.Substring(0, input.IndexOf(','))); // 出現回数をカウントするが、今月取引がなかった場合は何もしない if (company.ContainsKey(id)) { company[id]++; } // 出力リストに入っていない場合は今月の取引があるかチェック if (!output.Contains(id)) { if (company.ContainsKey(id)) { output.Add(id); } } } // 出力 output.Sort(); foreach (var id in output) { Console.WriteLine(string.Format("{0} {1}", id, output[id])); } } } }
using System; using System.Collections.Generic; namespace AOJ.Volume0 { public class Trading { public static void Main() { var company = new Dictionary<int, int>(); var output = new List<int>(); // 今月 while (true) { var input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { break; } int id = int.Parse(input.Substring(0, input.IndexOf(','))); if (company.ContainsKey(id)) { company[id]++; } else { company.Add(id, 1); } } // 先月 while (true) { var input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { break; } int id = int.Parse(input.Substring(0, input.IndexOf(','))); // 出現回数をカウントするが、今月取引がなかった場合は何もしない if (company.ContainsKey(id)) { company[id]++; } // 出力リストに入っていない場合は今月の取引があるかチェック if (!output.Contains(id)) { if (company.ContainsKey(id)) { output.Add(id); } } } // 出力 output.Sort(); foreach (var id in output) { Console.WriteLine(string.Format("{0} {1}", id, company[id])); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 204, 205, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 204, 205, 22]]
8
274
2
using System; namespace _0014 { class Program { static void Main(string[] args) { while (true) { string ml = Console.ReadLine(); if (ml == null) { break; } int a = int.Parse(ml); int a1 = 600 / a; int y = 0; for (int i = 1; i <= a1; i++) { y += a * (a * (i - 1) * (i - 1)); } Console.WriteLine(y); } } } }
using System; namespace _0014 { class Program { static void Main(string[] args) { while (true) { string ml = Console.ReadLine(); if (ml == null) { break; } int a = int.Parse(ml); int a1 = 600 / a; int y = 0; for (int i = 1; i <= a1; i++) { y += a * a * (a * (i - 1) * (i - 1)); } Console.WriteLine(y); } } } }
[["+", 0, 1, 0, 11, 12, 16, 31, 16, 12, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 17, 48]]
8
112
2
using System; using System.Collections.Generic; using System.Linq; static class Program { static void Main() { var k = int.Parse(Console.ReadLine()); Enumerable.Repeat<Func<string>>(Console.ReadLine, k * 2) .Select((x, i) => new { v = x(), k = i >> 1 }) .GroupBy(x => x.k, x => x.v.Reverse().Select((y, i) => new { v = y - '0', i })) .Select(x => x.SelectMany(y => y) .GroupBy(y => y.i, y => y.v) .Select(y => y.Sum()) .Aggregate(new { c = false, d = new List<int>() }, (a, b) => { var v = b + (a.c ? 1 : 0); var c = v >= 10; a.d.Add(c ? v - 10 : v); return new { c, d = a.d }; }, y => { if (y.c) y.d.Add(1); return y.d.Select(z => (char)(z + '0')) .Reverse() .ToArray(); })) .Select(x => x.Length >= 80 ? "overflow" : new string(x)) .ToList() .ForEach(Console.WriteLine); } }
using System; using System.Collections.Generic; using System.Linq; static class Program { static void Main() { var k = int.Parse(Console.ReadLine()); Enumerable.Repeat<Func<string>>(Console.ReadLine, k * 2) .Select((x, i) => new { v = x(), k = i >> 1 }) .GroupBy(x => x.k, x => x.v.Reverse().Select((y, i) => new { v = y - '0', i })) .Select(x => x.SelectMany(y => y) .GroupBy(y => y.i, y => y.v) .Select(y => y.Sum()) .Aggregate(new { c = false, d = new List<int>() }, (a, b) => { var v = b + (a.c ? 1 : 0); var c = v >= 10; a.d.Add(c ? v - 10 : v); return new { c, d = a.d }; }, y => { if (y.c) y.d.Add(1); return y.d.Select(z => (char)(z + '0')) .Reverse() .ToArray(); })) .Select(x => x.Length > 80 ? "overflow" : new string(x)) .ToList() .ForEach(Console.WriteLine); } }
[["-", 0, 28, 0, 218, 8, 41, 15, 16, 17, 20], ["+", 0, 28, 0, 218, 8, 41, 15, 16, 17, 47]]
8
324
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication52 { class Program { static void Main() { int[] a = new int[1000]; while (true) { string s = Console.ReadLine(); if (s == "") break; int[] b = s.Split(',').Select(int.Parse).ToArray(); a[b[0] - 1]++; } int[] c = new int[1000]; while (true) { string s = Console.ReadLine(); if (s == null) break; int[] b = s.Split(',').Select(int.Parse).ToArray(); a[b[0] - 1]++; } for (int e = 0; e < 1000; e++) { if (a[e] != 0 && c[e] != 0) { Console.WriteLine("{0} {1}", e + 1, a[e] + c[e]); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication52 { class Program { static void Main() { int[] a = new int[1000]; while (true) { string s = Console.ReadLine(); if (s == "") break; int[] b = s.Split(',').Select(int.Parse).ToArray(); a[b[0] - 1]++; } int[] c = new int[1000]; while (true) { string s = Console.ReadLine(); if (s == null) break; int[] b = s.Split(',').Select(int.Parse).ToArray(); c[b[0] - 1]++; } for (int e = 0; e < 1000; e++) { if (a[e] != 0 && c[e] != 0) { Console.WriteLine("{0} {1}", e + 1, a[e] + c[e]); } } } } }
[["-", 8, 196, 0, 1, 0, 223, 0, 204, 205, 22], ["+", 8, 196, 0, 1, 0, 223, 0, 204, 205, 22]]
8
233
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication57 { class Program { static void Main() { int a = int.Parse(Console.ReadLine()); for (int b = 0; b < a; b++) { string c = Console.ReadLine(); // 999 string d = Console.ReadLine(); // 1 string[] e = { c, d }; if (c.Length > d.Length) { e[0] = d; e[1] = c; } // 1 999 int[] f = new int[e[1].Length + 1]; // 4 for (int g = 0; g < e[0].Length; g++) // 1 { int p = e[0][e[0].Length - g - 1]; // 1 int q = e[1][e[1].Length - g - 1]; // int y = (p + q - 96) % 10; f[f.Length - g - 1] += y; f[f.Length - g - 2] = (e[0][e[0].Length - g - 1] + e[1][e[1].Length - g - 1] - 96) / 10; } for (int h = e[0].Length; h < f.Length - 1; h++) { int q = e[1][e[1].Length - h - 1]; int y = (q - 48) % 10; f[f.Length - h - 1] += y; int w = f[f.Length - h - 1]; f[f.Length - h - 1] %= 10; f[f.Length - h - 2] = w / 10; } if (f[0] == 0) { if (f.Length > 79) Console.WriteLine("overflow"); else { for (int q = 1; q < f.Length; q++) { Console.Write(f[q]); } Console.WriteLine(); } } else { if (f.Length > 80) Console.WriteLine("overflow"); else { foreach (int q in f) { Console.Write(q); } Console.WriteLine(); } } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication57 { class Program { static void Main() { int a = int.Parse(Console.ReadLine()); for (int b = 0; b < a; b++) { string c = Console.ReadLine(); // 999 string d = Console.ReadLine(); // 1 string[] e = { c, d }; if (c.Length > d.Length) { e[0] = d; e[1] = c; } // 1 999 int[] f = new int[e[1].Length + 1]; // 4 for (int g = 0; g < e[0].Length; g++) // 1 { int p = e[0][e[0].Length - g - 1]; // 1 int q = e[1][e[1].Length - g - 1]; // int y = (p + q - 96) % 10; f[f.Length - g - 1] += y; f[f.Length - g - 2] = (e[0][e[0].Length - g - 1] + e[1][e[1].Length - g - 1] - 96) / 10; } for (int h = e[0].Length; h < f.Length - 1; h++) { int q = e[1][e[1].Length - h - 1]; int y = (q - 48) % 10; f[f.Length - h - 1] += y; int w = f[f.Length - h - 1]; f[f.Length - h - 1] %= 10; f[f.Length - h - 2] = w / 10; } if (f[0] == 0) { if (f.Length > 81) Console.WriteLine("overflow"); else { for (int q = 1; q < f.Length; q++) { Console.Write(f[q]); } Console.WriteLine(); } } else { if (f.Length > 80) Console.WriteLine("overflow"); else { foreach (int q in f) { Console.Write(q); } Console.WriteLine(); } } } } } }
[["-", 0, 57, 64, 196, 0, 57, 15, 16, 12, 203], ["+", 0, 57, 64, 196, 0, 57, 15, 16, 12, 203]]
8
504
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CompetitiveProg { class Program { static int W; static int n; static List<VW> vws; static VW?[,] memo; static void Main(string[] args) { var c = 1; while ((W = int.Parse(Console.ReadLine())) != 0) { vws = new List<VW>(); n = int.Parse(Console.ReadLine()); memo = new VW?[n, W + 1]; foreach (var i in Enumerable.Range(0, n - 1)) { foreach (var j in Enumerable.Range(0, W)) { memo[i, j] = null; } } for (int i = 0; i < n; i++) { vws.Add( new VW(Console.ReadLine().Split(',').Select(s => int.Parse(s)))); } var r = solve(0, W); Console.WriteLine("Case {0}:\n{1}\n{2}", c, r.v, r.w); c++; } } private static VW solve(int i, int w) { VW res; if (memo[i, w] != null) return (VW)memo[i, w]; if (i == n) { res = new VW(new[] { 0, 0 }); } else if (w < vws[i].w) { res = solve(i + 1, w); } else res = (new[] { solve(i + 1, w), solve(i + 1, w - vws[i].w) + new VW(new[] { vws[i].v, vws[i].w }) }) .Max(); memo[i, w] = res; return res; } struct VW : IComparable<VW> { public readonly int v; public readonly int w; public static VW operator +(VW a, VW b) { return new VW(new[] { a.v + b.v, a.w + b.w }); } public VW(IEnumerable<int> enumerable) { v = enumerable.ToList()[0]; w = enumerable.ToList()[1]; } public int CompareTo(VW other) { int dv; if ((dv = this.v - other.v) == 0) { return -(this.w - other.w); } else { return dv; } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CompetitiveProg { class Program { static int W; static int n; static List<VW> vws; static VW?[,] memo; static void Main(string[] args) { var c = 1; while ((W = int.Parse(Console.ReadLine())) != 0) { vws = new List<VW>(); n = int.Parse(Console.ReadLine()); memo = new VW?[n + 1, W + 1]; foreach (var i in Enumerable.Range(0, n)) { foreach (var j in Enumerable.Range(0, W)) { memo[i, j] = null; } } for (int i = 0; i < n; i++) { vws.Add( new VW(Console.ReadLine().Split(',').Select(s => int.Parse(s)))); } var r = solve(0, W); Console.WriteLine("Case {0}:\n{1}\n{2}", c, r.v, r.w); c++; } } private static VW solve(int i, int w) { VW res; if (memo[i, w] != null) return (VW)memo[i, w]; if (i == n) { res = new VW(new[] { 0, 0 }); } else if (w < vws[i].w) { res = solve(i + 1, w); } else res = (new[] { solve(i + 1, w), solve(i + 1, w - vws[i].w) + new VW(new[] { vws[i].v, vws[i].w }) }) .Max(); memo[i, w] = res; return res; } struct VW : IComparable<VW> { public readonly int v; public readonly int w; public static VW operator +(VW a, VW b) { return new VW(new[] { a.v + b.v, a.w + b.w }); } public VW(IEnumerable<int> enumerable) { v = enumerable.ToList()[0]; w = enumerable.ToList()[1]; } public int CompareTo(VW other) { int dv; if ((dv = this.v - other.v) == 0) { return -(this.w - other.w); } else { return dv; } } } } }
[["+", 12, 227, 39, 224, 225, 226, 0, 16, 17, 72], ["+", 12, 227, 39, 224, 225, 226, 0, 16, 12, 203], ["-", 12, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["-", 12, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
8
553
4
using System; using System.Linq; using System.Text; namespace V0043 { public class Program { public static void Main(string[] args) { string input; while ((input = Console.ReadLine()) != null) { var tile = new int[12]; Array.ForEach(input.ToCharArray(), c => tile[c - '0']++); var hora = false; Action<int> act = null; act = x => { if (tile[x] < 0 || tile[x + 1] < 0 || hora) { return; } if (x >= 9) { if (tile.Count(i => i == 2) == 1 && tile.All(i => i == 0 || i == 2 || i == 3)) { hora = true; } return; } for (var i = 0; i <= tile[x]; i++) { if (tile[x] - i == 1) continue; for (var j = 0; j < 3; j++) tile[x + j] -= i; act(x + 1); for (var j = 0; j < 3; j++) tile[x + j] += i; } }; var result = new bool[9 + 1]; for (var i = 1; i <= 9; i++) { tile[i]++; if (tile[i] >= 5) act(1); result[i] = hora; hora = false; tile[i]--; } if (result.Any(b => b)) { var sb = new StringBuilder(); for (var i = 1; i <= 9; i++) if (result[i]) sb.Append(i + " "); Console.WriteLine(sb.ToString().Trim()); } else { Console.WriteLine(0); } } } } }
using System; using System.Linq; using System.Text; namespace V0043 { public class Program { public static void Main(string[] args) { string input; while ((input = Console.ReadLine()) != null) { var tile = new int[12]; Array.ForEach(input.ToCharArray(), c => tile[c - '0']++); var hora = false; Action<int> act = null; act = x => { if (tile[x] < 0 || tile[x + 1] < 0 || hora) { return; } if (x >= 9) { if (tile.Count(i => i == 2) == 1 && tile.All(i => i == 0 || i == 2 || i == 3)) { hora = true; } return; } for (var i = 0; i <= tile[x]; i++) { if (tile[x] - i == 1) continue; for (var j = 0; j < 3; j++) tile[x + j] -= i; act(x + 1); for (var j = 0; j < 3; j++) tile[x + j] += i; } }; var result = new bool[9 + 1]; for (var i = 1; i <= 9; i++) { tile[i]++; if (tile[i] < 5) act(1); result[i] = hora; hora = false; tile[i]--; } if (result.Any(b => b)) { var sb = new StringBuilder(); for (var i = 1; i <= 9; i++) if (result[i]) sb.Append(i + " "); Console.WriteLine(sb.ToString().Trim()); } else { Console.WriteLine(0); } } } } }
[["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 18]]
8
406
2
using System; class _0045 { public static void Main() { string str; long sum = 0, ams = 0, ave = 0, c = 0; int[] nums; while ((str = Console.ReadLine()) != null) { c++; nums = Array.ConvertAll(str.Split(','), s => int.Parse(s)); sum += nums[0] * nums[1]; ams += nums[1]; } ave = (long)Math.Round((double)(ams / c), MidpointRounding.AwayFromZero); Console.Write("{0}\n{1}\n", sum, ave); } }
using System; class _0045 { public static void Main() { string str; long sum = 0, ams = 0, ave = 0, c = 0; int[] nums; while ((str = Console.ReadLine()) != null) { c++; nums = Array.ConvertAll(str.Split(','), s => int.Parse(s)); sum += nums[0] * nums[1]; ams += nums[1]; } ave = (long)Math.Round(ams / (double)c, MidpointRounding.AwayFromZero); Console.Write("{0}\n{1}\n", sum, ave); } }
[["+", 51, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["+", 51, 213, 3, 4, 0, 28, 0, 16, 17, 85], ["-", 3, 4, 0, 28, 0, 74, 51, 23, 0, 24], ["-", 0, 28, 0, 74, 51, 23, 0, 16, 31, 22], ["-", 0, 28, 0, 74, 51, 23, 0, 16, 17, 85], ["-", 3, 4, 0, 28, 0, 74, 51, 23, 0, 25]]
8
142
6
using System; class Program { static void Main(string[] args) { for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { Console.WriteLine("{0} x {1} = {2}", i, j, i * j); } } } }
using System; class Program { static void Main(string[] args) { for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { Console.WriteLine("{0}x{1}={2}", i, j, i * j); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
67
2
using System; using System.Linq; namespace aizu { class OnlineJudge { static void Main() { int count = int.Parse(Console.ReadLine()); while (count-- > 0) { var l = Console.ReadLine() .Split() .Select(p => int.Parse(p)) .OrderBy(p => p) .ToArray(); Console.WriteLine(l[0] * l[0] + l[1] * l[1] == l[2] * l[2] ? "Yes" : "No"); } } } }
using System; using System.Linq; namespace aizu { class OnlineJudge { static void Main() { int count = int.Parse(Console.ReadLine()); while (count-- > 0) { var l = Console.ReadLine() .Split() .Select(p => int.Parse(p)) .OrderBy(p => p) .ToArray(); Console.WriteLine(l[0] * l[0] + l[1] * l[1] == l[2] * l[2] ? "YES" : "NO"); } } } }
[["-", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 64, 5, 0, 222], ["-", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222], ["+", 3, 4, 0, 28, 0, 41, 75, 5, 0, 222]]
8
125
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication40 { class Program { static void Main() { bool[] a = { true, false, false }; bool b; while (true) { string c = Console.ReadLine(); if (c == null) break; string[] d = c.Split(); Array.Sort(d); if (d[0] == "A") { if (d[1] == "B") { b = a[0]; a[0] = a[1]; a[1] = b; } else { b = a[0]; a[0] = a[2]; a[2] = b; } } else { b = a[1]; a[1] = a[2]; a[2] = b; } } for (int u = 0; u < 3; u++) { if (a[u]) switch (u) { case 0: Console.WriteLine("A"); break; case 1: Console.WriteLine("B"); break; case 2: Console.WriteLine("C"); break; } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication40 { class Program { static void Main() { bool[] a = { true, false, false }; bool b; while (true) { string c = Console.ReadLine(); if (c == null) break; string[] d = c.Split(','); Array.Sort(d); if (d[0] == "A") { if (d[1] == "B") { b = a[0]; a[0] = a[1]; a[1] = b; } else { b = a[0]; a[0] = a[2]; a[2] = b; } } else { b = a[1]; a[1] = a[2]; a[2] = b; } } for (int u = 0; u < 3; u++) { if (a[u]) switch (u) { case 0: Console.WriteLine("A"); break; case 1: Console.WriteLine("B"); break; case 2: Console.WriteLine("C"); break; } } } } }
[["+", 0, 213, 3, 4, 0, 28, 0, 252, 0, 104], ["+", 0, 213, 3, 4, 0, 28, 0, 252, 0, 253]]
8
267
3
using System; class Program { static void Main() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { Console.WriteLine(i + "*" + j + "=" + i * j); } } } }
using System; class Program { static void Main() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { Console.WriteLine(i + "x" + j + "=" + i * j); } } } }
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222]]
8
67
2
using System; namespace _0047 { class Program { static void Main(string[] args) { char ball = 'A'; while (true) { string now = Console.ReadLine(); if (now == null) { break; } if (now[0] == ball) { ball = now[2]; } if (now[2] == ball) { ball = now[0]; } } Console.WriteLine(ball); } } }
using System; namespace _0047 { class Program { static void Main(string[] args) { char ball = 'A'; while (true) { string now = Console.ReadLine(); if (now == null) { break; } if (now[0] == ball) { ball = now[2]; } else if (now[2] == ball) { ball = now[0]; } } Console.WriteLine(ball); } } }
[["+", 8, 196, 0, 52, 8, 196, 0, 57, 0, 95]]
8
97
1
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace P0003_Is_it_a_Right_Triangle { class Program { static void Main(string[] args) { List<string> lines = new List<string>(); int cntLine = int.Parse(Console.ReadLine()); for (int i = 1; i <= cntLine; i++) { lines.Add(Console.ReadLine()); } foreach (string line in lines) { List<string> sidesStr = line.Split(' ').ToList<string>(); List<int> sides = new List<int>(); foreach (string sideStr in sidesStr) { sides.Add(int.Parse(sideStr)); } sides.Sort(); if (Math.Pow(sides[2], 2) == Math.Pow(sides[0], 2) + Math.Pow(sides[1], 2)) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace P0003_Is_it_a_Right_Triangle { class Program { static void Main(string[] args) { List<string> lines = new List<string>(); int cntLine = int.Parse(Console.ReadLine()); for (int i = 1; i <= cntLine; i++) { lines.Add(Console.ReadLine()); } foreach (string line in lines) { List<string> sidesStr = line.Split(' ').ToList<string>(); List<int> sides = new List<int>(); foreach (string sideStr in sidesStr) { sides.Add(int.Parse(sideStr)); } sides.Sort(); if (Math.Pow(sides[2], 2) == Math.Pow(sides[0], 2) + Math.Pow(sides[1], 2)) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
227
4
using System; class main { static void Main(string[] args) { string s = Console.ReadLine(); if (s != null) { int n = int.Parse(s); for (int i = 1; i <= n; ++i) { string s2 = Console.ReadLine(); if (s2 != null) { string[] t = s.Split(' '); int[] a = new int[3]; a[0] = int.Parse(t[0]); a[1] = int.Parse(t[1]); a[2] = int.Parse(t[2]); Array.Sort(a); if ((a[2] * a[2]) == (a[1] * a[1] + a[0] * a[0])) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } } // Console.ReadKey(); } }
using System; class main { static void Main(string[] args) { string s = Console.ReadLine(); if (s != null) { int n = int.Parse(s); for (int i = 1; i <= n; ++i) { string s2 = Console.ReadLine(); if (s2 != null) { string[] t = s2.Split(' '); int[] a = new int[3]; a[0] = int.Parse(t[0]); a[1] = int.Parse(t[1]); a[2] = int.Parse(t[2]); Array.Sort(a); if ((a[2] * a[2]) == (a[1] * a[1] + a[0] * a[0])) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } } // Console.ReadKey(); } }
[["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 22], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 22]]
8
215
2
using System; class Program { static void Main() { for (int x = 1; x <= 9; ++x) { for (int y = 1; y <= 9; ++y) { Console.Write("{0}*{1}={2}", x, y, x * y); } } } }
using System; class Program { static void Main() { for (int x = 1; x <= 9; ++x) { for (int y = 1; y <= 9; ++y) { Console.WriteLine("{0}x{1}={2}", x, y, x * y); } } } }
[["-", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
63
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication40 { class Program { static void Main() { while (true) { string a = Console.ReadLine(); if (a == null) break; decimal b = decimal.Parse(a); if (b > 91) Console.WriteLine("heavy"); else if (b > 81) Console.WriteLine("light heavy"); else if (b > 75) Console.WriteLine("middle"); else if (b > 69) Console.WriteLine("light middle"); else if (b > 64) Console.WriteLine("welter"); else if (b > 60) Console.WriteLine("light welter"); else if (b > 57) Console.WriteLine("light"); else if (b > 54) Console.WriteLine("fether"); else if (b > 51) Console.WriteLine("bantam"); else if (b > 48) Console.WriteLine("fly"); else Console.WriteLine("light fly"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication40 { class Program { static void Main() { while (true) { string a = Console.ReadLine(); if (a == null) break; decimal b = decimal.Parse(a); if (b > 91) Console.WriteLine("heavy"); else if (b > 81) Console.WriteLine("light heavy"); else if (b > 75) Console.WriteLine("middle"); else if (b > 69) Console.WriteLine("light middle"); else if (b > 64) Console.WriteLine("welter"); else if (b > 60) Console.WriteLine("light welter"); else if (b > 57) Console.WriteLine("light"); else if (b > 54) Console.WriteLine("feather"); else if (b > 51) Console.WriteLine("bantam"); else if (b > 48) Console.WriteLine("fly"); else Console.WriteLine("light fly"); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
237
2
using System; namespace _0003 { class Program { static void Main(string[] args) { var dataCount = int.Parse(Console.ReadLine()); for (int i = 0; i < dataCount; i++) { var input = Console.ReadLine(); if (input != null) { string[] parts = input.Split(' '); int[] sides = new int[3]; sides[0] = int.Parse(parts[0]); sides[1] = int.Parse(parts[1]); sides[2] = int.Parse(parts[2]); Array.Sort(sides); if ((sides[2] * sides[2]) == (sides[1] * sides[1] + sides[0] * sides[0])) { Console.Write("YES"); } else { Console.Write("NO"); } } } } } }
using System; namespace _0003 { class Program { static void Main(string[] args) { var dataCount = int.Parse(Console.ReadLine()); for (int i = 0; i < dataCount; i++) { var input = Console.ReadLine(); if (input != null) { string[] parts = input.Split(' '); int[] sides = new int[3]; sides[0] = int.Parse(parts[0]); sides[1] = int.Parse(parts[1]); sides[2] = int.Parse(parts[2]); Array.Sort(sides); if ((sides[2] * sides[2]) == (sides[1] * sides[1] + sides[0] * sides[0])) { Console.Write("YES\n"); } else { Console.Write("NO\n"); } } } } } }
[["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 44]]
8
205
2
using System; namespace a { class Program { public static void Main(string[] args) { for (int i = 1; i <= 9; i++) for (int j = 1; j <= 9; j++) Console.WriteLine(i + "+" + j + "=" + (i * j)); } } }
using System; namespace a { class Program { public static void Main(string[] args) { for (int i = 1; i <= 9; i++) for (int j = 1; j <= 9; j++) Console.WriteLine(i + "x" + j + "=" + (i * j)); } } }
[["-", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222], ["+", 31, 16, 31, 16, 31, 16, 12, 5, 0, 222]]
8
74
2
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { while (true) { String str = Console.ReadLine(); if (str == null) { break; } String[] strArray = str.Split(); double[] a = new double[6]; for (int i = 0; i < 6; i++) { a[i] = double.Parse(strArray[i]); } double y = (a[2] * a[3] - a[0] * a[5]) / (a[1] * a[3] - a[0] * a[4]); double x = (a[2] - a[1] * y) / a[0]; System.Console.WriteLine("{0:f3} {1:f3}\n", x, y); } } } }
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { while (true) { String str = Console.ReadLine(); if (str == null) { break; } String[] strArray = str.Split(); double[] a = new double[6]; for (int i = 0; i < 6; i++) { a[i] = double.Parse(strArray[i]); } double y = (a[2] * a[3] - a[0] * a[5]) / (a[1] * a[3] - a[0] * a[4]); double x = (a[2] - a[1] * y) / a[0]; System.Console.WriteLine("{0:f3} {1:f3}", x, y); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 44]]
8
185
1
using System; namespace _0048 { class Program { static void Main(string[] args) { while (true) { string uef = Console.ReadLine(); if (uef == null) { break; } string r = ""; float a = int.Parse(uef); if (a <= 48) { r = "light fly"; } else if (a <= 51) { r = "fly"; } else if (a <= 54) { r = "bantam"; } else if (a <= 57) { r = "feather"; } else if (a <= 60) { r = "light"; } else if (a <= 64) { r = "light welter"; } else if (a <= 69) { r = "welter"; } else if (a <= 75) { r = "light middle"; } else if (a <= 81) { r = "middle"; } else if (a <= 91) { r = "light heavy"; ; } else { r = "heavy"; } Console.WriteLine(r); } } } }
using System; namespace _0048 { class Program { static void Main(string[] args) { while (true) { string uef = Console.ReadLine(); if (uef == null) { break; } string r = ""; float a = float.Parse(uef); if (a <= 48) { r = "light fly"; } else if (a <= 51) { r = "fly"; } else if (a <= 54) { r = "bantam"; } else if (a <= 57) { r = "feather"; } else if (a <= 60) { r = "light"; } else if (a <= 64) { r = "light welter"; } else if (a <= 69) { r = "welter"; } else if (a <= 75) { r = "light middle"; } else if (a <= 81) { r = "middle"; } else if (a <= 91) { r = "light heavy"; ; } else { r = "heavy"; } Console.WriteLine(r); } } } }
[["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
8
229
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Prob0004 { class Program { const char splitBy = ' '; static void Main(string[] args) { string line; while (!string.IsNullOrEmpty(line = System.Console.ReadLine())) { double[] param = Array.ConvertAll(line.Split(splitBy), e => double.Parse(e)); solve(param); } } static void solve(double[] param) { double x; double y; if (param[0] != 0.0 && param[3] != 0.0) { double a = param[3] / param[0]; y = (param[5] - param[2] * a) / (param[4] - param[1] * a); x = (param[2] - param[1] * y) / param[0]; } else { double a = param[4] / param[1]; x = (param[5] - param[2] * a) / (param[3] - param[0] * a); y = (param[2] - param[0] * x) / param[1]; } Console.WriteLine("{0:F4} {1:F4}", x, y); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Prob0004 { class Program { const char splitBy = ' '; static void Main(string[] args) { string line; while (!string.IsNullOrEmpty(line = System.Console.ReadLine())) { double[] param = Array.ConvertAll(line.Split(splitBy), e => double.Parse(e)); solve(param); } } static void solve(double[] param) { double x; double y; if (param[0] != 0.0 && param[3] != 0.0) { double a = param[3] / param[0]; y = (param[5] - param[2] * a) / (param[4] - param[1] * a); x = (param[2] - param[1] * y) / param[0]; } else { double a = param[4] / param[1]; x = (param[5] - param[2] * a) / (param[3] - param[0] * a); y = (param[2] - param[0] * x) / param[1]; } Console.WriteLine("{0:F3} {1:F3}", x, y); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
280
2