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.Text; using System.Linq; namespace ConsoleApplication2 { class Program { private static bool HasSustring(string s, string p) { int endPos = s.Length - p.Length + 1; for (int i = 0; i < endPos; i++) { if (p == s.Substring(i, p.Length - 1)) return true; } return false; } static void Main(string[] args) { string s = Console.ReadLine(); string p = Console.ReadLine(); s += s.Substring(0, p.Length - 1); Console.WriteLine(HasSustring(s, p) ? "Yes" : "No"); } } }
using System; using System.Collections.Generic; using System.Text; using System.Linq; namespace ConsoleApplication2 { class Program { private static bool HasSustring(string s, string p) { int endPos = s.Length - p.Length + 1; for (int i = 0; i < endPos; i++) { if (p == s.Substring(i, p.Length)) return true; } return false; } static void Main(string[] args) { string s = Console.ReadLine(); string p = Console.ReadLine(); s += s.Substring(0, p.Length - 1); Console.WriteLine(HasSustring(s, p) ? "Yes" : "No"); } } }
[["-", 12, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["-", 12, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
8
157
2
using System; namespace ConsoleApplication9 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); string s2 = s + s; string p = Console.ReadLine(); if (s2.Contains(p)) { Console.WriteLine("yes"); } else Console.WriteLine("no"); } } }
using System; namespace ConsoleApplication9 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); string s2 = s + s; string p = Console.ReadLine(); if (s2.Contains(p)) { 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
77
4
using System; namespace AOJ { class Program { static void Main(string[] args) { string serch_word, sample_word; // while(true) { //?????????????????? var read = Console.ReadLine(); sample_word = read; read = Console.ReadLine(); serch_word = read; serch_word += serch_word; if (0 <= sample_word.IndexOf(serch_word)) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } } }
using System; namespace AOJ { class Program { static void Main(string[] args) { string serch_word, sample_word; // while(true) { //?????????????????? var read = Console.ReadLine(); sample_word = read; read = Console.ReadLine(); serch_word = read; sample_word += sample_word; if (0 <= sample_word.IndexOf(serch_word)) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } } }
[["-", 8, 196, 0, 196, 0, 1, 0, 11, 31, 22], ["+", 8, 196, 0, 196, 0, 1, 0, 11, 31, 22], ["-", 8, 196, 0, 196, 0, 1, 0, 11, 12, 22], ["+", 8, 196, 0, 196, 0, 1, 0, 11, 12, 22]]
8
94
4
using System; using System.Collections.Generic; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); string p = Console.ReadLine(); s += s; if (s.Contains(p)) { Console.WriteLine("YES"); } else { Console.WriteLine("NO"); } } } }
using System; using System.Collections.Generic; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); string p = Console.ReadLine(); s += s; if (s.Contains(p)) { 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
83
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); string p = Console.ReadLine(); int ma = 0; for (int i = 0; i < s.Length; i++) { if (p[0] == s[i]) { int t = 1; int k = t + i; while (t < p.Length) { if (k >= s.Length) k -= s.Length; if (p[t] == s[k]) { t++; k++; } else break; } ma = (t > ma) ? t : ma; } } if (ma == p.Length) Console.WriteLine("YES"); else Console.WriteLine("NO"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); string p = Console.ReadLine(); int ma = 0; for (int i = 0; i < s.Length; i++) { if (p[0] == s[i]) { int t = 1; int k = t + i; while (t < p.Length) { if (k >= s.Length) k -= s.Length; if (p[t] == s[k]) { t++; k++; } else break; } ma = (t > ma) ? t : ma; } } if (ma == p.Length) 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
197
4
using System; class Program { static void Main() { string str1 = Console.ReadLine(); string str2 = Console.ReadLine(); string strroop = str1 + str1; if (0 <= strroop.IndexOf(str2)) Console.WriteLine("YES"); else Console.WriteLine("NO"); } }
using System; class Program { static void Main() { string str1 = Console.ReadLine(); string str2 = Console.ReadLine(); string strroop = str1 + str1; if (0 <= strroop.IndexOf(str2)) 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
69
4
using System; namespace Test { class MainClass { public static void Main(string[] args) { var W = Console.ReadLine(); var count = 0; var line = ""; while ((line = Console.ReadLine()) != "END_OF_TEXT") { var words = line.Split(); foreach (var item in words) { if (item == W) ++count; } } Console.WriteLine(count); } } }
using System; namespace Test { class MainClass { public static void Main(string[] args) { var W = Console.ReadLine(); var count = 0; var line = ""; while ((line = Console.ReadLine()) != "END_OF_TEXT") { var words = line.ToLower().Split(); foreach (var item in words) { if (item == W) ++count; } } Console.WriteLine(count); } } }
[["+", 0, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 0, 213, 63, 214, 205, 213, 3, 4, 0, 24], ["+", 0, 213, 63, 214, 205, 213, 3, 4, 0, 25], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 0, 131]]
8
95
4
using System; namespace AOJ { class Program { static void Main(string[] args) { string serch_word, sample_word = ""; int ans = 0; var read_text = Console.ReadLine(); serch_word = read_text; while (true) { //?????????????????? read_text = Console.ReadLine(); if (read_text == "END_OF_TEXT") break; sample_word += read_text + " "; } var sample_word_arry = sample_word.Split(' '); //?????????????´¢ foreach (string s in sample_word_arry) { if (s == serch_word) { ans++; } } Console.WriteLine(ans); } } }
using System; namespace AOJ { class Program { static void Main(string[] args) { string serch_word, sample_word = ""; int ans = 0; var read_text = Console.ReadLine(); serch_word = read_text; while (true) { //?????????????????? read_text = Console.ReadLine(); if (read_text == "END_OF_TEXT") break; sample_word += read_text + " "; } var sample_word_arry = sample_word.ToLower().Split(' '); //?????????????´¢ foreach (string s in sample_word_arry) { if (s == serch_word) { ans++; } } Console.WriteLine(ans); } } }
[["+", 0, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 0, 213, 63, 214, 205, 213, 3, 4, 0, 24], ["+", 0, 213, 63, 214, 205, 213, 3, 4, 0, 25], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 0, 131]]
8
121
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace StartFinish { class Program { static void Main(string[] args) { string word = Console.ReadLine(); string str; int count = 0; while ((str = Console.ReadLine()) != "END_OF_TEXT") { string[] strdivision = str.Split(' ').ToArray(); foreach (var x in strdivision) { if (x == word) { count++; } } } Console.WriteLine(count); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace StartFinish { class Program { static void Main(string[] args) { string word = Console.ReadLine(); string str; int count = 0; while ((str = Console.ReadLine()) != "END_OF_TEXT") { string[] strdivision = str.ToLower().Split(' ').ToArray(); foreach (var x in strdivision) { if (x == word) { count++; } } } Console.WriteLine(count); } } }
[["+", 205, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 205, 213, 63, 214, 205, 213, 3, 4, 0, 24], ["+", 205, 213, 63, 214, 205, 213, 3, 4, 0, 25], ["+", 0, 213, 63, 214, 205, 213, 63, 214, 0, 131]]
8
124
4
using System; namespace ITP1_9 { class Program { static void Main(string[] args) { string w = Console.ReadLine(); int c = 0; while (true) { string a = Console.ReadLine(); if (a == "END_OF_TEXT") break; foreach (string s in a.Split(' ')) if (s == w) c++; } Console.WriteLine("{0}", c); } } }
using System; namespace ITP1_9 { class Program { static void Main(string[] args) { string w = Console.ReadLine(); int c = 0; while (true) { string a = Console.ReadLine(); if (a == "END_OF_TEXT") break; foreach (string s in a.ToLower().Split(' ')) if (s == w) c++; } Console.WriteLine("{0}", c); } } }
[["+", 12, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 12, 213, 63, 214, 205, 213, 3, 4, 0, 24], ["+", 12, 213, 63, 214, 205, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 210, 12, 213, 63, 214, 0, 131]]
8
95
4
using System; namespace ITP1_9 { class Program { static void Main() { var w = Console.ReadLine(); int c = 0; while (true) { var t = Console.ReadLine(); if (t == "END_OF_TEXT") break; foreach (var u in t.Split()) if (w == u) c++; } Console.Write("{0}\n", c); } } }
using System; namespace ITP1_9 { class Program { static void Main() { var w = Console.ReadLine(); int c = 0; while (true) { var t = Console.ReadLine(); if (t == "END_OF_TEXT") break; foreach (var u in t.ToLower().Split()) if (w == u) c++; } Console.Write("{0}\n", c); } } }
[["+", 12, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 12, 213, 63, 214, 205, 213, 3, 4, 0, 24], ["+", 12, 213, 63, 214, 205, 213, 3, 4, 0, 25], ["+", 8, 196, 0, 210, 12, 213, 63, 214, 0, 131]]
8
89
4
using System; namespace ITP1_9_A { class Program { static void Main(string[] args) { string s = Console.ReadLine(); int count = 0; while (true) { string str = Console.ReadLine(); if (str == "END_OF_TEXT") break; string Lowstr = str.ToLower(); string[] strArray = Lowstr.Split(' '); for (int i = 0; i < str.Length; i++) { if (strArray[i] == s) count++; } } Console.WriteLine(count); } } }
using System; namespace ITP1_9_A { class Program { static void Main(string[] args) { string s = Console.ReadLine(); int count = 0; while (true) { string str = Console.ReadLine(); if (str == "END_OF_TEXT") break; string Lowstr = str.ToLower(); string[] strArray = Lowstr.Split(' '); for (int i = 0; i < strArray.Length; i++) { if (strArray[i] == s) count++; } } Console.WriteLine(count); } } }
[["-", 8, 196, 0, 7, 15, 16, 12, 214, 205, 22], ["+", 8, 196, 0, 7, 15, 16, 12, 214, 205, 22]]
8
121
2
using System; using System.Collections.Generic; using System.IO; using System.Linq; namespace AizuOnline { internal class Program { private static void Main(string[] args) { var W = Console.ReadLine(); var T = string.Empty; while (true) { var tmp = Console.ReadLine(); if (tmp == "END_OF_TEXT") { break; } T += tmp; } var count = 0; foreach (var t in T.Split(' ')) { if (t.ToLower() == W.ToLower()) { count++; } } Console.WriteLine(count); Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; namespace AizuOnline { internal class Program { private static void Main(string[] args) { var W = Console.ReadLine(); var T = string.Empty; while (true) { var tmp = Console.ReadLine(); if (tmp == "END_OF_TEXT") { break; } T += tmp + " "; } var count = 0; foreach (var t in T.Split(' ')) { if (t.ToLower() == W.ToLower()) { count++; } } Console.WriteLine(count); Console.ReadLine(); } } }
[["+", 8, 196, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 16, 12, 5, 0, 62], ["+", 0, 1, 0, 11, 12, 16, 12, 5, 0, 222]]
8
141
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication14 { class Program { static void Main() { while (true) { string a = Console.ReadLine(); if (a == "-") break; int s = 0; int c = int.Parse(Console.ReadLine()); for (int d = 0; d < c; d++) { int y = int.Parse(Console.ReadLine()); s += y; } int u = a.Length; int r = s % u; for (int t = 0; t < u - r; t++) { Console.Write(a[r + t]); } for (int q = 0; q < r; q++) { Console.Write(a[q]); } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication14 { class Program { static void Main() { while (true) { string a = Console.ReadLine(); if (a == "-") break; int s = 0; int c = int.Parse(Console.ReadLine()); for (int d = 0; d < c; d++) { int y = int.Parse(Console.ReadLine()); s += y; } int u = a.Length; int r = s % u; for (int t = 0; t < u - r; t++) { Console.Write(a[r + t]); } for (int q = 0; q < r; q++) { Console.Write(a[q]); } Console.WriteLine(); } } } }
[["+", 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
183
6
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace StartFinish { class Program { static void Main(string[] args) { string left; string right; while (true) { string str = Console.ReadLine(); if (str == "-") { break; } int m = int.Parse(Console.ReadLine()); for (int i = 0; i < m; i++) { int h = int.Parse(Console.ReadLine()); left = str.Substring(0, h); right = str.Substring(h); str = left + right; } Console.WriteLine(str); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace StartFinish { class Program { static void Main(string[] args) { string left; string right; while (true) { string str = Console.ReadLine(); if (str == "-") { break; } int m = int.Parse(Console.ReadLine()); for (int i = 0; i < m; i++) { int h = int.Parse(Console.ReadLine()); left = str.Substring(0, h); right = str.Substring(h); str = right + left; } Console.WriteLine(str); } } } }
[["-", 8, 196, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 8, 196, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 12, 22]]
8
154
4
using System; public class Test { public static void Main() { int n = int.Parse(Console.ReadLine()); int tscore = 0; int hscore = 0; for (var i = 0; i < n; i++) { string[] th = Console.ReadLine().Split(' '); var res = string.Compare(th[0], th[1]); if (res < 0) { hscore += 3; } else if (0 < res) { tscore += 3; } else { tscore++; hscore++; } Console.WriteLine(tscore + " " + hscore); } } }
using System; public class Test { public static void Main() { int n = int.Parse(Console.ReadLine()); int tscore = 0; int hscore = 0; for (var i = 0; i < n; i++) { string[] th = Console.ReadLine().Split(' '); var res = string.Compare(th[0], th[1]); if (res < 0) { hscore += 3; } else if (0 < res) { tscore += 3; } else { tscore++; hscore++; } } Console.WriteLine(tscore + " " + hscore); } }
[["+", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46], ["-", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46]]
8
139
2
using LIB; using System; using System.Linq; using System.Text; using System.Collections.Generic; class Program { static void Main(string[] args) { int n = io.r<int>(); int t = 0; int h = 0; for (int i = 0; i < n; i++) { string[] s = io.r<string>(' '); int ans = s[0].CompareTo(s[1]); if (ans == 0) { t++; h++; } else if (ans < 0) { t += 3; } else { h += 3; } } io.w(t + " " + h); io.wflush(); } } namespace LIB { public class io { private const int WMAX = 1000; private static StringBuilder S = new StringBuilder(); public static T r<T>() { return util.parse<T>(r()); } public static T[] r<T>(char s = ' ') { return r().Split(s).Select(util.parse<T>).ToArray(); } public static T[] r<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r<T>(); } return r; } public static T[][] r<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r<T>(s); } return r; } private static string r() { return Console.ReadLine(); } public static void w(object v, bool lf = true) { S.Append(util.parse<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } } public static void wflush() { Console.Write(S.ToString()); S.Length = 0; } } public class util { public static T parse<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); } } public class memo<Key, Result> { private Dictionary<Key, Result> R; public memo() { R = new Dictionary<Key, Result>(); } public Result exec(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; } } }
using LIB; using System; using System.Linq; using System.Text; using System.Collections.Generic; class Program { static void Main(string[] args) { int n = io.r<int>(); int t = 0; int h = 0; for (int i = 0; i < n; i++) { string[] s = io.r<string>(' '); int ans = s[0].CompareTo(s[1]); if (ans == 0) { t++; h++; } else if (ans < 0) { h += 3; } else { t += 3; } } io.w(t + " " + h); io.wflush(); } } namespace LIB { public class io { private const int WMAX = 1000; private static StringBuilder S = new StringBuilder(); public static T r<T>() { return util.parse<T>(r()); } public static T[] r<T>(char s = ' ') { return r().Split(s).Select(util.parse<T>).ToArray(); } public static T[] r<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r<T>(); } return r; } public static T[][] r<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r<T>(s); } return r; } private static string r() { return Console.ReadLine(); } public static void w(object v, bool lf = true) { S.Append(util.parse<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } } public static void wflush() { Console.Write(S.ToString()); S.Length = 0; } } public class util { public static T parse<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); } } public class memo<Key, Result> { private Dictionary<Key, Result> R; public memo() { R = new Dictionary<Key, Result>(); } public Result exec(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; } } }
[["-", 75, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 75, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["-", 75, 57, 75, 196, 0, 1, 0, 11, 31, 22], ["+", 75, 57, 75, 196, 0, 1, 0, 11, 31, 22]]
8
617
4
using System; namespace _9_C { class Program { static void Main(string[] args) { int kaisuu = int.Parse(Console.ReadLine()); int taro = 0; int hanako = 0; for (int i = 0; i < kaisuu; i++) { string[] x = Console.ReadLine().Split(); string Taro = x[0]; string Hanako = x[1]; Array.Sort(x); if (Taro == Hanako) { taro++; hanako++; } else if (x[0] == Taro) { taro += 3; } else { hanako += 3; } } Console.WriteLine(taro + " " + hanako); } } }
using System; namespace _9_C { class Program { static void Main(string[] args) { int kaisuu = int.Parse(Console.ReadLine()); int taro = 0; int hanako = 0; for (int i = 0; i < kaisuu; i++) { string[] x = Console.ReadLine().Split(); string Taro = x[0]; string Hanako = x[1]; Array.Sort(x); if (Taro == Hanako) { taro++; hanako++; } else if (x[1] == Taro) { taro += 3; } else { hanako += 3; } } Console.WriteLine(taro + " " + hanako); } } }
[["-", 15, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["+", 15, 16, 31, 204, 206, 207, 0, 28, 0, 203]]
8
150
2
using System; class ASHKJA { static void Main() { int n = int.Parse(Console.ReadLine()); int[] a = new int[2]; for (int i = 0; i < n; i++) { string[] s = Console.ReadLine().Split(); if (s[0] == s[1]) { a[0]++; a[1]++; } string[] x = new string[2]; x[0] = s[0]; x[1] = s[1]; Array.Sort(x); if (x[1] == s[1]) { a[1] += 3; } else { a[0] += 3; } } Console.WriteLine(a[0] + " " + a[1]); } }
using System; class ASHKJA { static void Main() { int n = int.Parse(Console.ReadLine()); int[] a = new int[2]; for (int i = 0; i < n; i++) { string[] s = Console.ReadLine().Split(); if (s[0] == s[1]) { a[0]++; a[1]++; continue; } string[] x = new string[2]; x[0] = s[0]; x[1] = s[1]; Array.Sort(x); if (x[1] == s[1]) { a[1] += 3; } else { a[0] += 3; } } Console.WriteLine(a[0] + " " + a[1]); } }
[["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 35]]
8
184
2
using System; class Program { static void Main() { int num = int.Parse(Console.ReadLine()); int[] score = new int[2]; for (int i = 0; i < num; i++) { string[] card = Console.ReadLine().Split(' '); int flg = card[0].CompareTo(card[1]); switch (flg) { case 0: score[0]++; score[1]++; break; case 1: score[1] += 3; break; case -1: score[0] += 3; break; } } Console.WriteLine(score[0].ToString() + " " + score[1].ToString()); } }
using System; class Program { static void Main() { int num = int.Parse(Console.ReadLine()); int[] score = new int[2]; for (int i = 0; i < num; i++) { string[] card = Console.ReadLine().Split(' '); int flg = card[0].CompareTo(card[1]); switch (flg) { case 0: score[0]++; score[1]++; break; case 1: score[0] += 3; break; case -1: score[1] += 3; break; } } Console.WriteLine(score[0].ToString() + " " + score[1].ToString()); } }
[["-", 0, 11, 31, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 11, 31, 204, 206, 207, 0, 28, 0, 203]]
8
164
4
using System; namespace AizuOnLine { class Program { static void Main(string[] args) { while (true) { string[] data = Console.ReadLine().Split(' '); int r = int.Parse(data[0]); int c = int.Parse(data[1]); string[,] cell = new string[r + 1, c + 1]; for (int i = 0; i < r; i++) { string[] row = Console.ReadLine().Split(' '); int sum = 0; for (int j = 0; j < c; j++) { cell[i, j] = row[j]; sum += int.Parse(row[j]); } cell[i, c] = sum.ToString(); } for (int j = 0; j < c + 1; j++) { int sum = 0; for (int i = 0; i < r; i++) { sum += int.Parse(cell[i, j]); } cell[r, j] = sum.ToString(); } //?????? for (int i = 0; i < r + 1; i++) { for (int j = 0; j < c; j++) { Console.Write(cell[i, j] + " "); } Console.WriteLine(cell[i, c]); } } } } }
using System; namespace AizuOnLine { class Program { static void Main(string[] args) { string[] data = Console.ReadLine().Split(' '); int r = int.Parse(data[0]); int c = int.Parse(data[1]); string[,] cell = new string[r + 1, c + 1]; for (int i = 0; i < r; i++) { string[] row = Console.ReadLine().Split(' '); int sum = 0; for (int j = 0; j < c; j++) { cell[i, j] = row[j]; sum += int.Parse(row[j]); } cell[i, c] = sum.ToString(); } for (int j = 0; j < c + 1; j++) { int sum = 0; for (int i = 0; i < r; i++) { sum += int.Parse(cell[i, j]); } cell[r, j] = sum.ToString(); } //?????? for (int i = 0; i < r + 1; i++) { for (int j = 0; j < c; j++) { Console.Write(cell[i, j] + " "); } Console.WriteLine(cell[i, c]); } } } }
[["-", 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], ["-", 0, 52, 8, 196, 0, 7, 8, 196, 0, 46]]
8
311
6
using System; using System.Collections.Generic; namespace ConsoleApplication31 { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(' '); int r = int.Parse(str[0]); int c = int.Parse(str[1]); int[,] a = new int[r, c]; for (int i = 0; i < r; ++i) { string[] str2 = Console.ReadLine().Split(' '); for (int j = 0; j < c; j++) { a[i, j] = int.Parse(str2[j]); } } int[] rSum = new int[c + 1]; for (int i = 0; i < r; i++) { int cSum = 0; for (int j = 0; j < c; j++) { cSum += a[i, j]; rSum[j] += a[i, j]; Console.Write("0 ", a[i, j]); } Console.WriteLine(cSum); rSum[c] += cSum; } for (int i = 0; i < rSum.Length - 1; i++) { Console.Write("{0} ", rSum[i]); } Console.WriteLine(rSum[c]); } } }
using System; using System.Collections.Generic; namespace ConsoleApplication31 { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(' '); int r = int.Parse(str[0]); int c = int.Parse(str[1]); int[,] a = new int[r, c]; for (int i = 0; i < r; ++i) { string[] str2 = Console.ReadLine().Split(' '); for (int j = 0; j < c; j++) { a[i, j] = int.Parse(str2[j]); } } int[] rSum = new int[c + 1]; for (int i = 0; i < r; i++) { int cSum = 0; for (int j = 0; j < c; j++) { cSum += a[i, j]; rSum[j] += a[i, j]; Console.Write("{0} ", a[i, j]); } Console.WriteLine(cSum); rSum[c] += cSum; } for (int i = 0; i < rSum.Length - 1; i++) { Console.Write("{0} ", rSum[i]); } Console.WriteLine(rSum[c]); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
299
2
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string input = Console.ReadLine(); string[] rc = input.Split(' '); int r = int.Parse(rc[0]); int c = int.Parse(rc[1]); int rowsum, colsum = 0; int sum = 0; int[,] answer = new int[r + 1, c + 1]; for (int row = 0; row < r; row++) //????¬???????????????¨???????????\?????? { string rcin = Console.ReadLine(); string[] rcinput = rcin.Split(); for (int col = 0; col < c; col++) { answer[row, col] = int.Parse(rcinput[col]); } } for (int i = 0; i < r; i++) //??????????¨? { rowsum = 0; for (int j = 0; j < c; j++) { rowsum = rowsum + answer[i, j]; } answer[i, c] = rowsum; } for (int i = 0; i < r; i++) //??????????¨? { colsum = 0; for (int j = 0; j < c; j++) { colsum = colsum + answer[j, i]; // miss } answer[r, i] = colsum; } for (int i = 0; i < r; i++) //??¨??¨??????????¨????????±??????? { for (int j = 0; j < c; j++) { sum = sum + answer[i, j]; } } answer[r, c] = sum; //????????????????????¨??¨??????????¨?????????£??\ for (int a = 0; a <= r; a++) { for (int b = 0; b <= c; b++) { Console.Write(string.Format("{0}", answer[a, b])); if (b == c) break; Console.Write(" "); } Console.WriteLine(""); } } } }
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string input = Console.ReadLine(); string[] rc = input.Split(' '); int r = int.Parse(rc[0]); int c = int.Parse(rc[1]); int rowsum, colsum = 0; int sum = 0; int[,] answer = new int[r + 1, c + 1]; for (int row = 0; row < r; row++) //????¬???????????????¨???????????\?????? { string rcin = Console.ReadLine(); string[] rcinput = rcin.Split(); for (int col = 0; col < c; col++) { answer[row, col] = int.Parse(rcinput[col]); } } for (int i = 0; i < r; i++) //??????????¨? { rowsum = 0; for (int j = 0; j < c; j++) { rowsum = rowsum + answer[i, j]; } answer[i, c] = rowsum; } for (int i = 0; i < c; i++) //??????????¨? //missssssss { colsum = 0; for (int j = 0; j < r; j++) { colsum = colsum + answer[j, i]; // miss } answer[r, i] = colsum; } for (int i = 0; i < r; i++) //??¨??¨??????????¨????????±??????? { for (int j = 0; j < c; j++) { sum = sum + answer[i, j]; } } answer[r, c] = sum; //????????????????????¨??¨??????????¨?????????£??\ for (int a = 0; a <= r; a++) { for (int b = 0; b <= c; b++) { Console.Write(string.Format("{0}", answer[a, b])); if (b == c) break; Console.Write(" "); } Console.WriteLine(""); } } } }
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22], ["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22]]
8
418
4
using System; namespace Project { class MainClass { public static void Main(string[] args) { string s1 = Console.ReadLine(); string[] sar1 = s1.Split(' '); int r = int.Parse(sar1[0]); int c = int.Parse(sar1[1]); int[,] a = new int[r + 1, c + 1]; for (int i = 0; i < r; i++) { string s2 = Console.ReadLine(); string[] sar2 = s2.Split(' '); for (int j = 0; j < c; j++) { a[i, j] = int.Parse(sar2[j]); a[i, c] += a[i, j]; } } for (int i = 0; i < c; i++) { for (int j = 0; j < r; j++) { a[r, i] += a[j, i]; a[r, c] += a[r, i]; } } for (int i = 0; i < r + 1; i++) { for (int j = 0; j < c + 1; j++) { Console.Write(a[i, j]); if (j == c) { break; } Console.Write(" "); } Console.Write("\n"); } } } }
using System; namespace Project { class MainClass { public static void Main(string[] args) { string s1 = Console.ReadLine(); string[] sar1 = s1.Split(' '); int r = int.Parse(sar1[0]); int c = int.Parse(sar1[1]); int[,] a = new int[r + 1, c + 1]; for (int i = 0; i < r; i++) { string s2 = Console.ReadLine(); string[] sar2 = s2.Split(' '); for (int j = 0; j < c; j++) { a[i, j] = int.Parse(sar2[j]); a[i, c] += a[i, j]; } } for (int i = 0; i < c; i++) { for (int j = 0; j < r; j++) { a[r, i] += a[j, i]; } a[r, c] += a[r, i]; } for (int i = 0; i < r + 1; i++) { for (int j = 0; j < c + 1; j++) { Console.Write(a[i, j]); if (j == c) { break; } Console.Write(" "); } Console.Write("\n"); } } } }
[["+", 0, 7, 8, 196, 0, 7, 8, 196, 0, 46], ["-", 0, 7, 8, 196, 0, 7, 8, 196, 0, 46]]
8
312
2
using System; public class Spreadsheet { //??¨????????°r??¨?????°c???r ?? c //???????´????????????¨?????????????????§???????????¨??????????¨?????????\????????°????????¨???????????????????????°?????? static void Main(string[] args) { /*---??£?¨???¨---*/ string[] rowAndLine; string[] tableNumBuffer; int tableRow; int tableLine; int tableRowIndex; int tableLineIndex; /*---??£?¨???¨---*/ /*?????°??¨?????°?????????????????¨?????????*/ rowAndLine = Console.ReadLine().Split(); tableRow = int.Parse(rowAndLine[0]); tableLine = int.Parse(rowAndLine[1]); int[,] table = new int[tableRow + 1, tableLine + 1]; /*??¨?????????????????????*/ for (tableRowIndex = 0; tableRowIndex < tableRow; tableRowIndex++) { tableNumBuffer = Console.ReadLine().Split(' '); for (tableLineIndex = 0; tableLineIndex < tableLine; tableLineIndex++) { table[tableRowIndex, tableLineIndex] = int.Parse(tableNumBuffer[tableLineIndex]); } } /*?????¨?????????????¨?????????\???*/ for (tableRowIndex = 0; tableRowIndex < tableRow; tableRowIndex++) { for (tableLineIndex = 0; tableLineIndex < tableLine; tableLineIndex++) { table[tableRowIndex, tableLine] += table[tableRowIndex, tableLineIndex]; table[tableRow, tableLineIndex] += table[tableRowIndex, tableLineIndex]; } //??¨??????????¨? if (tableRowIndex == tableRow - 1) { for (int i = 0; i <= tableRow; i++) { table[tableRow, tableLine] += table[tableRow, i]; } } } /*?¨????????????¨?????¨???*/ for (tableRowIndex = 0; tableRowIndex <= tableRow; tableRowIndex++) { for (tableLineIndex = 0; tableLineIndex <= tableLine; tableLineIndex++) { if (tableLineIndex != tableLine) Console.Write("{0} ", table[tableRowIndex, tableLineIndex]); else Console.Write("{0}", table[tableRowIndex, tableLineIndex]); } Console.Write("\n"); } } }
using System; public class Spreadsheet { //??¨????????°r??¨?????°c???r ?? c //???????´????????????¨?????????????????§???????????¨??????????¨?????????\????????°????????¨???????????????????????°?????? static void Main(string[] args) { /*---??£?¨???¨---*/ string[] rowAndLine; string[] tableNumBuffer; int tableRow; int tableLine; int tableRowIndex; int tableLineIndex; /*---??£?¨???¨---*/ /*?????°??¨?????°?????????????????¨?????????*/ rowAndLine = Console.ReadLine().Split(); tableRow = int.Parse(rowAndLine[0]); tableLine = int.Parse(rowAndLine[1]); int[,] table = new int[tableRow + 1, tableLine + 1]; /*??¨?????????????????????*/ for (tableRowIndex = 0; tableRowIndex < tableRow; tableRowIndex++) { tableNumBuffer = Console.ReadLine().Split(' '); for (tableLineIndex = 0; tableLineIndex < tableLine; tableLineIndex++) { table[tableRowIndex, tableLineIndex] = int.Parse(tableNumBuffer[tableLineIndex]); } } /*?????¨?????????????¨?????????\???*/ for (tableRowIndex = 0; tableRowIndex < tableRow; tableRowIndex++) { for (tableLineIndex = 0; tableLineIndex < tableLine; tableLineIndex++) { table[tableRowIndex, tableLine] += table[tableRowIndex, tableLineIndex]; table[tableRow, tableLineIndex] += table[tableRowIndex, tableLineIndex]; } //??¨??????????¨? if (tableRowIndex == tableRow - 1) { for (int i = 0; i < tableLine; i++) { table[tableRow, tableLine] += table[tableRow, i]; } } } /*?¨????????????¨?????¨???*/ for (tableRowIndex = 0; tableRowIndex <= tableRow; tableRowIndex++) { for (tableLineIndex = 0; tableLineIndex <= tableLine; tableLineIndex++) { if (tableLineIndex != tableLine) Console.Write("{0} ", table[tableRowIndex, tableLineIndex]); else Console.Write("{0}", table[tableRowIndex, tableLineIndex]); } Console.Write("\n"); } } }
[["-", 0, 57, 64, 196, 0, 7, 15, 16, 17, 19], ["-", 0, 57, 64, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 57, 64, 196, 0, 7, 15, 16, 12, 22]]
8
342
4
using System; class Program { static void Main(string[] args) { String[] aryInput = Console.ReadLine().Split(' '); int n = int.Parse(aryInput[0]); int m = int.Parse(aryInput[1]); int l = int.Parse(aryInput[2]); long[,] A = new long[n, m]; long[,] B = new long[m, l]; long[,] C = new long[n, l]; //配列A代入 for (int i = 0; i < n; i++) { String[] tmp1 = Console.ReadLine().Split(' '); for (int j = 0; j < m; j++) { A[i, j] = int.Parse(tmp1[j]); } } //配列B代入 for (int i = 0; i < m; i++) { String[] tmp2 = Console.ReadLine().Split(' '); for (int j = 0; j < l; j++) { A[i, j] = int.Parse(tmp2[j]); } } // Cの配列に整数入力 for (int i = 0; i < n; i++) { for (int j = 0; j < l; j++) { for (int k = 0; k < m; k++) { C[i, j] += A[i, k] * B[k, j]; } } } // Cの中身出力 for (int i = 0; i < n; i++) { for (int j = 0; j < l - 1; j++) { Console.Write(C[i, j] + " "); } Console.WriteLine(C[i, l - 1]); } } }
using System; class Program { static void Main(string[] args) { String[] aryInput = Console.ReadLine().Split(' '); int n = int.Parse(aryInput[0]); int m = int.Parse(aryInput[1]); int l = int.Parse(aryInput[2]); long[,] A = new long[n, m]; long[,] B = new long[m, l]; long[,] C = new long[n, l]; //配列A代入 for (int i = 0; i < n; i++) { String[] tmp1 = Console.ReadLine().Split(' '); for (int j = 0; j < m; j++) { A[i, j] = int.Parse(tmp1[j]); } } //配列B代入 for (int i = 0; i < m; i++) { String[] tmp2 = Console.ReadLine().Split(' '); for (int j = 0; j < l; j++) { B[i, j] = int.Parse(tmp2[j]); } } // Cの配列に整数入力 for (int i = 0; i < n; i++) { for (int j = 0; j < l; j++) { for (int k = 0; k < m; k++) { C[i, j] += A[i, k] * B[k, j]; } } } // Cの中身出力 for (int i = 0; i < n; i++) { for (int j = 0; j < l - 1; j++) { Console.Write(C[i, j] + " "); } Console.WriteLine(C[i, l - 1]); } } }
[["-", 8, 196, 0, 1, 0, 11, 31, 204, 205, 22], ["+", 8, 196, 0, 1, 0, 11, 31, 204, 205, 22]]
8
388
2
using System; using System.Collections.Generic; using System.Text; using System.Linq; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { int[] data = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); int n = data[0]; int m = data[1]; int l = data[2]; long[,] a = new long[n, m]; long[,] b = new long[m, l]; long[,] c = new long[n, l]; for (int i = 0; i < n; i++) { int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); for (int j = 0; j < m; j++) { a[i, j] = input[j]; } } for (int i = 0; i < m; i++) { int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); for (int j = 0; j < l; j++) { b[i, j] = input[j]; } } for (int i = 0; i < n; i++) { for (int j = 0; j < l; j++) { for (int k = 0; k < m; k++) { c[i, j] += a[i, k] * b[j, k]; } } } for (int i = 0; i < n; i++) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < l; j++) { sb.Append(c[i, j] + " "); } Console.WriteLine(sb.ToString().Trim()); } } } }
using System; using System.Collections.Generic; using System.Text; using System.Linq; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { int[] data = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); int n = data[0]; int m = data[1]; int l = data[2]; long[,] a = new long[n, m]; long[,] b = new long[m, l]; long[,] c = new long[n, l]; for (int i = 0; i < n; i++) { int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); for (int j = 0; j < m; j++) { a[i, j] = input[j]; } } for (int i = 0; i < m; i++) { int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); for (int j = 0; j < l; j++) { b[i, j] = input[j]; } } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { for (int k = 0; k < l; k++) { c[i, k] += a[i, j] * b[j, k]; } } } for (int i = 0; i < n; i++) { StringBuilder sb = new StringBuilder(); for (int j = 0; j < l; j++) { sb.Append(c[i, j] + " "); } Console.WriteLine(sb.ToString().Trim()); } } } }
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22], ["-", 0, 11, 31, 204, 206, 207, 0, 28, 0, 22], ["+", 0, 11, 31, 204, 206, 207, 0, 28, 0, 22], ["-", 12, 16, 31, 204, 206, 207, 0, 28, 0, 22], ["+", 12, 16, 31, 204, 206, 207, 0, 28, 0, 22]]
8
435
8
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string input = Console.ReadLine(); string[] nml = input.Split(' '); int n = int.Parse(nml[0]); int m = int.Parse(nml[1]); int l = int.Parse(nml[2]); int[,] a = new int[n, m]; int[,] b = new int[m, l]; long[,] c = new long[n, l]; for (int i = 0; i < n; i++) //a????????????a?????????????????£??\ { string inputa = Console.ReadLine(); string[] arraya = inputa.Split(' '); for (int j = 0; j < m; j++) { a[i, j] = int.Parse(arraya[j]); } } for (int i = 0; i < m; i++) // c????????????0??§????????? { for (int j = 0; j < l; j++) { c[i, j] = 0; } } for (int i = 0; i < m; i++) //b????????????a?????????????????£??\ { string inputb = Console.ReadLine(); string[] arrayb = inputb.Split(' '); for (int j = 0; j < l; j++) { b[i, j] = int.Parse(arrayb[j]); } } for (int i = 0; i < n; i++) // 3 { for (int j = 0; j < m; j++) // 2 { for (int k = 0; k < l; k++) // 3 { c[i, k] = c[i, k] + a[i, j] * b[j, k]; } } } for (int i = 0; i < n; i++) { for (int j = 0; j < l; j++) { Console.Write(string.Format("{0} ", c[i, j])); if (j == l - 1) break; Console.Write(" "); } Console.WriteLine(); } } } }
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string input = Console.ReadLine(); string[] nml = input.Split(' '); int n = int.Parse(nml[0]); int m = int.Parse(nml[1]); int l = int.Parse(nml[2]); int[,] a = new int[n, m]; int[,] b = new int[m, l]; long[,] c = new long[n, l]; for (int i = 0; i < n; i++) //a????????????a?????????????????£??\ { string inputa = Console.ReadLine(); string[] arraya = inputa.Split(' '); for (int j = 0; j < m; j++) { a[i, j] = int.Parse(arraya[j]); } } for (int i = 0; i < n; i++) // c????????????0??§????????? { for (int j = 0; j < l; j++) { c[i, j] = 0; } } for (int i = 0; i < m; i++) //b????????????a?????????????????£??\ { string inputb = Console.ReadLine(); string[] arrayb = inputb.Split(' '); for (int j = 0; j < l; j++) { b[i, j] = int.Parse(arrayb[j]); } } for (int i = 0; i < n; i++) // 3 { for (int j = 0; j < m; j++) // 2 { for (int k = 0; k < l; k++) // 3 { c[i, k] = c[i, k] + a[i, j] * b[j, k]; } } } for (int i = 0; i < n; i++) { for (int j = 0; j < l; j++) { Console.Write(string.Format("{0}", c[i, j])); if (j == l - 1) break; Console.Write(" "); } Console.WriteLine(); } } } }
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
471
4
using System; namespace AOJ.ITP { public class TogglingCases { public static void Main() { string input = Console.ReadLine(); string output = ""; for (int i = 0; i < input.Length; i++) { if (input[i] >= 'a' && input[i] <= 'z') { output += input.Substring(i, 1).ToUpper(); } else if (input[i] >= 'A' && input[i] <= 'Z') { output += input.Substring(i, 1).ToLower(); } else { output += input.Substring(i, 0); } } Console.WriteLine(output); } } }
using System; namespace AOJ.ITP { public class TogglingCases { public static void Main() { string input = Console.ReadLine(); string output = ""; for (int i = 0; i < input.Length; i++) { if (input[i] >= 'a' && input[i] <= 'z') { output += input.Substring(i, 1).ToUpper(); } else if (input[i] >= 'A' && input[i] <= 'Z') { output += input.Substring(i, 1).ToLower(); } else { output += input.Substring(i, 1); } } Console.WriteLine(output); } } }
[["-", 0, 11, 12, 213, 3, 4, 0, 28, 0, 203], ["+", 0, 11, 12, 213, 3, 4, 0, 28, 0, 203]]
8
151
2
using System; namespace ConsoleApplication4 { class Program { static void Main(string[] args) { String Input = Console.ReadLine(); Char[] input = Input.ToCharArray(); for (int i = 0; i < input.Length - 1; i++) { if (char.IsUpper(input[i])) { input[i] = char.ToLower(input[i]); Console.Write(input[i]); } else if (char.IsLower(input[i])) { input[i] = char.ToUpper(input[i]); Console.Write(input[i]); } else Console.Write(input[i]); } Console.WriteLine(""); } } }
using System; namespace ConsoleApplication4 { class Program { static void Main(string[] args) { String Input = Console.ReadLine(); Char[] input = Input.ToCharArray(); for (int i = 0; i < input.Length; i++) { if (char.IsUpper(input[i])) { input[i] = char.ToLower(input[i]); Console.Write(input[i]); } else if (char.IsLower(input[i])) { input[i] = char.ToUpper(input[i]); Console.Write(input[i]); } else { Console.Write(input[i]); } } Console.WriteLine(""); } } }
[["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203], ["+", 8, 196, 0, 57, 75, 57, 75, 196, 0, 45], ["+", 8, 196, 0, 57, 75, 57, 75, 196, 0, 46]]
8
160
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { string a = Console.ReadLine(); string b = "abcdefghijklmnopqrsyuvwxyz"; string c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int d = a.Length; int f; for (int e = 0; e < d; e++) { for (f = 0; f != 26; f++) { if (a[e] == b[f]) { Console.Write(c[f]); break; } else if (a[e] == c[f]) { Console.Write(b[f]); break; } } if (f == 26) Console.Write(a[e]); } Console.Write("\n"); } } }
using System; // fAIR, LATER, OCCASIONALLY CLOUDY. using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { string a = Console.ReadLine(); string b = "abcdefghijklmnopqrstuvwxyz"; string c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int d = a.Length; int f; for (int e = 0; e < d; e++) { for (f = 0; f != 26; f++) { if (a[e] == b[f]) { Console.Write(c[f]); break; } else if (a[e] == c[f]) { Console.Write(b[f]); break; } } if (f == 26) Console.Write(a[e]); } Console.Write("\n"); } } } // fAIR, LATER, OCCASIONALLY CLOUDY.
[["-", 0, 198, 0, 200, 0, 212, 0, 5, 0, 222], ["+", 0, 198, 0, 200, 0, 212, 0, 5, 0, 222]]
8
181
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace StartFinish { class Program { static void Main(string[] args) { while (true) { //??\??????0??? string x = Console.ReadLine(); if (x[x.Length - 1] == '0') { break; } int sum = 0; for (int i = 0; i < x.Length; i++) { sum += int.Parse(x[i].ToString()); } Console.WriteLine(sum); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace StartFinish { class Program { static void Main(string[] args) { while (true) { //??\??????0??? string x = Console.ReadLine(); if (x[0] == '0') { break; } int sum = 0; for (int i = 0; i < x.Length; i++) { sum += int.Parse(x[i].ToString()); } Console.WriteLine(sum); } } } }
[["-", 206, 207, 0, 28, 0, 16, 31, 214, 205, 22], ["-", 206, 207, 0, 28, 0, 16, 31, 214, 0, 131], ["-", 206, 207, 0, 28, 0, 16, 31, 214, 141, 22], ["-", 31, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["-", 31, 204, 206, 207, 0, 28, 0, 16, 12, 203], ["+", 15, 16, 31, 204, 206, 207, 0, 28, 0, 203]]
8
125
6
using System; using System.Collections.Generic; using System.Linq; using System.IO; using SB = System.Text.StringBuilder; // using System.Text.RegularExpressions; // using System.Globalization; // using System.Diagnostics; using static System.Console; using System.Numerics; using static System.Math; using pair = Pair<int, int>; class Program { static void Main() { SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false }); new Program().solve(); Out.Flush(); } readonly Scanner cin = new Scanner(); readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑ readonly int mod = 1000000007; readonly int dom = 998244353; bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; } bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; } void solve() { int N = cin.nextint; int mask = 0; int K = cin.nextint; for (int i = 0; i < K; i++) { mask |= 1 << cin.nextint; } var SB = new Queue<string>(); for (int S = mask; S >= 0; S--) { S &= mask; var ret = $"{S}:"; for (int i = 0; i < N; i++) { if ((S >> i & 1) == 1) { ret += $" {i}"; } } SB.Enqueue(ret); } SB.join("\n"); } } static class Ex { public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values)); public static string concat<T>(this IEnumerable<T> values) => string.Concat(values); public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); } public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) < 0) low = mid + 1; else high = mid; } return low; } public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) <= 0) low = mid + 1; else high = mid; } return low; } } class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U> { public T f; public U s; public Pair(T f, U s) { this.f = f; this.s = s; } public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s); public override string ToString() => $"{f} {s}"; } class Scanner { string[] s; int i; readonly char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string[] scan => ReadLine().Split(); public int[] scanint => Array.ConvertAll(scan, int.Parse); public long[] scanlong => Array.ConvertAll(scan, long.Parse); public double[] scandouble => Array.ConvertAll(scan, double.Parse); public string next { get { if (i < s.Length) return s[i++]; string st = ReadLine(); while (st == "") st = ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next; } } public int nextint => int.Parse(next); public long nextlong => long.Parse(next); public double nextdouble => double.Parse(next); }
using System; using System.Collections.Generic; using System.Linq; using System.IO; using SB = System.Text.StringBuilder; // using System.Text.RegularExpressions; // using System.Globalization; // using System.Diagnostics; using static System.Console; using System.Numerics; using static System.Math; using pair = Pair<int, int>; class Program { static void Main() { SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false }); new Program().solve(); Out.Flush(); } readonly Scanner cin = new Scanner(); readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑ readonly int mod = 1000000007; readonly int dom = 998244353; bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; } bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; } void solve() { int N = cin.nextint; int mask = 0; int K = cin.nextint; for (int i = 0; i < K; i++) { mask |= 1 << cin.nextint; } var SB = new Stack<string>(); for (int S = mask; S >= 0; S--) { S &= mask; var ret = $"{S}:"; for (int i = 0; i < N; i++) { if ((S >> i & 1) == 1) { ret += $" {i}"; } } SB.Push(ret); } SB.join("\n"); } } static class Ex { public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values)); public static string concat<T>(this IEnumerable<T> values) => string.Concat(values); public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); } public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) < 0) low = mid + 1; else high = mid; } return low; } public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) <= 0) low = mid + 1; else high = mid; } return low; } } class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U> { public T f; public U s; public Pair(T f, U s) { this.f = f; this.s = s; } public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s); public override string ToString() => $"{f} {s}"; } class Scanner { string[] s; int i; readonly char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string[] scan => ReadLine().Split(); public int[] scanint => Array.ConvertAll(scan, int.Parse); public long[] scanlong => Array.ConvertAll(scan, long.Parse); public double[] scandouble => Array.ConvertAll(scan, double.Parse); public string next { get { if (i < s.Length) return s[i++]; string st = ReadLine(); while (st == "") st = ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next; } } public int nextint => int.Parse(next); public long nextlong => long.Parse(next); public double nextdouble => double.Parse(next); }
[["-", 0, 200, 0, 212, 0, 230, 39, 236, 141, 22], ["+", 0, 200, 0, 212, 0, 230, 39, 236, 141, 22], ["-", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22]]
8
986
4
using System; using System.Collections.Generic; using System.Linq; using System.IO; using SB = System.Text.StringBuilder; // using System.Text.RegularExpressions; // using System.Globalization; // using System.Diagnostics; using static System.Console; using System.Numerics; using static System.Math; using pair = Pair<int, int>; class Program { static void Main() { SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false }); new Program().solve(); Out.Flush(); } readonly Scanner cin = new Scanner(); readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑ readonly int mod = 1000000007; readonly int dom = 998244353; bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; } bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; } void solve() { int N = cin.nextint; var V = new int[N]; var W = new int[N]; var T = new char[N]; var D = new long[N]; var S = new string[N]; var ID = new int[N]; for (int i = 0; i < N; i++) { V[i] = cin.nextint; W[i] = cin.nextint; T[i] = cin.next[0]; D[i] = cin.nextlong; S[i] = cin.next; ID[i] = i; } Array.Sort(ID, (x, y) => V[x] == V[y] ? V[x] - V[y] : W[x] == W[y] ? W[x] - W[y] : T[x] == T[y] ? T[x] - T[y] : D[x] == D[y] ? D[x].CompareTo(D[y]) : S[x].CompareTo(S[y])); // var t = ID.OrderBy(i => V[i]).ThenBy(i => W[i]).ThenBy(i => // T[i]).ThenBy(i => D[i]).ThenBy(i => S[i]); foreach (var i in ID) { WriteLine($"{V[i]} {W[i]} {T[i]} {D[i]} {S[i]}"); } } } static class Ex { public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values)); public static string concat<T>(this IEnumerable<T> values) => string.Concat(values); public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); } public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) < 0) low = mid + 1; else high = mid; } return low; } public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) <= 0) low = mid + 1; else high = mid; } return low; } } class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U> { public T f; public U s; public Pair(T f, U s) { this.f = f; this.s = s; } public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s); public override string ToString() => $"{f} {s}"; } class Scanner { string[] s; int i; readonly char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string[] scan => ReadLine().Split(); public int[] scanint => Array.ConvertAll(scan, int.Parse); public long[] scanlong => Array.ConvertAll(scan, long.Parse); public double[] scandouble => Array.ConvertAll(scan, double.Parse); public string next { get { if (i < s.Length) return s[i++]; string st = ReadLine(); while (st == "") st = ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next; } } public int nextint => int.Parse(next); public long nextlong => long.Parse(next); public double nextdouble => double.Parse(next); }
using System; using System.Collections.Generic; using System.Linq; using System.IO; using SB = System.Text.StringBuilder; // using System.Text.RegularExpressions; // using System.Globalization; // using System.Diagnostics; using static System.Console; using System.Numerics; using static System.Math; using pair = Pair<int, int>; class Program { static void Main() { SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false }); new Program().solve(); Out.Flush(); } readonly Scanner cin = new Scanner(); readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑ readonly int mod = 1000000007; readonly int dom = 998244353; bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; } bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; } void solve() { int N = cin.nextint; var V = new int[N]; var W = new int[N]; var T = new char[N]; var D = new long[N]; var S = new string[N]; var ID = new int[N]; for (int i = 0; i < N; i++) { V[i] = cin.nextint; W[i] = cin.nextint; T[i] = cin.next[0]; D[i] = cin.nextlong; S[i] = cin.next; ID[i] = i; } Array.Sort(ID, (x, y) => V[x] != V[y] ? V[x] - V[y] : W[x] != W[y] ? W[x] - W[y] : T[x] != T[y] ? T[x] - T[y] : D[x] != D[y] ? D[x].CompareTo(D[y]) : S[x].CompareTo(S[y])); // var t = ID.OrderBy(i => V[i]).ThenBy(i => W[i]).ThenBy(i => // T[i]).ThenBy(i => D[i]).ThenBy(i => S[i]); foreach (var i in ID) { WriteLine($"{V[i]} {W[i]} {T[i]} {D[i]} {S[i]}"); } } } static class Ex { public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values)); public static string concat<T>(this IEnumerable<T> values) => string.Concat(values); public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); } public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) < 0) low = mid + 1; else high = mid; } return low; } public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) <= 0) low = mid + 1; else high = mid; } return low; } } class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U> { public T f; public U s; public Pair(T f, U s) { this.f = f; this.s = s; } public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s); public override string ToString() => $"{f} {s}"; } class Scanner { string[] s; int i; readonly char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string[] scan => ReadLine().Split(); public int[] scanint => Array.ConvertAll(scan, int.Parse); public long[] scanlong => Array.ConvertAll(scan, long.Parse); public double[] scandouble => Array.ConvertAll(scan, double.Parse); public string next { get { if (i < s.Length) return s[i++]; string st = ReadLine(); while (st == "") st = ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next; } } public int nextint => int.Parse(next); public long nextlong => long.Parse(next); public double nextdouble => double.Parse(next); }
[["-", 0, 28, 0, 218, 8, 41, 15, 16, 17, 60], ["+", 0, 28, 0, 218, 8, 41, 15, 16, 17, 79], ["-", 0, 218, 8, 41, 75, 41, 15, 16, 17, 60], ["+", 0, 218, 8, 41, 75, 41, 15, 16, 17, 79], ["-", 8, 41, 75, 41, 75, 41, 15, 16, 17, 60], ["+", 8, 41, 75, 41, 75, 41, 15, 16, 17, 79], ["-", 75, 41, 75, 41, 75, 41, 15, 16, 17, 60], ["+", 75, 41, 75, 41, 75, 41, 15, 16, 17, 79]]
8
1,139
8
using System.Collections.Generic; using System; public class Hello { public static void Main() { var hs = new HashSet<int>(); var count = 0; var q = int.Parse(Console.ReadLine().Trim()); for (int i = 0; i < q; i++) { string[] line = Console.ReadLine().Trim().Split(' '); var c = int.Parse(line[0]); var c2 = int.Parse(line[1]); if (c == 0) Console.WriteLine(hs.Add(c2) ? ++count : count); else if (c == 1) if (hs.Add(c2)) { Console.WriteLine(0); hs.Remove(c2); } else Console.WriteLine(1); else { hs.Remove(c2); count--; } } } }
using System.Collections.Generic; using System; public class Hello { public static void Main() { var hs = new HashSet<int>(); var count = 0; var q = int.Parse(Console.ReadLine().Trim()); for (int i = 0; i < q; i++) { string[] line = Console.ReadLine().Trim().Split(' '); var c = int.Parse(line[0]); var c2 = int.Parse(line[1]); if (c == 0) Console.WriteLine(hs.Add(c2) ? ++count : count); else if (c == 1) if (hs.Add(c2)) { Console.WriteLine(0); hs.Remove(c2); } else Console.WriteLine(1); else if (hs.Remove(c2)) count--; } } }
[["-", 8, 196, 0, 57, 75, 57, 75, 196, 0, 45], ["+", 8, 196, 0, 57, 75, 57, 75, 57, 0, 121], ["+", 8, 196, 0, 57, 75, 57, 75, 57, 0, 24], ["+", 75, 57, 75, 57, 15, 213, 3, 4, 0, 25], ["-", 0, 57, 75, 57, 75, 196, 0, 1, 0, 35], ["-", 8, 196, 0, 57, 75, 57, 75, 196, 0, 46]]
8
197
6
using System; using System.Linq; using System.Collections.Generic; public class Prime { public static void Main() { int n = int.Parse(Console.ReadLine()); var primeFactors = PrimeFactors(n); // primeFactors.Dump(); string output = primeFactors.Count() == 0 ? n.ToString() : string.Join(" ", primeFactors.Select(f => f.ToString()).ToArray()); //: string.Join(" ", primeFactors); Console.WriteLine("{0}: {1}", n, output); } public static IEnumerable<int> PrimeFactors(int n) { int i = 2; int tmp = n; while (i < tmp) { if (n % i == 0) { n /= i; yield return i; } else if (i > Math.Sqrt(tmp)) { i = int.MaxValue; yield return n; } else { i++; } } } }
using System; using System.Linq; using System.Collections.Generic; public class Prime { public static void Main() { int n = int.Parse(Console.ReadLine()); var primeFactors = PrimeFactors(n); string output = primeFactors.Count() == 0 ? n.ToString() : string.Join( " ", primeFactors.Select(f => f.ToString()).ToArray()); // AOJ??¨ //:string.Join(" ", primeFactors); Console.WriteLine("{0}: {1}", n, output); } public static IEnumerable<int> PrimeFactors(int n) { int i = 2; int tmp = n; while (i <= tmp) { if (tmp % i == 0) { tmp /= i; yield return i; } else if (i > Math.Sqrt(n)) { i = int.MaxValue; //??????????????? yield return tmp; } else { i++; } // if(i > Math.Sqrt(n)){ //} } } }
[["-", 0, 195, 8, 196, 0, 52, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 52, 15, 16, 17, 19], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["-", 15, 16, 12, 213, 3, 4, 0, 28, 0, 22], ["+", 15, 16, 12, 213, 3, 4, 0, 28, 0, 22], ["-", 0, 57, 75, 57, 64, 196, 0, 285, 0, 22], ["+", 0, 57, 75, 57, 64, 196, 0, 285, 0, 22]]
8
187
10
using System; namespace _1_A { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Console.Write(n + ":"); for (int i = 2; i <= Math.Sqrt(n); i++) { while (n % i == 0) { Console.Write(" " + i); n = n / i; } } Console.WriteLine(n == 0 ? "" : " " + n.ToString()); } } }
using System; namespace _1_A { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Console.Write(n + ":"); for (int i = 2; i <= Math.Sqrt(n); i++) { while (n % i == 0) { Console.Write(" " + i); n = n / i; } } Console.WriteLine(n == 1 ? "" : " " + n.ToString()); } } }
[["-", 3, 4, 0, 28, 0, 41, 15, 16, 12, 203], ["+", 3, 4, 0, 28, 0, 41, 15, 16, 12, 203]]
8
117
2
// Elementary Number Theory - Prime Factorize // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A using System; using System.Linq; using System.Collections.Generic; namespace NTL_1_A { class Program { public Program() {} public static void Main() { new Program().Calc(); } void Calc() { var n = int.Parse(Input); var factors = Factorize(n).Select(i => i.ToString()).Aggregate((i, j) => i + " " + j); Output(n + ": " + factors); } String Input { get { return Console.ReadLine(); } } void Output(String str) { Console.WriteLine(str); } int[] Factorize(int n) { List<int> factors = new List<int>(); if (n <= 0) return new int[] { 0 }; if (n == 1) return new int[] { 1 }; while (n % 2 == 0) { factors.Add(2); n /= 2; } while (n % 3 == 0) { factors.Add(3); n /= 3; } int factor = 5; int step = 2; while (factor * factor <= n) { if (n % factor == 0) { factors.Add(factor); n /= factor; } else { factor += step; step = 6 - step; } } factors.Add(n); return factors.ToArray(); } } }
// Elementary Number Theory - Prime Factorize // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A using System; using System.Linq; using System.Collections.Generic; namespace NTL_1_A { class Program { public Program() {} public static void Main() { new Program().Calc(); } void Calc() { var n = int.Parse(Input); var factors = Factorize(n).Select(i => i.ToString()).Aggregate((i, j) => i + " " + j); Output(n + ": " + factors); } String Input { get { return Console.ReadLine(); } } void Output(String str) { Console.WriteLine(str); } int[] Factorize(int n) { List<int> factors = new List<int>(); if (n <= 0) return new int[] { 0 }; if (n == 1) return new int[] { 1 }; while (n % 2 == 0) { factors.Add(2); n /= 2; } while (n % 3 == 0) { factors.Add(3); n /= 3; } int factor = 5; int step = 2; while (factor * factor <= n) { if (n % factor == 0) { factors.Add(factor); n /= factor; } else { factor += step; step = 6 - step; } } if (n != 1) factors.Add(n); return factors.ToArray(); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 121], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 24], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 31, 22], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 17, 79], ["+", 0, 195, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 25]]
8
304
6
using System; namespace Sample { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(' '); int m = int.Parse(str[0]); int n = int.Parse(str[1]); int divide = 1000000007; string binary = Convert.ToString(n, 2); int sum = 1; for (int i = 0; i < binary.Length; i++) { sum = sum * sum % divide; if (binary[i] == '1') sum = sum * m % divide; } Console.WriteLine(sum); } } }
using System; namespace Sample { class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(' '); int m = int.Parse(str[0]); int n = int.Parse(str[1]); int divide = 1000000007; string binary = Convert.ToString(n, 2); long sum = 1; for (int i = 0; i < binary.Length; i++) { sum = sum * sum % divide; if (binary[i] == '1') sum = sum * m % divide; } Console.WriteLine(sum); } } }
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
8
140
2
using System; public class Hello { public const int MD = 1000000007; public static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var m = int.Parse(line[0]); var n = int.Parse(line[1]); Console.WriteLine(power(m, n)); } public static long power(int m, int n) { if (n == 0) return 1; return n % 2 == 0 ? power(m * m % MD, n / 2) : power(m * m % MD, n / 2) * m; } }
using System; public class Hello { public const int MD = 1000000007; public static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var m = int.Parse(line[0]); var n = int.Parse(line[1]); Console.WriteLine(power(m, n)); } public static long power(long m, long n) { if (n == 0) return 1; return n % 2 == 0 ? power(m * m % MD, n / 2) : power(m * m % MD, n / 2) * m % MD; } }
[["-", 8, 201, 0, 195, 54, 55, 0, 220, 39, 199], ["+", 8, 201, 0, 195, 54, 55, 0, 220, 39, 199], ["+", 8, 196, 0, 37, 0, 41, 75, 16, 17, 109], ["+", 8, 196, 0, 37, 0, 41, 75, 16, 12, 22]]
8
140
6
using System; using System.Linq; namespace _1_C { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); long ret = x[0]; for (int i = 1; i < n; i++) { long a = Math.Min(ret, x[1]); long b = Math.Max(ret, x[1]); while (a != 0) { long xy = b % a; b = a; a = xy; } ret = ret / b * x[1]; } Console.WriteLine(ret); } } }
using System; using System.Linq; namespace _1_C { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); long ret = x[0]; for (int i = 1; i < n; i++) { long a = Math.Min(ret, x[i]); long b = Math.Max(ret, x[i]); while (a != 0) { long xy = b % a; b = a; a = xy; } ret = ret / b * x[i]; } Console.WriteLine(ret); } } }
[["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 28, 0, 204, 206, 207, 0, 28, 0, 22], ["-", 12, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 12, 16, 12, 204, 206, 207, 0, 28, 0, 22]]
8
162
6
using System; using System.Collections.Generic; using System.Linq; using System.IO; using SB = System.Text.StringBuilder; // using System.Text.RegularExpressions; // using System.Globalization; // using System.Diagnostics; using static System.Console; using System.Numerics; using static System.Math; using pair = Pair<int, int>; class Program { static void Main() { // SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false }); new Program().solve(); Out.Flush(); } readonly Scanner cin = new Scanner(); readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑ readonly int mod = 1000000007; readonly int dom = 998244353; bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; } bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; } void solve() { var x = BigInt.Parse(cin.next); var y = BigInt.Parse(cin.next); WriteLine(x + y); } } /// <summary> /// <see cref="BaseWidth"/> * <see cref="MaxDigit"/> 桁に対応する多倍長整数 /// </summary> class BigInt { const long Base = (long)1e18; const int BaseWidth = 18; const int MaxDigit = 100000; byte negative; long[] digit = new long[MaxDigit]; int size; public static BigInt Parse(string S) { BigInt num = new BigInt { negative = S[0] == '-' ? (byte)1 : (byte)0 }; int i = (S.Length - num.negative) % BaseWidth; if (i > 0) i -= BaseWidth; i += num.negative; for (; i < S.Length; i += BaseWidth) { long ret = 0L; for (int j = 0; j < BaseWidth; j++) { ret = 10 * ret + (i + j >= num.negative ? S[i + j] - '0' : 0); } num.digit[num.size++] = ret; } Array.Reverse(num.digit, 0, num.size); return num; } static BigInt Add(BigInt x, BigInt y) { var ret = new BigInt { size = Max(x.size, y.size), negative = x.negative }; byte gain = 0; for (int i = 0; i < ret.size; i++) { ret.digit[i] = x.digit[i] + y.digit[i] + gain; if (ret.digit[i] >= Base) { ret.digit[i] -= Base; gain = 1; } else { gain = 0; } } if (gain == 1) { ret.digit[ret.size++] = 1; } return ret; } /// <summary> /// x, yの絶対値の比較、差を求めたときのsize, negative /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="size"></param> /// <param name="negative"></param> /// <returns></returns> static int Compare(BigInt x, BigInt y, out int size, out byte negative) { int cmp = x.size.CompareTo(y.size); if (cmp != 0) { size = cmp < 0 ? y.size : x.size; negative = cmp < 0 ? y.negative : x.negative; return cmp; } else { for (int i = x.size - 1; i >= 0; i--) { int diff = x.digit[i].CompareTo(y.digit[i]); if (diff != 0) { size = i + 1; negative = diff < 0 ? y.negative : x.negative; return diff; } } size = 1; negative = 0; return 0; } } static BigInt Sub(BigInt a, BigInt b) { var x = a; var y = b; int size; byte negative; if (Compare(x, y, out size, out negative) < 0) { var tmp = x; x = y; y = tmp; } var ret = new BigInt { size = size, negative = negative }; byte gain = 0; for (int i = 0; i < ret.size; i++) { ret.digit[i] = x.digit[i] - y.digit[i] - gain; if (ret.digit[i] < 0) { ret.digit[i] += Base; gain = 1; } else { gain = 0; } } while (ret.size > 1 && ret.digit[ret.size - 1] == 0) ret.size--; return ret; } public static BigInt operator +(BigInt l, BigInt r) { if (l.negative == r.negative) { return Add(l, r); } else { return Sub(l, r); } } public static BigInt operator -(BigInt l, BigInt r) { r.negative ^= 1; return l + r; } public override string ToString() { string ret = ""; if (negative == 1) ret += '-'; ret += digit[size - 1]; for (int i = size - 2; i >= 0; i--) { ret += digit[i].ToString().PadLeft(BaseWidth, '0'); } return ret; } } static class Ex { public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values)); public static string concat<T>(this IEnumerable<T> values) => string.Concat(values); public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); } public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) < 0) low = mid + 1; else high = mid; } return low; } public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) <= 0) low = mid + 1; else high = mid; } return low; } } class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U> { public T f; public U s; public Pair(T f, U s) { this.f = f; this.s = s; } public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s); public override string ToString() => $"{f} {s}"; } class Scanner { string[] s; int i; readonly char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string[] scan => ReadLine().Split(); public int[] scanint => Array.ConvertAll(scan, int.Parse); public long[] scanlong => Array.ConvertAll(scan, long.Parse); public double[] scandouble => Array.ConvertAll(scan, double.Parse); public string next { get { if (i < s.Length) return s[i++]; string st = ReadLine(); while (st == "") st = ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next; } } public int nextint => int.Parse(next); public long nextlong => long.Parse(next); public double nextdouble => double.Parse(next); }
using System; using System.Collections.Generic; using System.Linq; using System.IO; using SB = System.Text.StringBuilder; // using System.Text.RegularExpressions; // using System.Globalization; // using System.Diagnostics; using static System.Console; using System.Numerics; using static System.Math; using pair = Pair<int, int>; class Program { static void Main() { // SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false }); new Program().solve(); Out.Flush(); } readonly Scanner cin = new Scanner(); readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑ readonly int mod = 1000000007; readonly int dom = 998244353; bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; } bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; } void solve() { var x = BigInt.Parse(cin.next); var y = BigInt.Parse(cin.next); WriteLine(x - y); } } /// <summary> /// <see cref="BaseWidth"/> * <see cref="MaxDigit"/> 桁に対応する多倍長整数 /// </summary> class BigInt { const long Base = (long)1e18; const int BaseWidth = 18; const int MaxDigit = 100000; byte negative; long[] digit = new long[MaxDigit]; int size; public static BigInt Parse(string S) { BigInt num = new BigInt { negative = S[0] == '-' ? (byte)1 : (byte)0 }; int i = (S.Length - num.negative) % BaseWidth; if (i > 0) i -= BaseWidth; i += num.negative; for (; i < S.Length; i += BaseWidth) { long ret = 0L; for (int j = 0; j < BaseWidth; j++) { ret = 10 * ret + (i + j >= num.negative ? S[i + j] - '0' : 0); } num.digit[num.size++] = ret; } Array.Reverse(num.digit, 0, num.size); return num; } static BigInt Add(BigInt x, BigInt y) { var ret = new BigInt { size = Max(x.size, y.size), negative = x.negative }; byte gain = 0; for (int i = 0; i < ret.size; i++) { ret.digit[i] = x.digit[i] + y.digit[i] + gain; if (ret.digit[i] >= Base) { ret.digit[i] -= Base; gain = 1; } else { gain = 0; } } if (gain == 1) { ret.digit[ret.size++] = 1; } return ret; } /// <summary> /// x, yの絶対値の比較、差を求めたときのsize, negative /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="size"></param> /// <param name="negative"></param> /// <returns></returns> static int Compare(BigInt x, BigInt y, out int size, out byte negative) { int cmp = x.size.CompareTo(y.size); if (cmp != 0) { size = cmp < 0 ? y.size : x.size; negative = cmp < 0 ? y.negative : x.negative; return cmp; } else { for (int i = x.size - 1; i >= 0; i--) { int diff = x.digit[i].CompareTo(y.digit[i]); if (diff != 0) { size = i + 1; negative = diff < 0 ? y.negative : x.negative; return diff; } } size = 1; negative = 0; return 0; } } static BigInt Sub(BigInt a, BigInt b) { var x = a; var y = b; int size; byte negative; if (Compare(x, y, out size, out negative) < 0) { var tmp = x; x = y; y = tmp; } var ret = new BigInt { size = size, negative = negative }; byte gain = 0; for (int i = 0; i < ret.size; i++) { ret.digit[i] = x.digit[i] - y.digit[i] - gain; if (ret.digit[i] < 0) { ret.digit[i] += Base; gain = 1; } else { gain = 0; } } while (ret.size > 1 && ret.digit[ret.size - 1] == 0) ret.size--; return ret; } public static BigInt operator +(BigInt l, BigInt r) { if (l.negative == r.negative) { return Add(l, r); } else { return Sub(l, r); } } public static BigInt operator -(BigInt l, BigInt r) { r.negative ^= 1; return l + r; } public override string ToString() { string ret = ""; if (negative == 1) ret += '-'; ret += digit[size - 1]; for (int i = size - 2; i >= 0; i--) { ret += digit[i].ToString().PadLeft(BaseWidth, '0'); } return ret; } } static class Ex { public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values)); public static string concat<T>(this IEnumerable<T> values) => string.Concat(values); public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); } public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) < 0) low = mid + 1; else high = mid; } return low; } public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T> { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) <= 0) low = mid + 1; else high = mid; } return low; } } class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U> { public T f; public U s; public Pair(T f, U s) { this.f = f; this.s = s; } public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s); public override string ToString() => $"{f} {s}"; } class Scanner { string[] s; int i; readonly char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string[] scan => ReadLine().Split(); public int[] scanint => Array.ConvertAll(scan, int.Parse); public long[] scanlong => Array.ConvertAll(scan, long.Parse); public double[] scandouble => Array.ConvertAll(scan, double.Parse); public string next { get { if (i < s.Length) return s[i++]; string st = ReadLine(); while (st == "") st = ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next; } } public int nextint => int.Parse(next); public long nextlong => long.Parse(next); public double nextdouble => double.Parse(next); }
[["-", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 33]]
8
1,707
2
using System; namespace _10009 { class Program { static void Main(string[] args) { string readline = Console.ReadLine(); if (readline != null) { int a = int.Parse(readline); double b = a * a * Math.PI; double c = a * 2 * Math.PI; Console.WriteLine(string.Format("{0:f6}", b) + " " + string.Format("{0:f6}", c)); } } } }
using System; namespace _10009 { class Program { static void Main(string[] args) { string readline = Console.ReadLine(); if (readline != null) { double a = double.Parse(readline); double b = a * a * Math.PI; double c = a * 2 * Math.PI; Console.WriteLine(string.Format("{0:f6}", b) + " " + string.Format("{0:f6}", c)); } } } }
[["-", 0, 57, 64, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 57, 64, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
8
102
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace mondai10009 { class Program { static void Main(string[] args) { var r = float.Parse(Console.ReadLine()); var s = Math.PI * r * r; var l = 2.0f * Math.PI * r; Console.WriteLine("{0:f6} {1:f6}", s, l); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace mondai10009 { class Program { static void Main(string[] args) { var r = double.Parse(Console.ReadLine()); var s = Math.PI * r * r; var l = 2.0 * Math.PI * r; Console.WriteLine("{0:f6} {1:f6}", s, l); } } }
[["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["-", 0, 200, 0, 212, 0, 16, 31, 16, 31, 250], ["+", 0, 200, 0, 212, 0, 16, 31, 16, 31, 250]]
8
88
4
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class Program { static void Main(string[] args) { var r = (double)int.Parse(Console.ReadLine()); Console.WriteLine("{0} {1}", (r * r * Math.PI), (r * 2.0 * Math.PI)); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class Program { static void Main(string[] args) { double r = double.Parse(Console.ReadLine()); Console.WriteLine("{0} {1}", (r * r * Math.PI), (r * 2.0 * Math.PI)); } } }
[["-", 8, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 198, 0, 200, 0, 212, 0, 74, 0, 24], ["-", 0, 198, 0, 200, 0, 212, 0, 74, 0, 25], ["-", 0, 212, 0, 74, 51, 213, 63, 214, 205, 199]]
8
85
5
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace test { class Program { static void Main(string[] args) { double r = int.Parse(Console.ReadLine()); double shu = ToRoundDown(2 * Math.PI * r, 5); double area = ToRoundDown(Math.PI * r * r, 5); Console.WriteLine("{0} {1}", area, shu); } public static double ToRoundDown(double dValue, int iDigits) { double dCoef = System.Math.Pow(10, iDigits); return dValue > 0 ? System.Math.Floor(dValue * dCoef) / dCoef : System.Math.Ceiling(dValue * dCoef) / dCoef; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace test { class Program { static void Main(string[] args) { double r = double.Parse(Console.ReadLine()); double shu = ToRoundDown(2 * Math.PI * r, 5); double area = ToRoundDown(Math.PI * r * r, 5); Console.WriteLine("{0} {1}", area, shu); } public static double ToRoundDown(double dValue, int iDigits) { double dCoef = System.Math.Pow(10, iDigits); return dValue > 0 ? System.Math.Floor(dValue * dCoef) / dCoef : System.Math.Ceiling(dValue * dCoef) / dCoef; } } }
[["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
8
156
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class Program { static void Main(string[] args) { var num = int.Parse(Console.ReadLine()); Console.WriteLine("{0} {1}", num * num * Math.PI, 2 * Math.PI * num); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AOJ { class Program { static void Main(string[] args) { var num = double.Parse(Console.ReadLine()); Console.WriteLine("{0} {1}", num * num * Math.PI, 2 * Math.PI * num); } } }
[["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
8
78
2
using System; namespace OSJ { class Program { static void Main(string[] args) { int r = int.Parse(Console.ReadLine()); Console.WriteLine((r * r * Math.PI).ToString("f6") + " " + (r * 2 * Math.PI).ToString("f6")); } } }
using System; namespace OSJ { class Program { static void Main(string[] args) { double r = double.Parse(Console.ReadLine()); Console.WriteLine((r * r * Math.PI).ToString("f6") + " " + (r * 2 * Math.PI).ToString("f6")); } } }
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
8
79
4
using System; using System.IO; public class AOJ100 { public static void Main() { double PI = 3.141592653589; int r = Int32.Parse(Console.ReadLine()); double S, L; S = PI * r * r; L = 2 * PI * r; Console.WriteLine("{0:f6} {1:f6}", S, L); } }
using System; using System.IO; public class AOJ100 { public static void Main() { double PI = 3.141592653589; double r = double.Parse(Console.ReadLine()); double S, L; S = PI * r * r; L = 2 * PI * r; Console.WriteLine("{0:f6} {1:f6}", S, L); } }
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 200, 0, 212, 0, 213, 63, 214, 205, 22], ["+", 0, 200, 0, 212, 0, 213, 63, 214, 205, 199]]
8
74
4
using System; namespace AOJ { public class Program { public static void Main(string[] cmdargs) { int i = 1; while (true) { string arg = Console.ReadLine(); if (arg == "0") { break; } Console.WriteLine(String.Format("Case {0}: {1}", i, arg)); } } } }
using System; namespace AOJ { public class Program { public static void Main(string[] cmdargs) { int i = 1; while (true) { string arg = Console.ReadLine(); if (arg == "0") { break; } Console.WriteLine(String.Format("Case {0}: {1}", i++, arg)); } } } }
[["+", 0, 213, 3, 4, 0, 28, 0, 223, 0, 29]]
8
74
1
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication4 { class Program { static void Main(string[] args) { int b = 1; while (true) { int a = int.Parse(Console.ReadLine()); if (a == 0) break; Console.WriteLine("case {0}: {1}", b, a); b++; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication4 { class Program { static void Main(string[] args) { int b = 1; while (true) { int a = int.Parse(Console.ReadLine()); if (a == 0) break; Console.WriteLine("Case {0}: {1}", b, a); b++; } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
88
2
using System; class AOJ { static void Main(string[] args) { int i = 1; while (true) { int n = int.Parse(Console.ReadLine()); if (n == 0) break; Console.WriteLine("Case{0}: {1}", i++, n); } } }
using System; class AOJ { static void Main(string[] args) { int i = 1; while (true) { int n = int.Parse(Console.ReadLine()); if (n == 0) break; Console.WriteLine("Case {0}: {1}", i++, n); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
65
2
using System; class cls { static void Main() { int i = 0; while (true) { string s = Console.ReadLine(); if (s == "0") break; Console.WriteLine("Case {0}: {1}", i, s); i++; } } }
using System; class cls { static void Main() { int i = 1; while (true) { string s = Console.ReadLine(); if (s == "0") break; Console.WriteLine("Case {0}: {1}", i, s); i++; } } }
[["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203]]
8
60
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace test { class Program { static void Main(string[] args) { int a; List<int> list = new List<int>(); do { a = int.Parse(Console.ReadLine()); list.Add(a); } while (a != 0); int i = 1; foreach (int b in list) { if (b != 0) Console.WriteLine("case{0}: {1}", i++, b); } Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace test { class Program { static void Main(string[] args) { int a; List<int> list = new List<int>(); do { a = int.Parse(Console.ReadLine()); list.Add(a); } while (a != 0); int i = 1; foreach (int b in list) { if (b != 0) Console.WriteLine("Case {0}: {1}", i++, b); } Console.ReadKey(); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
126
2
using System; using System.Linq; using System.Collections.Generic; namespace ConsoleApp4 { class Program { static void Main(string[] args) { int K = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < K; i++) { Console.Write("ALC"); } } } }
using System; using System.Linq; using System.Collections.Generic; namespace ConsoleApp4 { class Program { static void Main(string[] args) { int K = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < K; i++) { Console.Write("ACL"); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
73
2
using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace atcoder { public class Program { public static void Main(string[] args) { var buffer = Console.ReadLine().Split(); var N = int.Parse(buffer[0]); var M = int.Parse(buffer[1]); var union = new UnionFind(N); for (int i = 0; i < M; i++) { buffer = Console.ReadLine().Split(); var x = int.Parse(buffer[0]); var y = int.Parse(buffer[1]); union .Unite(x, y); } decimal group = 0; decimal noGroup = 0; for (int i = 0; i < N; i++) { if (union.IsRoot(i)) group++; if (union.IsNotAff(i)) noGroup++; } decimal ans = group - 1 + noGroup; Console.WriteLine(ans); } } class UnionFind { List<int> list; public bool IsRoot(int n) => list[n] < -1; public bool IsNotAff(int n) => list[n] == -1; public UnionFind(int n) { list = Enumerable.Repeat(-1, n).ToList(); } public int Root(int x) { if (this.list[x] < 0) return x; return this.list[x] = Root(this.list[x]); } public bool Unite(int x, int y) { x = Root(x); y = Root(y); if (x == y) return false; if (this.list[x] > this.list[y]) Swap(ref x, ref y); this.list[x] += this.list[y]; this.list[y] = x; return true; } public void Swap(ref int x, ref int y) { var tmp = x; x = y; y = tmp; } public int Size(int x) { return -this.list[Root(x)]; } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace atcoder { public class Program { public static void Main(string[] args) { var buffer = Console.ReadLine().Split(); var N = int.Parse(buffer[0]); var M = int.Parse(buffer[1]); var union = new UnionFind(N); for (int i = 0; i < M; i++) { buffer = Console.ReadLine().Split(); var x = int.Parse(buffer[0]) - 1; var y = int.Parse(buffer[1]) - 1; union .Unite(x, y); } decimal group = 0; decimal noGroup = 0; for (int i = 0; i < N; i++) { if (union.IsRoot(i)) group++; if (union.IsNotAff(i)) noGroup++; } decimal ans = group - 1 + noGroup; Console.WriteLine(ans); } } class UnionFind { List<int> list; public bool IsRoot(int n) => list[n] < -1; public bool IsNotAff(int n) => list[n] == -1; public UnionFind(int n) { list = Enumerable.Repeat(-1, n).ToList(); } public int Root(int x) { if (this.list[x] < 0) return x; return this.list[x] = Root(this.list[x]); } public bool Unite(int x, int y) { x = Root(x); y = Root(y); if (x == y) return false; if (this.list[x] > this.list[y]) Swap(ref x, ref y); this.list[x] += this.list[y]; this.list[y] = x; return true; } public void Swap(ref int x, ref int y) { var tmp = x; x = y; y = tmp; } public int Size(int x) { return -this.list[Root(x)]; } } }
[["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 33], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203]]
8
459
4
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Text; using System.Linq; using E = System.Linq.Enumerable; using System.Threading; internal partial class Solver { public void Run() { var n = ni(); var k = ni(); var a = ni(n); var seg = new SegmentTree<int>(Math.Max, int.MinValue); seg.Build(300010, i => 0); int ans = 0; foreach (var x in a) { var lower = Math.Max(x - k, 0); var upper = Math.Min(x + k, n - 1); var max = seg.Query(lower, upper + 1); seg[x] = max + 1; ans = Math.Max(max + 1, ans); } cout.WriteLine(ans); } } public sealed class SegmentTree<TMonoid> { public int Count { get; private set; } private TMonoid[] _node; private readonly TMonoid _identity; private readonly Func<TMonoid, TMonoid, TMonoid> _merge; public SegmentTree(Func<TMonoid, TMonoid, TMonoid> merge, TMonoid identity) { _merge = merge; _identity = identity; } public void Build(IList<TMonoid> array) { Build(array.Count, i => array[i]); } public void Build(int n, Func<int, TMonoid> create) { Count = n; _node = new TMonoid[2 * Count]; for (int i = 0; i < n; i++) { _node[i + Count] = create(i); } for (int i = Count - 1; i > 0; i--) { _node[i] = _merge(_node[i << 1], _node[i << 1 | 1]); } } public void Set(int index, TMonoid val) { int p = index + Count; _node[p] = val; while (p > 0) { p >>= 1; _node[p] = _merge(_node[p << 1], _node[p << 1 | 1]); } } public TMonoid Query(int begin, int end) { TMonoid lv = _identity, rv = _identity; int l = begin + Count; int r = end + Count - 1; for (; l <= r; l >>= 1, r >>= 1) { if ((l & 1) == 1) { lv = _merge(lv, _node[l++]); } if ((r & 1) == 0) { rv = _merge(_node[r--], rv); } } return _merge(lv, rv); } public TMonoid this[int index] { get { return _node[index + Count]; } set { Set(index, value); } } }; // PREWRITEN CODE BEGINS FROM HERE static public class StringExtensions { static public string JoinToString<T>(this IEnumerable<T> source, string separator = " ") { return string.Join(separator, source); } } internal partial class Solver : Scanner { static readonly int? StackSizeInMebiByte = null; // 50; public static void StartAndJoin(Action action, int maxStackSize) { var thread = new Thread(new ThreadStart(action), maxStackSize); thread.Start(); thread.Join(); } public static void Main() { #if LOCAL byte[] inputBuffer = new byte[1000000]; var inputStream = Console.OpenStandardInput(inputBuffer.Length); using (var reader = new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length)) { Console.SetIn(reader); new Solver(Console.In, Console.Out).Run(); } #else Console.SetOut( new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }); if (StackSizeInMebiByte.HasValue) { StartAndJoin(() => new Solver(Console.In, Console.Out).Run(), StackSizeInMebiByte.Value * 1024 * 1024); } else { new Solver(Console.In, Console.Out).Run(); } Console.Out.Flush(); #endif } #pragma warning disable IDE0052 private readonly TextReader cin; private readonly TextWriter cout; private readonly TextWriter cerr; #pragma warning restore IDE0052 public Solver(TextReader reader, TextWriter writer) : base(reader) { cin = reader; cout = writer; cerr = Console.Error; } public Solver(string input, TextWriter writer) : this(new StringReader(input), writer) {} #pragma warning disable IDE1006 #pragma warning disable IDE0051 private int ni() { return NextInt(); } private int[] ni(int n) { return NextIntArray(n); } private long nl() { return NextLong(); } private long[] nl(int n) { return NextLongArray(n); } private double nd() { return NextDouble(); } private double[] nd(int n) { return NextDoubleArray(n); } private string ns() { return Next(); } private string[] ns(int n) { return NextArray(n); } #pragma warning restore IDE1006 #pragma warning restore IDE0051 } #if DEBUG internal static class LinqPadExtension { public static string TextDump<T>(this T obj) { if (obj is IEnumerable) return (obj as IEnumerable).Cast<object>().JoinToString().Dump(); else return obj.ToString().Dump(); } public static T Dump<T>(this T obj) { return LINQPad.Extensions.Dump(obj); } } #endif public class Scanner { private readonly TextReader Reader; private readonly CultureInfo ci = CultureInfo.InvariantCulture; private readonly char[] buffer = new char[2 * 1024]; private int cursor = 0, length = 0; private string Token; private readonly StringBuilder sb = new StringBuilder(1024); public Scanner() : this(Console.In) {} public Scanner(TextReader reader) { Reader = reader; } public int NextInt() { return checked((int)NextLong()); } public long NextLong() { var s = Next(); long r = 0; int i = 0; bool negative = false; if (s[i] == '-') { negative = true; i++; } for (; i < s.Length; i++) { r = r * 10 + (s[i] - '0'); #if DEBUG if (!char.IsDigit(s[i])) throw new FormatException(); #endif } return negative ? -r : r; } public double NextDouble() { return double.Parse(Next(), ci); } public string[] NextArray(int size) { string[] array = new string[size]; for (int i = 0; i < size; i++) { array[i] = Next(); } return array; } public int[] NextIntArray(int size) { int[] array = new int[size]; for (int i = 0; i < size; i++) { array[i] = NextInt(); } return array; } public long[] NextLongArray(int size) { long[] array = new long[size]; for (int i = 0; i < size; i++) { array[i] = NextLong(); } return array; } public double[] NextDoubleArray(int size) { double[] array = new double[size]; for (int i = 0; i < size; i++) { array[i] = NextDouble(); } return array; } public string Next() { if (Token == null) { if (!StockToken()) { throw new Exception(); } } var token = Token; Token = null; return token; } public bool HasNext() { if (Token != null) { return true; } return StockToken(); } private bool StockToken() { while (true) { sb.Clear(); while (true) { if (cursor >= length) { cursor = 0; if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) { break; } } var c = buffer[cursor++]; if (33 <= c && c <= 126) { sb.Append(c); } else { if (sb.Length > 0) break; } } if (sb.Length > 0) { Token = sb.ToString(); return true; } return false; } } }
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Text; using System.Linq; using E = System.Linq.Enumerable; using System.Threading; internal partial class Solver { public void Run() { var n = ni(); var k = ni(); var a = ni(n); var seg = new SegmentTree<int>(Math.Max, int.MinValue); seg.Build(300010, i => 0); int ans = 0; foreach (var x in a) { var lower = Math.Max(x - k, 0); var upper = Math.Min(x + k, 300010 - 1); var max = seg.Query(lower, upper + 1); seg[x] = max + 1; ans = Math.Max(max + 1, ans); } cout.WriteLine(ans); } } public sealed class SegmentTree<TMonoid> { public int Count { get; private set; } private TMonoid[] _node; private readonly TMonoid _identity; private readonly Func<TMonoid, TMonoid, TMonoid> _merge; public SegmentTree(Func<TMonoid, TMonoid, TMonoid> merge, TMonoid identity) { _merge = merge; _identity = identity; } public void Build(IList<TMonoid> array) { Build(array.Count, i => array[i]); } public void Build(int n, Func<int, TMonoid> create) { Count = n; _node = new TMonoid[2 * Count]; for (int i = 0; i < n; i++) { _node[i + Count] = create(i); } for (int i = Count - 1; i > 0; i--) { _node[i] = _merge(_node[i << 1], _node[i << 1 | 1]); } } public void Set(int index, TMonoid val) { int p = index + Count; _node[p] = val; while (p > 0) { p >>= 1; _node[p] = _merge(_node[p << 1], _node[p << 1 | 1]); } } public TMonoid Query(int begin, int end) { TMonoid lv = _identity, rv = _identity; int l = begin + Count; int r = end + Count - 1; for (; l <= r; l >>= 1, r >>= 1) { if ((l & 1) == 1) { lv = _merge(lv, _node[l++]); } if ((r & 1) == 0) { rv = _merge(_node[r--], rv); } } return _merge(lv, rv); } public TMonoid this[int index] { get { return _node[index + Count]; } set { Set(index, value); } } }; // PREWRITEN CODE BEGINS FROM HERE static public class StringExtensions { static public string JoinToString<T>(this IEnumerable<T> source, string separator = " ") { return string.Join(separator, source); } } internal partial class Solver : Scanner { static readonly int? StackSizeInMebiByte = null; // 50; public static void StartAndJoin(Action action, int maxStackSize) { var thread = new Thread(new ThreadStart(action), maxStackSize); thread.Start(); thread.Join(); } public static void Main() { #if LOCAL byte[] inputBuffer = new byte[1000000]; var inputStream = Console.OpenStandardInput(inputBuffer.Length); using (var reader = new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length)) { Console.SetIn(reader); new Solver(Console.In, Console.Out).Run(); } #else Console.SetOut( new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }); if (StackSizeInMebiByte.HasValue) { StartAndJoin(() => new Solver(Console.In, Console.Out).Run(), StackSizeInMebiByte.Value * 1024 * 1024); } else { new Solver(Console.In, Console.Out).Run(); } Console.Out.Flush(); #endif } #pragma warning disable IDE0052 private readonly TextReader cin; private readonly TextWriter cout; private readonly TextWriter cerr; #pragma warning restore IDE0052 public Solver(TextReader reader, TextWriter writer) : base(reader) { cin = reader; cout = writer; cerr = Console.Error; } public Solver(string input, TextWriter writer) : this(new StringReader(input), writer) {} #pragma warning disable IDE1006 #pragma warning disable IDE0051 private int ni() { return NextInt(); } private int[] ni(int n) { return NextIntArray(n); } private long nl() { return NextLong(); } private long[] nl(int n) { return NextLongArray(n); } private double nd() { return NextDouble(); } private double[] nd(int n) { return NextDoubleArray(n); } private string ns() { return Next(); } private string[] ns(int n) { return NextArray(n); } #pragma warning restore IDE1006 #pragma warning restore IDE0051 } #if DEBUG internal static class LinqPadExtension { public static string TextDump<T>(this T obj) { if (obj is IEnumerable) return (obj as IEnumerable).Cast<object>().JoinToString().Dump(); else return obj.ToString().Dump(); } public static T Dump<T>(this T obj) { return LINQPad.Extensions.Dump(obj); } } #endif public class Scanner { private readonly TextReader Reader; private readonly CultureInfo ci = CultureInfo.InvariantCulture; private readonly char[] buffer = new char[2 * 1024]; private int cursor = 0, length = 0; private string Token; private readonly StringBuilder sb = new StringBuilder(1024); public Scanner() : this(Console.In) {} public Scanner(TextReader reader) { Reader = reader; } public int NextInt() { return checked((int)NextLong()); } public long NextLong() { var s = Next(); long r = 0; int i = 0; bool negative = false; if (s[i] == '-') { negative = true; i++; } for (; i < s.Length; i++) { r = r * 10 + (s[i] - '0'); #if DEBUG if (!char.IsDigit(s[i])) throw new FormatException(); #endif } return negative ? -r : r; } public double NextDouble() { return double.Parse(Next(), ci); } public string[] NextArray(int size) { string[] array = new string[size]; for (int i = 0; i < size; i++) { array[i] = Next(); } return array; } public int[] NextIntArray(int size) { int[] array = new int[size]; for (int i = 0; i < size; i++) { array[i] = NextInt(); } return array; } public long[] NextLongArray(int size) { long[] array = new long[size]; for (int i = 0; i < size; i++) { array[i] = NextLong(); } return array; } public double[] NextDoubleArray(int size) { double[] array = new double[size]; for (int i = 0; i < size; i++) { array[i] = NextDouble(); } return array; } public string Next() { if (Token == null) { if (!StockToken()) { throw new Exception(); } } var token = Token; Token = null; return token; } public bool HasNext() { if (Token != null) { return true; } return StockToken(); } private bool StockToken() { while (true) { sb.Clear(); while (true) { if (cursor >= length) { cursor = 0; if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) { break; } } var c = buffer[cursor++]; if (33 <= c && c <= 126) { sb.Append(c); } else { if (sb.Length > 0) break; } } if (sb.Length > 0) { Token = sb.ToString(); return true; } return false; } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 16, 31, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 31, 203]]
8
1,799
2
using System; namespace ConsoleApp8 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); if (s.Substring(s.Length - 2, 1) == "s") { Console.WriteLine(s + "es"); } else { Console.WriteLine(s + "s"); } } } }
using System; namespace ConsoleApp8 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); if (s.Substring(s.Length - 1, 1) == "s") { Console.WriteLine(s + "es"); } else { Console.WriteLine(s + "s"); } } } }
[["-", 31, 213, 3, 4, 0, 28, 0, 16, 12, 203], ["+", 31, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
8
77
2
using System; using System.Linq; using System.Security.Cryptography.X509Certificates; namespace AtcoderProblem { class Program { static void Main(string[] args) { string S = Console.ReadLine(); int len = S.Length; string M = S.Substring(len); string answer; if (M == "s") { answer = S + "es"; } else { answer = S + "s"; } Console.WriteLine(answer); } } }
using System; using System.Linq; using System.Security.Cryptography.X509Certificates; namespace AtcoderProblem { class Program { static void Main(string[] args) { string S = Console.ReadLine(); int len = S.Length - 1; string M = S.Substring(len); string answer; if (M == "s") { answer = S + "es"; } else { answer = S + "s"; } Console.WriteLine(answer); } } }
[["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 33], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203]]
8
101
2
using System; using System.Linq; namespace AtCoder { class Program { static void Main(string[] args) { var line = Console.ReadLine(); if (line.Last().Equals("s")) { Console.WriteLine(line + "es"); } else { Console.WriteLine(line + "s"); } } } }
using System; using System.Linq; namespace AtCoder { class Program { static void Main(string[] args) { var line = Console.ReadLine(); if (line.Last().Equals('s')) { Console.WriteLine(line + "es"); } else { Console.WriteLine(line + "s"); } } } }
[["-", 15, 213, 3, 4, 0, 28, 0, 5, 0, 62], ["+", 15, 213, 3, 4, 0, 28, 0, 252, 0, 104]]
8
78
4
using System; namespace PluralForm { class Program { static void Main(string[] args) { string S = Console.ReadLine(); int lenS = S.Length; if (S[lenS - 1] == 'S') { S += "es"; } else { S += 's'; } Console.WriteLine(S); } } }
using System; namespace PluralForm { class Program { static void Main(string[] args) { string S = Console.ReadLine(); int lenS = S.Length; if (S[lenS - 1] == 's') { S += "es"; } else { S += 's'; } Console.WriteLine(S); } } }
[["-", 8, 196, 0, 57, 15, 16, 12, 252, 0, 253], ["+", 8, 196, 0, 57, 15, 16, 12, 252, 0, 253]]
8
75
2
using System; using System.Linq; class Program { static void Main(string[] args) { //回答 // Console.WriteLine(Math.Ceiling((double)N / X) * T); // Console.WriteLine(""); //整数の入力 // int input = int.Parse(Console.ReadLine()); //文字列の入力 // string input = Console.ReadLine(); string input = Console.ReadLine(); if (input.EndsWith("s")) { Console.WriteLine(input.Substring(0, input.Length - 1) + "es"); } else { Console.WriteLine(input + "s"); } /* 階乗 */ // long fact = 1; ///* 自然数の入力 */ // int num = int.Parse(Console.ReadLine()) ; // double tmp = ((double)num - 1) * num / 2; // Console.WriteLine("tmp : " + tmp); // Console.WriteLine("Math.Pow(8, num - 2) : " + Math.Pow(8, num - 2)); // Console.WriteLine("res : " + ((double)tmp * Math.Pow(8, num - 2) * 2) % // 1000000007); ////複数の入力 // string[] line = Console.ReadLine().Split(' '); // int a = int.Parse(line[0]); // int b = int.Parse(line[1]); // int c = int.Parse(line[2]); // int d = int.Parse(line[3]); // if ((double)D/S <= T) //{ // Console.WriteLine("Yes"); //} // else //{ // Console.WriteLine("No"); //} ////文字列の入力 // string S = Console.ReadLine(); // string T = Console.ReadLine(); // int ans = T.Length; // for (int i = 0; i < S.Length - T.Length + 1; i++) //{ // int count = 0; // for (int j = 0; j < T.Length; j++) // { // if (S[i + j] != T[j]) // { // count++; // if (count >= ans) // { // break; // } // } // } // if (count < ans) // { // ans = count; // } // //Console.WriteLine(S.Substring(i, T.Length)); // //Console.WriteLine(count); //} // Console.WriteLine(ans); //////複数の入力 // int N = int.Parse(Console.ReadLine()); // string[] strArray = Console.ReadLine().Split(' '); // long[] A = strArray.Select(long.Parse).ToArray(); // long[] sumArray = new long[A.Length]; // long modNum = 1000000007; // long ans = 0; // long tmp = 0; // for(int j = N - 1; j >= 0; j--) //{ // tmp = (tmp + A[j]) % modNum; // sumArray[j] = tmp; //} ////for (int i = 0; i < N; i++) ////{ //// Console.Write(sumArray[i] + " "); ////} ////Console.WriteLine(); // for (int i = N - 1; i > 0; i--) //{ // long hoge = (A[i - 1] * sumArray[i]) % modNum; // // Console.WriteLine(i + " : " + A[i - 1] + " * " + sumArray[i]); // // Console.WriteLine("add : " + hoge); // ans += hoge; //} // Console.WriteLine(ans % modNum); // int j = i // for (int j = i; j > i; j++) // { // long aiaj = (long)intArray[i] * intArray[j]; // ans += aiaj; // //if(aiaj < modnum) // //{ // // ans += aiaj; // //} // //else // //{ // // ans += aiaj % modnum; // //} // } //} // Console.WriteLine(ans % modnum); // string[] line = Console.ReadLine().Split(' '); // int H = int.Parse(line[0]); // int W = int.Parse(line[1]); // line = Console.ReadLine().Split(' '); // int Ch = int.Parse(line[0]); // int Cw = int.Parse(line[1]); // line = Console.ReadLine().Split(' '); // int Dh = int.Parse(line[0]); // int Dw = int.Parse(line[1]); // string[] S = new string[H]; // for(int i = 0; i < H; i++) //{ // // line = Console.ReadLine().Split(''); // string line2 = Console.ReadLine(); // //Console.WriteLine(line2); // S[i] = line2; // //for(int j = 0; j < W; j++) // //{ // // Console.WriteLine(line2[j]); // // //Console.WriteLine(S[i][j]); // //} //} // for (int i = 0; i < H; i++) //{ // for (int j = 0; j < W; j++) // { // } //} /////////////////////////////////////////////// // long N = int.Parse(Console.ReadLine()); // string[] A = Console.ReadLine().Split(' '); // long h = long.Parse(A[0]); // long dai_sum = 0; // for(long i = 1; i < N; i++) //{ // long ai = long.Parse(A[i]); // //Console.WriteLine("-- " + i + "--"); // //Console.WriteLine("dai_sum : " + dai_sum); // //Console.WriteLine("h : " + h); // //Console.WriteLine("a[i] : " + ai); // if (ai < h) // { // long dai = h - ai; // dai_sum += dai; // //Console.WriteLine("add dai : " + dai); // } // else // { // h = ai; // } //} // Console.WriteLine(dai_sum); //============== // String N = Console.ReadLine(); // int sum = 0; // for(int i =0;i< N.Length; i++) //{ // //Console.WriteLine("sum : " + sum); // //Console.WriteLine("N[i] : " + (N[i] - '0')); // sum += N[i] - '0'; //} ////Console.WriteLine("sum : " + sum); // if (sum % 9 == 0) //{ // Console.WriteLine("Yes"); //} // else //{ // Console.WriteLine("No"); //} //============= //スペース区切りの整数の入力 // string[] dates = Console.ReadLine().Split(' '); // string[] amounts = Console.ReadLine().Split(' '); // double date = double.Parse(input[0]); // double amount = double.Parse(input[1]); // double date = double.Parse(input[0]); // double amount = double.Parse(input[1]); // var L2 = L.Distinct().OrderBy(o => o); // var L2 = L.OrderBy(o => o).ToArray(); // string input = Console.ReadLine(); // int b = int.Parse(input[0]); // int c = int.Parse(input[1]); //文字列の入力 // string s = Console.ReadLine(); //出力 //////////////////a //整数の入力 // int N = int.Parse(Console.ReadLine()); // if (N == 0) //{ // Console.WriteLine("1"); //} // else //{ // Console.WriteLine("0"); //} //////////////////b //////複数の入力 // string[] line = Console.ReadLine().Split(' '); // int a = int.Parse(line[0]); // int b = int.Parse(line[1]); // int c = int.Parse(line[2]); // int d = int.Parse(line[3]); // long result = Math.Max(Math.Max((long)a * c, (long)a * d), // Math.Max((long)b * c, (long)b * d)); Console.WriteLine(result); //////////////////b } }
using System; using System.Linq; class Program { static void Main(string[] args) { //回答 // Console.WriteLine(Math.Ceiling((double)N / X) * T); // Console.WriteLine(""); //整数の入力 // int input = int.Parse(Console.ReadLine()); //文字列の入力 // string input = Console.ReadLine(); // string input = Console.ReadLine(); if (input.EndsWith("s")) { Console.WriteLine(input.Substring(0, input.Length) + "es"); } else { Console.WriteLine(input + "s"); } /* 階乗 */ // long fact = 1; ///* 自然数の入力 */ // int num = int.Parse(Console.ReadLine()) ; // double tmp = ((double)num - 1) * num / 2; // Console.WriteLine("tmp : " + tmp); // Console.WriteLine("Math.Pow(8, num - 2) : " + Math.Pow(8, num - 2)); // Console.WriteLine("res : " + ((double)tmp * Math.Pow(8, num - 2) * 2) % // 1000000007); ////複数の入力 // string[] line = Console.ReadLine().Split(' '); // int a = int.Parse(line[0]); // int b = int.Parse(line[1]); // int c = int.Parse(line[2]); // int d = int.Parse(line[3]); // if ((double)D/S <= T) //{ // Console.WriteLine("Yes"); //} // else //{ // Console.WriteLine("No"); //} ////文字列の入力 // string S = Console.ReadLine(); // string T = Console.ReadLine(); // int ans = T.Length; // for (int i = 0; i < S.Length - T.Length + 1; i++) //{ // int count = 0; // for (int j = 0; j < T.Length; j++) // { // if (S[i + j] != T[j]) // { // count++; // if (count >= ans) // { // break; // } // } // } // if (count < ans) // { // ans = count; // } // //Console.WriteLine(S.Substring(i, T.Length)); // //Console.WriteLine(count); //} // Console.WriteLine(ans); //////複数の入力 // int N = int.Parse(Console.ReadLine()); // string[] strArray = Console.ReadLine().Split(' '); // long[] A = strArray.Select(long.Parse).ToArray(); // long[] sumArray = new long[A.Length]; // long modNum = 1000000007; // long ans = 0; // long tmp = 0; // for(int j = N - 1; j >= 0; j--) //{ // tmp = (tmp + A[j]) % modNum; // sumArray[j] = tmp; //} ////for (int i = 0; i < N; i++) ////{ //// Console.Write(sumArray[i] + " "); ////} ////Console.WriteLine(); // for (int i = N - 1; i > 0; i--) //{ // long hoge = (A[i - 1] * sumArray[i]) % modNum; // // Console.WriteLine(i + " : " + A[i - 1] + " * " + sumArray[i]); // // Console.WriteLine("add : " + hoge); // ans += hoge; //} // Console.WriteLine(ans % modNum); // int j = i // for (int j = i; j > i; j++) // { // long aiaj = (long)intArray[i] * intArray[j]; // ans += aiaj; // //if(aiaj < modnum) // //{ // // ans += aiaj; // //} // //else // //{ // // ans += aiaj % modnum; // //} // } //} // Console.WriteLine(ans % modnum); // string[] line = Console.ReadLine().Split(' '); // int H = int.Parse(line[0]); // int W = int.Parse(line[1]); // line = Console.ReadLine().Split(' '); // int Ch = int.Parse(line[0]); // int Cw = int.Parse(line[1]); // line = Console.ReadLine().Split(' '); // int Dh = int.Parse(line[0]); // int Dw = int.Parse(line[1]); // string[] S = new string[H]; // for(int i = 0; i < H; i++) //{ // // line = Console.ReadLine().Split(''); // string line2 = Console.ReadLine(); // //Console.WriteLine(line2); // S[i] = line2; // //for(int j = 0; j < W; j++) // //{ // // Console.WriteLine(line2[j]); // // //Console.WriteLine(S[i][j]); // //} //} // for (int i = 0; i < H; i++) //{ // for (int j = 0; j < W; j++) // { // } //} /////////////////////////////////////////////// // long N = int.Parse(Console.ReadLine()); // string[] A = Console.ReadLine().Split(' '); // long h = long.Parse(A[0]); // long dai_sum = 0; // for(long i = 1; i < N; i++) //{ // long ai = long.Parse(A[i]); // //Console.WriteLine("-- " + i + "--"); // //Console.WriteLine("dai_sum : " + dai_sum); // //Console.WriteLine("h : " + h); // //Console.WriteLine("a[i] : " + ai); // if (ai < h) // { // long dai = h - ai; // dai_sum += dai; // //Console.WriteLine("add dai : " + dai); // } // else // { // h = ai; // } //} // Console.WriteLine(dai_sum); //============== // String N = Console.ReadLine(); // int sum = 0; // for(int i =0;i< N.Length; i++) //{ // //Console.WriteLine("sum : " + sum); // //Console.WriteLine("N[i] : " + (N[i] - '0')); // sum += N[i] - '0'; //} ////Console.WriteLine("sum : " + sum); // if (sum % 9 == 0) //{ // Console.WriteLine("Yes"); //} // else //{ // Console.WriteLine("No"); //} //============= //スペース区切りの整数の入力 // string[] dates = Console.ReadLine().Split(' '); // string[] amounts = Console.ReadLine().Split(' '); // double date = double.Parse(input[0]); // double amount = double.Parse(input[1]); // double date = double.Parse(input[0]); // double amount = double.Parse(input[1]); // var L2 = L.Distinct().OrderBy(o => o); // var L2 = L.OrderBy(o => o).ToArray(); // string input = Console.ReadLine(); // int b = int.Parse(input[0]); // int c = int.Parse(input[1]); //文字列の入力 // string s = Console.ReadLine(); //出力 //////////////////a //整数の入力 // int N = int.Parse(Console.ReadLine()); // if (N == 0) //{ // Console.WriteLine("1"); //} // else //{ // Console.WriteLine("0"); //} //////////////////b //////複数の入力 // string[] line = Console.ReadLine().Split(' '); // int a = int.Parse(line[0]); // int b = int.Parse(line[1]); // int c = int.Parse(line[2]); // int d = int.Parse(line[3]); // long result = Math.Max(Math.Max((long)a * c, (long)a * d), // Math.Max((long)b * c, (long)b * d)); Console.WriteLine(result); //////////////////b } }
[["-", 31, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["-", 31, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
8
286
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC179A { class Program { static void Main(string[] args) { string S = Console.ReadLine(); int l = S.Length; if (S[l].ToString() == "s") Console.WriteLine(S + "es"); else Console.WriteLine(S + "s"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC179A { class Program { static void Main(string[] args) { string S = Console.ReadLine(); int l = S.Length; if (S[l - 1].ToString() == "s") Console.WriteLine(S + "es"); else Console.WriteLine(S + "s"); } } }
[["+", 205, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 205, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
8
100
2
using System; using System.IO; namespace ConsoleApp8 { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[,] d = new int[n, 3]; int cnt = 0; for (int i = 0; i <= n - 1; i++) { string[] dice = Console.ReadLine().Split(' '); d[i, 0] = int.Parse(dice[0]); d[i, 1] = int.Parse(dice[1]); if (d[i, 0] == d[i, 1]) { cnt++; if (cnt >= 3) { Console.WriteLine("Yes"); break; } else { cnt = 0; } } } if (cnt < 3) { Console.WriteLine("No"); } } } }
using System; using System.IO; namespace ConsoleApp8 { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int[,] d = new int[n, 3]; int cnt = 0; for (int i = 0; i <= n - 1; i++) { string[] dice = Console.ReadLine().Split(' '); d[i, 0] = int.Parse(dice[0]); d[i, 1] = int.Parse(dice[1]); if (d[i, 0] == d[i, 1]) { cnt++; if (cnt >= 3) { Console.WriteLine("Yes"); break; } } else { cnt = 0; } } if (cnt < 3) { Console.WriteLine("No"); } } } }
[["+", 0, 7, 8, 196, 0, 57, 64, 196, 0, 46], ["-", 0, 57, 64, 196, 0, 57, 75, 196, 0, 46]]
8
194
2
using System; using System.Collections; namespace gotojail { class Program { static void Main(string[] args) { //結果格納ハッシュテーブル Hashtable hsResult = new Hashtable(); // 1行目をとる var times = int.Parse(Console.ReadLine()); for (var i = 0; i < times; i++) { // for文ぐるぐるで標準入力ピコピコして配列に入れ込んでいる string input = Console.ReadLine(); //各行の結果の配列をハッシュテーブルに格納する hsResult.Add(i, input); } // 3階連続でぞろ目か判定する if (BolChk3TimesZorome(hsResult, times)) { Console.WriteLine("yes"); } else { Console.WriteLine("no"); } } public static Boolean BolChk3TimesZorome(Hashtable phsInput, int pintTimes) { string strResultTF = ""; //ハッシュテーブルを展開する for (var i = 0; i < pintTimes; i++) { string strResInhs = phsInput[i].ToString(); string[] strRes = strResInhs.Split(" "); if (strRes[0].ToString() == strRes[1].ToString()) { strResultTF += "t"; } else { strResultTF += "f"; } } //「ttt」の文字列を検索する return strResultTF.Contains("ttt"); } } }
using System; using System.Collections; namespace gotojail { class Program { static void Main(string[] args) { //結果格納ハッシュテーブル Hashtable hsResult = new Hashtable(); // 1行目をとる var times = int.Parse(Console.ReadLine()); for (var i = 0; i < times; i++) { // for文ぐるぐるで標準入力ピコピコして配列に入れ込んでいる string input = Console.ReadLine(); //各行の結果の配列をハッシュテーブルに格納する hsResult.Add(i, input); } // 3階連続でぞろ目か判定する if (BolChk3TimesZorome(hsResult, times)) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } public static Boolean BolChk3TimesZorome(Hashtable phsInput, int pintTimes) { string strResultTF = ""; //ハッシュテーブルを展開する for (var i = 0; i < pintTimes; i++) { string strResInhs = phsInput[i].ToString(); string[] strRes = strResInhs.Split(" "); if (strRes[0].ToString() == strRes[1].ToString()) { strResultTF += "t"; } else { strResultTF += "f"; } } //「ttt」の文字列を検索する return strResultTF.Contains("ttt"); } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
230
4
using System; using System.Linq; class B { private static char[] c; private static int[] d1 = new int[3] { 0, 0, 0 }; private static int[] d2 = new int[3] { -1, -1, -1 }; static void Main() { var n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { c = Console.ReadLine().ToCharArray(); d1[2] = d1[1]; d2[2] = d2[1]; d1[1] = d1[0]; d2[1] = d2[0]; d1[0] = c[0] - '0'; d2[0] = c[2] - '0'; if (d1[0] == d2[0] && d1[1] == d2[1] && d1[2] == d1[2]) { Console.WriteLine("Yes"); return; } } Console.WriteLine("No"); } }
using System; using System.Linq; class B { private static char[] c; private static int[] d1 = new int[3] { 0, 0, 0 }; private static int[] d2 = new int[3] { -1, -1, -1 }; static void Main() { var n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { c = Console.ReadLine().ToCharArray(); d1[2] = d1[1]; d2[2] = d2[1]; d1[1] = d1[0]; d2[1] = d2[0]; d1[0] = c[0] - '0'; d2[0] = c[2] - '0'; if (d1[0] == d2[0] && d1[1] == d2[1] && d1[2] == d2[2]) { Console.WriteLine("Yes"); return; } } Console.WriteLine("No"); } }
[["-", 0, 57, 15, 16, 12, 16, 12, 204, 205, 22], ["+", 0, 57, 15, 16, 12, 16, 12, 204, 205, 22]]
8
233
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC179B { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); bool hantei = false; int zoro = 0; for (int i = 0; i < N; i++) { string[] DD = Console.ReadLine().Split(' '); if (DD[0] == DD[1]) zoro += 1; if (zoro == 3) hantei = true; } if (hantei) Console.WriteLine("Yes"); else Console.WriteLine("No"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC179B { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); bool hantei = false; int zoro = 0; for (int i = 0; i < N; i++) { string[] DD = Console.ReadLine().Split(' '); if (DD[0] == DD[1]) zoro += 1; else zoro = 0; if (zoro == 3) hantei = true; } if (hantei) Console.WriteLine("Yes"); else Console.WriteLine("No"); } } }
[["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 95], ["+", 8, 196, 0, 57, 75, 1, 0, 11, 31, 22], ["+", 0, 57, 75, 1, 0, 11, 0, 202, 0, 32], ["+", 8, 196, 0, 57, 75, 1, 0, 11, 12, 203], ["+", 0, 7, 8, 196, 0, 57, 75, 1, 0, 35]]
8
153
5
using System; using System.Collections; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Threading.Tasks; class Program { // Main static void Main(string[] args) { //出力準備(AutoFlushを切る) var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); //解答 Solve(); //出力終了 Console.Out.Flush(); } static void Solve() { //読み込む int N = int.Parse(Console.ReadLine()); bool[] zoro = new bool[N]; for (int i = 0; i < N; i++) { string[] line = Console.ReadLine().Split(' '); if (line[0] == line[1]) { zoro[i] = true; } } bool found = false; for (int i = 0; i < N - 3; i++) { if (zoro[i] && zoro[i + 1] && zoro[i + 2]) { found = true; break; } } if (found) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } }
using System; using System.Collections; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Threading.Tasks; class Program { // Main static void Main(string[] args) { //出力準備(AutoFlushを切る) var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); //解答 Solve(); //出力終了 Console.Out.Flush(); } static void Solve() { //読み込む int N = int.Parse(Console.ReadLine()); bool[] zoro = new bool[N]; for (int i = 0; i < N; i++) { string[] line = Console.ReadLine().Split(' '); if (line[0] == line[1]) { zoro[i] = true; } } bool found = false; for (int i = 0; i < N - 2; i++) { if (zoro[i] && zoro[i + 1] && zoro[i + 2]) { found = true; break; } } if (found) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } }
[["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203]]
8
267
2
using System; namespace CABC { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int counter = 0; for (int A = 0; A <= N; A++) { counter += (N - 1) / A; } Console.WriteLine(counter); } } }
using System; namespace CABC { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int counter = 0; for (int A = 1; A <= N; A++) { counter += (N - 1) / A; } Console.WriteLine(counter); } } }
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
8
74
2
using System; using System.Collections.Generic; using System.Linq; using static ABC.Cin; using static ABC.Cout; using static ABC.Tool; namespace ABC { class Program { static void Main(string[] args) { Scanf(out int n, out int k); var L = new int[k]; var R = new int[k]; for (int i = 0; i < k; i++) { Scanf(out L[i], out R[i]); } var MOD = 998244353; var dp = new long[n + 1]; dp[0] = 0; dp[1] = 1; for (int i = 2; i <= n; i++) { for (int j = 0; j < k; j++) { if (i - L[j] > 0) { dp[i] = (dp[i] + dp[i - L[j]]) % MOD; } if (i - R[j] - 1 > 0) { dp[i] = (dp[i] - dp[i - R[j] - 1] + MOD) % MOD; } } dp[i] += dp[i - 1]; dp[i] %= MOD; } OutL(dp[n] - dp[n - 1]); } } static class Cin { public static string[] ReadSplit => Console.ReadLine().Split(); public static int[] ReadSplitInt => Console.ReadLine().Split().Select(int.Parse).ToArray(); public static long[] ReadSplitLong => Console.ReadLine().Split().Select(long.Parse).ToArray(); public static string Str => Console.ReadLine(); public static int Int => int.Parse(Console.ReadLine()); public static long Long => long.Parse(Console.ReadLine()); public static double Double => double.Parse(Console.ReadLine()); public static T Conv<T>(string input) { return (T)Convert.ChangeType(input, typeof(T)); } public static void Scanf<T>(out T a) => a = Conv<T>(Console.ReadLine()); public static void Scanf<T, U>(out T a, out U b) { var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); } public static void Scanf<T, U, V>(out T a, out U b, out V c) { var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); c = Conv<V>(q[2]); } public static void Scanf<T, U, V, W>(out T a, out U b, out V c, out W d) { var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); c = Conv<V>(q[2]); d = Conv<W>(q[3]); } } static class Cout { public static void OutL(object s) => Console.WriteLine(s); } static class Tool { public static long Gcd(long a, long b) { if (a % b == 0) { return b; } else { return Gcd(b, a % b); } } public static long Lcm(long a, long b) => a * b / Gcd(a, b); public static long[] PrimeFac(long n) { var result = new long[n + 1]; for (int i = 2; i * i <= n; i++) { if (n % i != 0) { continue; } var cnt = 0; while (n % i == 0) { cnt++; n /= i; } result[i] = cnt; } if (n != 1) { result[n] = 1; } return result; } public static long DivsCnt(long n) { var result = 1L; for (int i = 2; i * i <= n; i++) { if (n % i != 0) { continue; } var cnt = 0; while (n % i == 0) { cnt++; n /= i; } result *= (cnt + 1); } if (n != 1) { result *= 2; } return result; } } }
using System; using System.Collections.Generic; using System.Linq; using static ABC.Cin; using static ABC.Cout; using static ABC.Tool; namespace ABC { class Program { static void Main(string[] args) { Scanf(out int n, out int k); var L = new int[k]; var R = new int[k]; for (int i = 0; i < k; i++) { Scanf(out L[i], out R[i]); } var MOD = 998244353; var dp = new long[n + 1]; dp[0] = 0; dp[1] = 1; for (int i = 2; i <= n; i++) { for (int j = 0; j < k; j++) { if (i - L[j] > 0) { dp[i] = (dp[i] + dp[i - L[j]]) % MOD; } if (i - R[j] - 1 > 0) { dp[i] = (dp[i] - dp[i - R[j] - 1] + MOD) % MOD; } } dp[i] += dp[i - 1]; dp[i] %= MOD; } OutL((dp[n] - dp[n - 1] + MOD) % MOD); } } static class Cin { public static string[] ReadSplit => Console.ReadLine().Split(); public static int[] ReadSplitInt => Console.ReadLine().Split().Select(int.Parse).ToArray(); public static long[] ReadSplitLong => Console.ReadLine().Split().Select(long.Parse).ToArray(); public static string Str => Console.ReadLine(); public static int Int => int.Parse(Console.ReadLine()); public static long Long => long.Parse(Console.ReadLine()); public static double Double => double.Parse(Console.ReadLine()); public static T Conv<T>(string input) { return (T)Convert.ChangeType(input, typeof(T)); } public static void Scanf<T>(out T a) => a = Conv<T>(Console.ReadLine()); public static void Scanf<T, U>(out T a, out U b) { var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); } public static void Scanf<T, U, V>(out T a, out U b, out V c) { var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); c = Conv<V>(q[2]); } public static void Scanf<T, U, V, W>(out T a, out U b, out V c, out W d) { var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); c = Conv<V>(q[2]); d = Conv<W>(q[3]); } } static class Cout { public static void OutL(object s) => Console.WriteLine(s); } static class Tool { public static long Gcd(long a, long b) { if (a % b == 0) { return b; } else { return Gcd(b, a % b); } } public static long Lcm(long a, long b) => a * b / Gcd(a, b); public static long[] PrimeFac(long n) { var result = new long[n + 1]; for (int i = 2; i * i <= n; i++) { if (n % i != 0) { continue; } var cnt = 0; while (n % i == 0) { cnt++; n /= i; } result[i] = cnt; } if (n != 1) { result[n] = 1; } return result; } public static long DivsCnt(long n) { var result = 1L; for (int i = 2; i * i <= n; i++) { if (n % i != 0) { continue; } var cnt = 0; while (n % i == 0) { cnt++; n /= i; } result *= (cnt + 1); } if (n != 1) { result *= 2; } return result; } } }
[["+", 3, 4, 0, 28, 0, 16, 31, 23, 0, 24], ["+", 0, 28, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 28, 0, 16, 31, 23, 0, 16, 12, 22], ["+", 3, 4, 0, 28, 0, 16, 31, 23, 0, 25], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 109], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
8
969
6
using System.Collections.Generic; using System; public class Hello { public static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = long.Parse(line[0]); var x = int.Parse(line[1]); var m = int.Parse(line[2]); getAns(n, x, m); } static void getAns(long n, int x, int m) { var a = new long[m]; var b = new long[m]; a[0] = x; b[0] = x; var d = new Dictionary<long, int>(); d[x] = 0; var p = 1; while (p < m) { var w = (a[p - 1] * a[p - 1]) % m; a[p] = w; b[p] = b[p - 1] + w; if (!d.ContainsKey(w)) d[w] = p; else { var dw = d[w]; if (dw != 0) { var loopc = p - dw; var loopv = b[p - 1] - b[dw - 1]; var toloopv = b[dw - 1]; var time = (n - dw) / loopc; var toend = (n - dw) % loopc; var toendv = b[dw + toend - 1] - b[dw - 1]; var ans = toloopv + time * loopv + toendv; Console.WriteLine(ans); return; } else { var loopc = p; var loopv = b[p - 1]; var toloopv = 0; var time = n / loopc; var toend = n % loopc; var toendv = b[toend - 1]; var ans = toloopv + time * loopv + toendv; Console.WriteLine(ans); return; } } p++; } Console.WriteLine(b[m - 1]); } }
using System.Collections.Generic; using System; public class Hello { public static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = long.Parse(line[0]); var x = int.Parse(line[1]); var m = int.Parse(line[2]); getAns(n, x, m); } static void getAns(long n, int x, int m) { var a = new long[m]; var b = new long[m]; a[0] = x; b[0] = x; var d = new Dictionary<long, int>(); d[x] = 0; var p = 1; while (p < m) { var w = (a[p - 1] * a[p - 1]) % m; a[p] = w; b[p] = b[p - 1] + w; if (!d.ContainsKey(w)) d[w] = p; else { var dw = d[w]; if (dw != 0) { var loopc = p - dw; var loopv = b[p - 1] - b[dw - 1]; var toloopv = b[dw - 1]; var time = (n - dw) / loopc; var toend = (n - dw) % loopc; var toendv = b[dw + toend - 1] - b[dw - 1]; var ans = toloopv + time * loopv + toendv; Console.WriteLine(ans); return; } else { var loopc = p; var loopv = b[p - 1]; var toloopv = 0; var time = n / loopc; var toend = n % loopc; var toendv = toend == 0 ? 0 : b[toend - 1]; var ans = toloopv + time * loopv + toendv; Console.WriteLine(ans); return; } } p++; } Console.WriteLine(b[m - 1]); } }
[["+", 0, 200, 0, 212, 0, 41, 15, 16, 31, 22], ["+", 0, 200, 0, 212, 0, 41, 15, 16, 17, 60], ["+", 0, 200, 0, 212, 0, 41, 15, 16, 12, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 41, 0, 101], ["+", 0, 198, 0, 200, 0, 212, 0, 41, 64, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 41, 0, 102]]
8
428
6
using System; using System.Collections.Generic; using System.Linq; public static class Solution { public static long Solve(long N, long X, long Mod) { long sum = 0; var list = new List<long>(); var indexes = new Dictionary<long, int>(); var a = X; list.Add(a); indexes[a] = 0; sum += a; var len = long.MaxValue; long seqSum = 0; long i = 0; while (++i < N) { a = a * a % Mod; list.Add(a); sum += a; if (indexes.ContainsKey(a)) { var l = indexes[a]; len = i - l; seqSum = list.Skip(l + 1).Sum(); break; } indexes[a] = (int)i; } if (N - i > len) { var count = (N - i + 1) / len; sum += seqSum * count; i += len * count; } while (++i < N) { a = a * a % Mod; sum += a; } return sum; } public static void Main() { var vals = Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); var N = vals[0]; var X = vals[1]; var Mod = vals[2]; Console.WriteLine(Solve(N, X, Mod)); } }
using System; using System.Collections.Generic; using System.Linq; public static class Solution { public static long Solve(long N, long X, long Mod) { long sum = 0; var list = new List<long>(); var indexes = new Dictionary<long, int>(); var a = X; list.Add(a); indexes[a] = 0; sum += a; var len = long.MaxValue; long seqSum = 0; long i = 0; while (++i < N) { a = a * a % Mod; list.Add(a); sum += a; if (indexes.ContainsKey(a)) { var l = indexes[a]; len = i - l; seqSum = list.Skip(l + 1).Sum(); break; } indexes[a] = (int)i; } if (N - (i + 1) > len) { var count = (N - (i + 1)) / len; sum += seqSum * count; i += len * count; } while (++i < N) { a = a * a % Mod; sum += a; } return sum; } public static void Main() { var vals = Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); var N = vals[0]; var X = vals[1]; var Mod = vals[2]; Console.WriteLine(Solve(N, X, Mod)); } }
[["+", 0, 57, 15, 16, 31, 16, 12, 23, 0, 24], ["+", 15, 16, 31, 16, 12, 23, 0, 16, 17, 72], ["+", 15, 16, 31, 16, 12, 23, 0, 16, 12, 203], ["+", 0, 57, 15, 16, 31, 16, 12, 23, 0, 25], ["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 24], ["+", 0, 16, 31, 23, 0, 16, 12, 23, 0, 25]]
8
318
6
using System; using System.Linq; using System.Collections.Generic; using System.Numerics; namespace ABC179 { class Program { static void Main(string[] args) { var NXM = Console.ReadLine().Split().Select(long.Parse).ToArray(); var N = NXM[0]; var X = NXM[1]; var M = NXM[2]; // make array var array = new long[M]; var a_ = X; array[0] = a_; for (int i = 1; i < M; i++) { a_ = (a_ * a_) % M; array[i] = a_; } // Console.WriteLine(string.Join(" ", array)); var t = Program.cycle_finding(array); var s = t.Item1; var e = t.Item2; var len = t.Item3; // Console.WriteLine("{0}, {1}", s, e); N -= s; var ans = 0L; for (int i = 0; i < s; i++) { ans += array[i]; } var a = N / len; var b = N % len; var sum = 0L; for (long i = s; i <= e; i++) { sum += array[i]; } ans += a * sum; for (int i = 0; i < b; i++) { ans += array[s + i]; } Console.WriteLine(ans); } // 循環開始・終了位置 static Tuple<long, long, long> cycle_finding(long[] a) { var x_length = new long [a.Length].Select(x => x = -1).ToArray(); var s = 0L; var e = 0L; var len = 0; var index = 0; for (int i = 0; x_length[a[i]] == -1; i++) { x_length[a[i]] = len; len++; index = i; } var cycle_length = len - x_length[a[index + 1]]; s = x_length[a[index + 1]]; e = x_length[a[index]]; // Console.WriteLine("{0}, {1}", s, e); // Console.WriteLine(string.Join(" ", x_length)); var tuple = Tuple.Create(s, e, cycle_length); return tuple; } } }
using System; using System.Linq; using System.Collections.Generic; using System.Numerics; namespace ABC179 { class Program { static void Main(string[] args) { var NXM = Console.ReadLine().Split().Select(long.Parse).ToArray(); var N = NXM[0]; var X = NXM[1]; var M = NXM[2]; // make array var array = new long[M + 100]; var a_ = X; array[0] = a_; for (int i = 1; i < M; i++) { a_ = (a_ * a_) % M; array[i] = a_; } // Console.WriteLine(string.Join(" ", array)); var t = Program.cycle_finding(array); var s = t.Item1; var e = t.Item2; var len = t.Item3; // Console.WriteLine("{0}, {1}", s, e); N -= s; var ans = 0L; for (int i = 0; i < s; i++) { ans += array[i]; } var a = N / len; var b = N % len; var sum = 0L; for (long i = s; i <= e; i++) { sum += array[i]; } ans += a * sum; for (int i = 0; i < b; i++) { ans += array[s + i]; } Console.WriteLine(ans); } // 循環開始・終了位置 static Tuple<long, long, long> cycle_finding(long[] a) { var x_length = new long [a.Length].Select(x => x = -1).ToArray(); var s = 0L; var e = 0L; var len = 0; var index = 0; for (int i = 0; x_length[a[i]] == -1; i++) { x_length[a[i]] = len; len++; index = i; } var cycle_length = len - x_length[a[index + 1]]; s = x_length[a[index + 1]]; e = x_length[a[index]]; // Console.WriteLine("{0}, {1}", s, e); // Console.WriteLine(string.Join(" ", x_length)); var tuple = Tuple.Create(s, e, cycle_length); return tuple; } } }
[["+", 0, 227, 39, 224, 225, 226, 0, 16, 17, 72], ["+", 0, 227, 39, 224, 225, 226, 0, 16, 12, 203]]
8
447
2
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Numerics; namespace AtCoder { class Program { private static void Main(string[] args) { var ss = Scanner.ArrayLong(3); var n = ss[0]; var m = ss[2]; if (n == 1) { Console.WriteLine(ss[1]); return; } var a = ss[1]; if (a == 0) { Console.WriteLine("0"); return; } var looper = new List<long> { a }; var loopHead = new List<long>(); var looping = new List<long>(); for (int i = 0; i < n; i++) { a = a * a % m; if (looper.Contains(a)) { loopHead = looper.TakeWhile(x => x != a).ToList(); looping = looper.SkipWhile(x => x != a).ToList(); looper.Clear(); break; } looper.Add(a); } if (looper.Count != 0) { Console.WriteLine(looper.Sum()); return; } var sum = loopHead.Sum(); n -= loopHead.Count; if (looping.Count != 0) { var multiplier = n / looping.Count; sum += looping.Sum() * multiplier; n %= looping.Count; sum += looping.Take((int)n).Sum(); } Console.WriteLine(sum); } #region Utility static readonly StreamScanner Scanner = new StreamScanner(Console.OpenStandardInput()); /// <summary> 一括出力 </summary> private static void OutAllLine(IEnumerable<dynamic> items) { var sb = new StringBuilder(); foreach (var result in items) { sb.Append(result.ToString() + "\n"); } sb = sb.Remove(sb.Length - 1, 1); Console.WriteLine(sb); } #endregion } #region Utility Class public class StreamScanner { public StreamScanner(Stream stream) { str = stream; } private readonly Stream str; private readonly byte[] buf = new byte[1024]; private int len, ptr; public bool isEof = false; public bool IsEndOfStream { get { return isEof; } } private byte read() { if (isEof) throw new EndOfStreamException(); if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } } return buf[ptr++]; } public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; } public 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 ScanIncludeSpace() { var sb = new StringBuilder(); for (var b = Char(); b >= 32 && b <= 126; b = (char)read()) sb.Append(b); return sb.ToString(); } public long Long() { long ret = 0; byte b = 0; var ng = false; do b = read(); while (b != '-' && (b < '0' || '9' < b)); if (b == '-') { ng = true; b = read(); } for (; true; b = read()) { if (b < '0' || '9' < b) return ng ? -ret : ret; else ret = ret * 10 + b - '0'; } } public int Integer() { return (int)Long(); } public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); } /// <summary> 数値読み込み </summary> public List<long> ArrayLong(int count = 0) { var scan = new List<long>(); for (int i = 0; i < count; i++) { scan.Add(Long()); } return scan; } /// <summary> 数値読み込み </summary> public List<int> ArrayInt(int count = 0) { var scan = new List<int>(); for (int i = 0; i < count; i++) { scan.Add(Integer()); } return scan; } } public class LargeCalc { public IEnumerable<long> Surplus(long baseNum, long power, int division) { long value = 1; for (int i = 1; i <= power; i++) { value = value * baseNum % division; yield return value; if (value == 0) { break; } } } } public class Primer { /// <summary> 素数判定 </summary> public bool IsPrime(long num) { if (num < 2) { return false; } if (num == 2) { return true; } if (num % 2 == 0) { return false; } double sqrtNum = Math.Sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { return false; } } return true; } public IEnumerable<long> GetPrimeFactors(long n) { int i = 2; long tmp = n; while (i * i <= tmp) { if (tmp % i == 0) { tmp /= i; yield return i; if (IsPrime(tmp)) { yield return tmp; tmp = 1; break; } } else { i++; } } if (tmp != 1) yield return tmp; } } public class Mod109 { public const int _7 = 1000000007; public const int _9 = 1000000009; public const int _3 = 998244353; private readonly int ModValue; public Mod109(int modValue = Mod109._7) { ModValue = modValue; } /// <summary> 和 </summary> public long Addition(long start, params long[] nums) { return nums.Aggregate( start, (current, num) => ModifyPositive((current + num) % ModValue)); } /// <summary> 差 </summary> public long Subtraction(long start, params long[] nums) { return nums.Aggregate( start, (current, num) => ModifyPositive((current - num) % ModValue)); } /// <summary> 積 </summary> public long Multiplication(long start, params long[] nums) { return nums.Aggregate( start, (current, num) => ModifyPositive((current * num) % ModValue)); } private long ModifyPositive(long value) { return value < 0 ? (value + ModValue) : value; } } public class BitArrayMaker { public List<int> Integer(int bitValue, int length) { var list = new List<int>(); for (int i = 0; i < length; i++) { if (bitValue % 2 == 1) { list.Add(i); } bitValue /= 2; } return list; } public bool[] Boolean(int bitValue, int length) { var list = new bool[length]; for (int i = 0; i < length; i++) { list[i] = bitValue % 2 == 1; bitValue /= 2; } return list; } } #endregion }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Numerics; namespace AtCoder { class Program { private static void Main(string[] args) { var ss = Scanner.ArrayLong(3); var n = ss[0]; var m = ss[2]; if (n == 1) { Console.WriteLine(ss[1]); return; } var a = ss[1]; if (a == 0) { Console.WriteLine("0"); return; } var looper = new List<long> { a }; var loopHead = new List<long>(); var looping = new List<long>(); for (int i = 0; i < n - 1; i++) { a = a * a % m; if (looper.Contains(a)) { loopHead = looper.TakeWhile(x => x != a).ToList(); looping = looper.SkipWhile(x => x != a).ToList(); looper.Clear(); break; } looper.Add(a); } if (looper.Count != 0) { Console.WriteLine(looper.Sum()); return; } var sum = loopHead.Sum(); n -= loopHead.Count; if (looping.Count != 0) { var multiplier = n / looping.Count; sum += looping.Sum() * multiplier; n %= looping.Count; sum += looping.Take((int)n).Sum(); } Console.WriteLine(sum); } #region Utility static readonly StreamScanner Scanner = new StreamScanner(Console.OpenStandardInput()); /// <summary> 一括出力 </summary> private static void OutAllLine(IEnumerable<dynamic> items) { var sb = new StringBuilder(); foreach (var result in items) { sb.Append(result.ToString() + "\n"); } sb = sb.Remove(sb.Length - 1, 1); Console.WriteLine(sb); } #endregion } #region Utility Class public class StreamScanner { public StreamScanner(Stream stream) { str = stream; } private readonly Stream str; private readonly byte[] buf = new byte[1024]; private int len, ptr; public bool isEof = false; public bool IsEndOfStream { get { return isEof; } } private byte read() { if (isEof) throw new EndOfStreamException(); if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } } return buf[ptr++]; } public char Char() { byte b = 0; do b = read(); while (b < 33 || 126 < b); return (char)b; } public 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 ScanIncludeSpace() { var sb = new StringBuilder(); for (var b = Char(); b >= 32 && b <= 126; b = (char)read()) sb.Append(b); return sb.ToString(); } public long Long() { long ret = 0; byte b = 0; var ng = false; do b = read(); while (b != '-' && (b < '0' || '9' < b)); if (b == '-') { ng = true; b = read(); } for (; true; b = read()) { if (b < '0' || '9' < b) return ng ? -ret : ret; else ret = ret * 10 + b - '0'; } } public int Integer() { return (int)Long(); } public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); } /// <summary> 数値読み込み </summary> public List<long> ArrayLong(int count = 0) { var scan = new List<long>(); for (int i = 0; i < count; i++) { scan.Add(Long()); } return scan; } /// <summary> 数値読み込み </summary> public List<int> ArrayInt(int count = 0) { var scan = new List<int>(); for (int i = 0; i < count; i++) { scan.Add(Integer()); } return scan; } } public class LargeCalc { public IEnumerable<long> Surplus(long baseNum, long power, int division) { long value = 1; for (int i = 1; i <= power; i++) { value = value * baseNum % division; yield return value; if (value == 0) { break; } } } } public class Primer { /// <summary> 素数判定 </summary> public bool IsPrime(long num) { if (num < 2) { return false; } if (num == 2) { return true; } if (num % 2 == 0) { return false; } double sqrtNum = Math.Sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { return false; } } return true; } public IEnumerable<long> GetPrimeFactors(long n) { int i = 2; long tmp = n; while (i * i <= tmp) { if (tmp % i == 0) { tmp /= i; yield return i; if (IsPrime(tmp)) { yield return tmp; tmp = 1; break; } } else { i++; } } if (tmp != 1) yield return tmp; } } public class Mod109 { public const int _7 = 1000000007; public const int _9 = 1000000009; public const int _3 = 998244353; private readonly int ModValue; public Mod109(int modValue = Mod109._7) { ModValue = modValue; } /// <summary> 和 </summary> public long Addition(long start, params long[] nums) { return nums.Aggregate( start, (current, num) => ModifyPositive((current + num) % ModValue)); } /// <summary> 差 </summary> public long Subtraction(long start, params long[] nums) { return nums.Aggregate( start, (current, num) => ModifyPositive((current - num) % ModValue)); } /// <summary> 積 </summary> public long Multiplication(long start, params long[] nums) { return nums.Aggregate( start, (current, num) => ModifyPositive((current * num) % ModValue)); } private long ModifyPositive(long value) { return value < 0 ? (value + ModValue) : value; } } public class BitArrayMaker { public List<int> Integer(int bitValue, int length) { var list = new List<int>(); for (int i = 0; i < length; i++) { if (bitValue % 2 == 1) { list.Add(i); } bitValue /= 2; } return list; } public bool[] Boolean(int bitValue, int length) { var list = new bool[length]; for (int i = 0; i < length; i++) { list[i] = bitValue % 2 == 1; bitValue /= 2; } return list; } } #endregion }
[["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203]]
8
1,536
2
using System; using System.IO; using System.Linq; using System.Collections.Generic; namespace CSharp_Shell { public static class Program { public static void Main() { int a = int.Parse(Console.ReadLine()); if (a == 1) { a = 0; } if (a == 0) { a = 1; } Console.WriteLine(a); } } }
using System; using System.IO; using System.Linq; using System.Collections.Generic; namespace CSharp_Shell { public static class Program { public static void Main() { int a = int.Parse(Console.ReadLine()); if (a == 1) { a = 0; } else if (a == 0) { a = 1; } Console.WriteLine(a); } } }
[["+", 8, 201, 0, 195, 8, 196, 0, 57, 0, 95]]
8
83
1
using System; namespace ConsoleApp1 { class ABC178A { static void Main(string[] args) { int x = Int32.Parse(Console.ReadLine()); if (x > 0) { Console.WriteLine("1"); } else { Console.WriteLine("0"); } } } }
using System; namespace ConsoleApp1 { class ABC178A { static void Main(string[] args) { int x = Int32.Parse(Console.ReadLine()); if (x > 0) { Console.WriteLine("0"); } else { Console.WriteLine("1"); } } } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
65
4
using System; using System.Collections.Generic; using System.Linq; namespace abc { class Program { static void Main(string[] args) { var input = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); var (a, b, c, d) = (input[0], input[1], input[2], input[3]); long max = -1010101010; foreach (var x in new long[] { a, b }) { foreach (var y in new long[] { c, d }) { max = Math.Max(max, x * y); } } Console.WriteLine(max); } } }
using System; using System.Collections.Generic; using System.Linq; namespace abc001 { class Program { static void Main(string[] args) { var input = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); var (a, b, c, d) = (input[0], input[1], input[2], input[3]); long max = long.MinValue; foreach (var x in new long[] { a, b }) { foreach (var y in new long[] { c, d }) { max = Math.Max(max, x * y); } } Console.WriteLine(max); } } }
[["-", 36, 36, 36, 36, 0, 208, 0, 209, 141, 22], ["+", 36, 36, 36, 36, 0, 208, 0, 209, 141, 22], ["-", 0, 198, 0, 200, 0, 212, 0, 241, 0, 33], ["-", 0, 198, 0, 200, 0, 212, 0, 241, 0, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 214, 205, 199], ["+", 0, 198, 0, 200, 0, 212, 0, 214, 0, 131], ["+", 0, 198, 0, 200, 0, 212, 0, 214, 141, 22]]
8
159
7
using System; using System.Collections.Generic; using System.Linq; namespace ConsoleApp2 { class Program { static void Main(string[] args) { var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); Console.WriteLine( new List<int> { a[0] * a[2], a[0] * a[3], a[1] * a[2], a[1] * a[3] } .Max()); } } }
using System; using System.Collections.Generic; using System.Linq; namespace ConsoleApp2 { class Program { static void Main(string[] args) { var a = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); Console.WriteLine( new List<long> { a[0] * a[2], a[0] * a[3], a[1] * a[2], a[1] * a[3] } .Max()); } } }
[["-", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199], ["+", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199], ["-", 63, 214, 205, 230, 39, 236, 237, 238, 0, 199], ["+", 63, 214, 205, 230, 39, 236, 237, 238, 0, 199]]
8
119
4
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.Design; using System.IO.Compression; using System.Linq; using System.Numerics; using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; using Console = System.Console; namespace Atcoder { class Program { private const long COMDIV = 1000000007; static void Main(string[] args) { var abcd = Console.ReadLine().Split().Select(int.Parse).ToArray(); var ret1 = abcd[0] * abcd[2]; var ret2 = abcd[0] * abcd[3]; var ret3 = abcd[1] * abcd[2]; var ret4 = abcd[1] * abcd[3]; Console.WriteLine(Math.Max(Math.Max(Math.Max(ret1, ret2), ret3), ret4)); } } }
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.Design; using System.IO.Compression; using System.Linq; using System.Numerics; using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; using Console = System.Console; namespace Atcoder { class Program { private const long COMDIV = 1000000007; static void Main(string[] args) { var abcd = Console.ReadLine().Split().Select(long.Parse).ToArray(); var ret1 = abcd[0] * abcd[2]; var ret2 = abcd[0] * abcd[3]; var ret3 = abcd[1] * abcd[2]; var ret4 = abcd[1] * abcd[3]; Console.WriteLine(Math.Max(Math.Max(Math.Max(ret1, ret2), ret3), ret4)); } } }
[["-", 205, 213, 3, 4, 0, 28, 0, 214, 205, 199], ["+", 205, 213, 3, 4, 0, 28, 0, 214, 205, 199]]
8
200
2
using System; using System.Linq; class Program { static void Main() { var args = Console.ReadLine().Split().ToList().ConvertAll(x => double.Parse(x)); var a = args[0]; var b = args[1]; var c = args[2]; var d = args[3]; var ans = (double)0; ans = a * c; if (a * d > ans) ans = a * d; if (b * c > ans) ans = b * c; if (b * d > ans) ans = b * d; Console.WriteLine(ans); } }
using System; using System.Linq; class Program { static void Main() { var args = Console.ReadLine().Split().ToList().ConvertAll(x => long.Parse(x)); var a = args[0]; var b = args[1]; var c = args[2]; var d = args[3]; var ans = (long)0; ans = a * c; if (a * d > ans) ans = a * d; if (b * c > ans) ans = b * c; if (b * d > ans) ans = b * d; Console.WriteLine(ans); } }
[["-", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199], ["+", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199], ["-", 0, 198, 0, 200, 0, 212, 0, 74, 39, 199], ["+", 0, 198, 0, 200, 0, 212, 0, 74, 39, 199]]
8
143
4
using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Runtime.ExceptionServices; using System.Security.Cryptography.X509Certificates; using System.Text; using static System.Console; using static System.Math; namespace AtCoder { class Program { static void Main(string[] args) { var x = ReadLongs(); var a = x[0]; var b = x[1]; var c = x[2]; var d = x[3]; var max = long.MinValue; max = Max(max, a * c); max = Max(max, a * d); max = Max(max, b * d); max = Max(max, b * d); WriteLine(max); } private static string Read() { return ReadLine(); } private static string[] Reads() { return (Read().Split()); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Runtime.ExceptionServices; using System.Security.Cryptography.X509Certificates; using System.Text; using static System.Console; using static System.Math; namespace AtCoder { class Program { static void Main(string[] args) { var x = ReadLongs(); var a = x[0]; var b = x[1]; var c = x[2]; var d = x[3]; var max = long.MinValue; max = Max(max, a * c); max = Max(max, a * d); max = Max(max, b * c); max = Max(max, b * d); WriteLine(max); } private static string Read() { return ReadLine(); } private static string[] Reads() { return (Read().Split()); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } } }
[["-", 12, 213, 3, 4, 0, 28, 0, 16, 12, 22], ["+", 12, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
8
339
2
using System; using System.Linq; using System.Collections.Generic; using System.Text; using System.Security.Cryptography.X509Certificates; public class Program { public static void Main(string[] args) { new B().test(); } } public class A { public void test() { // 普通の数値 var zero = CommonRead.ReadInt(); if (zero == 0) { Console.WriteLine(1); } else { Console.WriteLine(.0); } } } public class B { public void test() { // 普通の数値 var abcd = CommonRead.ReadLongL(); List<long> answer = new List<long>(); for (int count = 0; count < 2; count++) { answer.Add(abcd[count] * abcd[2]); answer.Add(abcd[count] * abcd[3]); } var t = answer[0]; for (int count = 1; count < answer.Count - 1; count++) { if (t < answer[count]) t = answer[count]; } Console.WriteLine(t); } } public class C { public void test() { // 普通の数値 var hwk = CommonRead.ReadIntL(); var row = new List<List<string>>(); for (int count = 0; count < hwk[0]; count++) { row.Add(CommonRead.ReadStrL()); } // 答えの.数 var equal = hwk[2]; Console.WriteLine(0); } } public class D { public void test() { // 普通の数値 var n = CommonRead.ReadLong(); var a = CommonRead.ReadLongL().OrderByDescending(x => x).ToList(); /* //.GroupBy(x => x).Select(x => new { key = x.Key, count = x.Count() }); // 繰り返し long exec = 0; bool zenkai = false; for (int i = 1; i<n; i++) { if (zenkai) { exec += a[i - 2]; } else { exec += a[i - 1]; } if (a[i] == a[i-1]) { zenkai = true; } // 答えの数 Console.WriteLine(exec); } */ long ans = 0; for (int i = 0; i < n - 1; ++i) { ans += a[(i + 1) / 2]; } Console.WriteLine(ans); } } static class CommonRead { public static string ReadStr() { return Console.ReadLine(); } public static string[] ReadStrA() { return ReadStr().Split(' '); } public static List<string> ReadStrL() { return ReadStrA().ToList(); } public static int ReadInt() { return Convert.ToInt32(ReadStr()); } public static int[] ReadIntA() { return ReadStrA().Select(s => Convert.ToInt32(s)).ToArray(); } public static List<int> ReadIntL() { return ReadStrA().Select(s => Convert.ToInt32(s)).ToList(); } public static long ReadLong() { return Convert.ToInt64(ReadStr()); } public static long[] ReadLongA() { return ReadStrA().Select(s => Convert.ToInt64(s)).ToArray(); } public static List<long> ReadLongL() { return ReadStrA().Select(s => Convert.ToInt64(s)).ToList(); } public static decimal ReadDecimal() { return Convert.ToDecimal(ReadStr()); } public static decimal[] ReadDecimalA() { return ReadStrA().Select(s => Convert.ToDecimal(s)).ToArray(); } public static List<decimal> ReadDecimalL() { return ReadStrA().Select(s => Convert.ToDecimal(s)).ToList(); } public static double ReadDouble() { return Convert.ToDouble(ReadStr()); } public static double[] ReadDoubleA() { return ReadStrA().Select(s => Convert.ToDouble(s)).ToArray(); } public static List<double> ReadDoubleL() { return ReadStrA().Select(s => Convert.ToDouble(s)).ToList(); } }
using System; using System.Linq; using System.Collections.Generic; using System.Text; using System.Security.Cryptography.X509Certificates; public class Program { public static void Main(string[] args) { new B().test(); } } public class A { public void test() { // 普通の数値 var zero = CommonRead.ReadInt(); if (zero == 0) { Console.WriteLine(1); } else { Console.WriteLine(.0); } } } public class B { public void test() { // 普通の数値 var abcd = CommonRead.ReadLongL(); List<long> answer = new List<long>(); for (int count = 0; count < 2; count++) { answer.Add(abcd[count] * abcd[2]); answer.Add(abcd[count] * abcd[3]); } var t = answer[0]; for (int count = 1; count < answer.Count; count++) { if (t < answer[count]) t = answer[count]; } Console.WriteLine(t); } } public class C { public void test() { // 普通の数値 var hwk = CommonRead.ReadIntL(); var row = new List<List<string>>(); for (int count = 0; count < hwk[0]; count++) { row.Add(CommonRead.ReadStrL()); } // 答えの.数 var equal = hwk[2]; Console.WriteLine(0); } } public class D { public void test() { // 普通の数値 var n = CommonRead.ReadLong(); var a = CommonRead.ReadLongL().OrderByDescending(x => x).ToList(); /* //.GroupBy(x => x).Select(x => new { key = x.Key, count = x.Count() }); // 繰り返し long exec = 0; bool zenkai = false; for (int i = 1; i<n; i++) { if (zenkai) { exec += a[i - 2]; } else { exec += a[i - 1]; } if (a[i] == a[i-1]) { zenkai = true; } // 答えの数 Console.WriteLine(exec); } */ long ans = 0; for (int i = 0; i < n - 1; ++i) { ans += a[(i + 1) / 2]; } Console.WriteLine(ans); } } static class CommonRead { public static string ReadStr() { return Console.ReadLine(); } public static string[] ReadStrA() { return ReadStr().Split(' '); } public static List<string> ReadStrL() { return ReadStrA().ToList(); } public static int ReadInt() { return Convert.ToInt32(ReadStr()); } public static int[] ReadIntA() { return ReadStrA().Select(s => Convert.ToInt32(s)).ToArray(); } public static List<int> ReadIntL() { return ReadStrA().Select(s => Convert.ToInt32(s)).ToList(); } public static long ReadLong() { return Convert.ToInt64(ReadStr()); } public static long[] ReadLongA() { return ReadStrA().Select(s => Convert.ToInt64(s)).ToArray(); } public static List<long> ReadLongL() { return ReadStrA().Select(s => Convert.ToInt64(s)).ToList(); } public static decimal ReadDecimal() { return Convert.ToDecimal(ReadStr()); } public static decimal[] ReadDecimalA() { return ReadStrA().Select(s => Convert.ToDecimal(s)).ToArray(); } public static List<decimal> ReadDecimalL() { return ReadStrA().Select(s => Convert.ToDecimal(s)).ToList(); } public static double ReadDouble() { return Convert.ToDouble(ReadStr()); } public static double[] ReadDoubleA() { return ReadStrA().Select(s => Convert.ToDouble(s)).ToArray(); } public static List<double> ReadDoubleL() { return ReadStrA().Select(s => Convert.ToDouble(s)).ToList(); } }
[["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203]]
8
789
2
using System; using System.Linq; namespace abc178_b { class Program { static void Main(string[] args) { var line = Console.ReadLine().Split(" ").Select(long.Parse).ToArray(); var a = line[0]; var b = line[1]; var c = line[2]; var d = line[3]; var ab = new long[] { a, 0, b }; var cd = new long[] { c, 0, d }; long m = long.MinValue; foreach (long x in ab) { if (x == 0 && 0 <= a * b) { continue; } foreach (long y in cd) { if (y == 0 && 0 <= c * d) { continue; } m = Math.Max(m, x * y); } } Console.WriteLine(m); } } }
using System; using System.Linq; namespace abc178_b { class Program { static void Main(string[] args) { var line = Console.ReadLine().Split(" ").Select(long.Parse).ToArray(); var a = line[0]; var b = line[1]; var c = line[2]; var d = line[3]; var ab = new long[] { a, 0, b }; var cd = new long[] { c, 0, d }; long m = long.MinValue; foreach (long x in ab) { if (x == 0 && 0 < a * b) { continue; } foreach (long y in cd) { if (y == 0 && 0 < c * d) { continue; } m = Math.Max(m, x * y); } } Console.WriteLine(m); } } }
[["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 19], ["+", 8, 196, 0, 57, 15, 16, 12, 16, 17, 18]]
8
193
4
using System; using System.Collections.Generic; using System.Globalization; using System.IO.Pipes; using System.Linq; using System.Numerics; using System.Text; using System.Threading; class Test { static long mod = (long)1e9 + 7; static long[] fact = new long[500001]; static long[] factinv = new long[500001]; // Driver code public static void Main() { // var input = Console.ReadLine().Split(' ').Select(x => // long.Parse(x)).ToArray(); var t = input[0]; while (t > 0) //{ // t--; var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray(); var a = input1[0]; var b = input1[0]; var c = input1[0]; var d = input1[0]; var ac = a * c; var ad = a * d; var bc = b * c; var bd = b * d; var ans = Math.Max(bd, Math.Max(bc, Math.Max(ac, ad))); Console.WriteLine(ans); // var m = Convert.ToInt32(input1[1]); // var timePre = 0; // var lowPre = 0; // var hiPre = 0; // bool check = true; // for (int i = 0; i < n; i++) // { // var input2 = Console.ReadLine().Split(' ').Select(xx => // int.Parse(xx)).ToArray(); var time = input2[0]; var low = // input2[1]; var hi = input2[2]; // if (i == 0) // { // if (Math.Abs((time - 0)) < low) // { // check = false; // Console.WriteLine("NO"); // break; // } // } // else // { // var diffTime = Math.Abs(time - timePre); // var diffLow = diffTime - lowPre; // var diffHigh = diffTime + lowPre; // var diffhHigh = diffTime - hiPre; // var diffhLow = diffTime + hiPre; // bool checkF = false; // if (diffLow >= low && diffLow <= hi) // { // checkF = true; // } // if (diffHigh >= low && diffHigh <= hi) // { // checkF = true; // } // if (diffhHigh >= low && diffhHigh <= hi) // { // checkF = true; // } // if (diffhLow >= low && diffhLow <= hi) // { // checkF = true; // } // if (!checkF) // { // Console.WriteLine("NO"); // check = false; // break; // } // } // timePre = time; // lowPre = low; // hiPre = hi; // } // if (check) // Console.WriteLine("YES"); //} // int[][] mat = new int[][] { new int[] { 0, 0 }, new int[] { 0, 0 }, new // int[] { 1, 0 } }; // NumSpecial(mat); } public static int NumSpecial(int[][] mat) { int count = 0; for (int i = 0; i < mat.Length; i++) { for (int j = 0; j < mat[0].Length; j++) { if (Verify(mat, i, j) && mat[i][j] == 1) { count++; } } } return count; } public static bool Verify(int[][] mat, int i, int j) { int count1H = 0; int count1V = 0; for (int k = 0; k < mat[0].Length; k++) { if (mat[i][k] == 1 && k != j) count1H++; } for (int k = 0; k < mat.Length; k++) { if (mat[k][j] == 1 && k != i) count1V++; } if (count1V == 0 && count1H == 0) return true; return false; } public static int Max(int num) { int max = 0; while (num > 0) { var d = num % 10; if (d > max) max = d; num = num / 10; } return max; } public static bool Common(int a, int b) { var s1 = a.ToString(); var s2 = b.ToString(); for (int i = 0; i < s1.Length; i++) for (int j = 0; j < s2.Length; j++) if (s1[i] == s2[j]) return true; return false; } public static long BinarySearch(long[] arr, long val) { long low = 0; long high = arr.Length; while (low < high) { long middle = low + (high - low) / 2; if (arr[middle] > val) high = middle; else low = middle + 1; } return low; } public static void Run() { fact[0] = 1; factinv[0] = fast_pow(fact[0], mod - 2); for (int i = 1; i <= 500000; ++i) { fact[i] = fact[i - 1] * i % mod; factinv[i] = fast_pow(fact[i], mod - 2); } } public static long GetCom(int n, int r) { return fact[n] * factinv[r] % mod * factinv[n - r] % mod; } public static long fast_pow(long a, long b) { if (b == 0) return 1; long val = fast_pow(a, b / 2); if (b % 2 == 0) return val * val % mod; else return val * val % mod * a % mod; } }
using System; using System.Collections.Generic; using System.Globalization; using System.IO.Pipes; using System.Linq; using System.Numerics; using System.Text; using System.Threading; class Test { static long mod = (long)1e9 + 7; static long[] fact = new long[500001]; static long[] factinv = new long[500001]; // Driver code public static void Main() { // var input = Console.ReadLine().Split(' ').Select(x => // long.Parse(x)).ToArray(); var t = input[0]; while (t > 0) //{ // t--; var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray(); var a = input1[0]; var b = input1[1]; var c = input1[2]; var d = input1[3]; var ac = a * c; var ad = a * d; var bc = b * c; var bd = b * d; var ans = Math.Max(bd, Math.Max(bc, Math.Max(ac, ad))); Console.WriteLine(ans); // var m = Convert.ToInt32(input1[1]); // var timePre = 0; // var lowPre = 0; // var hiPre = 0; // bool check = true; // for (int i = 0; i < n; i++) // { // var input2 = Console.ReadLine().Split(' ').Select(xx => // int.Parse(xx)).ToArray(); var time = input2[0]; var low = // input2[1]; var hi = input2[2]; // if (i == 0) // { // if (Math.Abs((time - 0)) < low) // { // check = false; // Console.WriteLine("NO"); // break; // } // } // else // { // var diffTime = Math.Abs(time - timePre); // var diffLow = diffTime - lowPre; // var diffHigh = diffTime + lowPre; // var diffhHigh = diffTime - hiPre; // var diffhLow = diffTime + hiPre; // bool checkF = false; // if (diffLow >= low && diffLow <= hi) // { // checkF = true; // } // if (diffHigh >= low && diffHigh <= hi) // { // checkF = true; // } // if (diffhHigh >= low && diffhHigh <= hi) // { // checkF = true; // } // if (diffhLow >= low && diffhLow <= hi) // { // checkF = true; // } // if (!checkF) // { // Console.WriteLine("NO"); // check = false; // break; // } // } // timePre = time; // lowPre = low; // hiPre = hi; // } // if (check) // Console.WriteLine("YES"); //} // int[][] mat = new int[][] { new int[] { 0, 0 }, new int[] { 0, 0 }, new // int[] { 1, 0 } }; // NumSpecial(mat); } public static int NumSpecial(int[][] mat) { int count = 0; for (int i = 0; i < mat.Length; i++) { for (int j = 0; j < mat[0].Length; j++) { if (Verify(mat, i, j) && mat[i][j] == 1) { count++; } } } return count; } public static bool Verify(int[][] mat, int i, int j) { int count1H = 0; int count1V = 0; for (int k = 0; k < mat[0].Length; k++) { if (mat[i][k] == 1 && k != j) count1H++; } for (int k = 0; k < mat.Length; k++) { if (mat[k][j] == 1 && k != i) count1V++; } if (count1V == 0 && count1H == 0) return true; return false; } public static int Max(int num) { int max = 0; while (num > 0) { var d = num % 10; if (d > max) max = d; num = num / 10; } return max; } public static bool Common(int a, int b) { var s1 = a.ToString(); var s2 = b.ToString(); for (int i = 0; i < s1.Length; i++) for (int j = 0; j < s2.Length; j++) if (s1[i] == s2[j]) return true; return false; } public static long BinarySearch(long[] arr, long val) { long low = 0; long high = arr.Length; while (low < high) { long middle = low + (high - low) / 2; if (arr[middle] > val) high = middle; else low = middle + 1; } return low; } public static void Run() { fact[0] = 1; factinv[0] = fast_pow(fact[0], mod - 2); for (int i = 1; i <= 500000; ++i) { fact[i] = fact[i - 1] * i % mod; factinv[i] = fast_pow(fact[i], mod - 2); } } public static long GetCom(int n, int r) { return fact[n] * factinv[r] % mod * factinv[n - r] % mod; } public static long fast_pow(long a, long b) { if (b == 0) return 1; long val = fast_pow(a, b / 2); if (b % 2 == 0) return val * val % mod; else return val * val % mod * a % mod; } }
[["-", 0, 212, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 212, 0, 204, 206, 207, 0, 28, 0, 203]]
8
867
6
using System; using System.Linq; using System.Collections.Generic; using System.Text.RegularExpressions; namespace AtCoderBeginnerContest178 { class Program { static void Main(string[] args) { // 課題B - Product Max(2020/9/13) string[] input = Console.ReadLine().Split(' '); long max = -100000000000000000; long tmpResult; for (int i = 0; i < 2; i++) { for (int j = 2; j < 4; j++) { tmpResult = long.Parse(input[i]) * long.Parse(input[j]); if (tmpResult > max) max = tmpResult; } } Console.Write(max); } } }
using System; using System.Linq; using System.Collections.Generic; using System.Text.RegularExpressions; namespace AtCoderBeginnerContest178 { class Program { static void Main(string[] args) { // 課題B - Product Max(2020/9/13) string[] input = Console.ReadLine().Split(' '); long max = -1000000000000000000; long tmpResult; for (int i = 0; i < 2; i++) { for (int j = 2; j < 4; j++) { tmpResult = long.Parse(input[i]) * long.Parse(input[j]); if (tmpResult > max) max = tmpResult; } } Console.Write(max); } } }
[["-", 0, 198, 0, 200, 0, 212, 0, 241, 0, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 241, 0, 203]]
8
140
2
using System; using System.Linq; class Program { static void Main() { var num = Console.ReadLine().Split(' ').Select(_ => double.Parse(_)).ToArray(); double[] list = new double[4]; list[0] = num[0] * num[2]; // ac list[1] = num[0] * num[3]; // ad list[2] = num[1] * num[2]; // bc list[3] = num[1] * num[3]; // bd double max = list.Max(); Console.WriteLine(max); } }
using System; using System.Linq; class Program { static void Main() { var num = Console.ReadLine().Split(' ').Select(_ => long.Parse(_)).ToArray(); long[] list = new long[4]; list[0] = num[0] * num[2]; // ac list[1] = num[0] * num[3]; // ad list[2] = num[1] * num[2]; // bc list[3] = num[1] * num[3]; // bd long max = list.Max(); Console.WriteLine((max)); } }
[["-", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199], ["+", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199], ["-", 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], ["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 197, 0, 198, 0, 200, 0, 289, 0, 24], ["+", 0, 198, 0, 200, 0, 289, 0, 289, 0, 25]]
8
142
10
using System; using System.Collections.Generic; using System.Linq; namespace ConsoleApp2 { class Program { static void Main(string[] args) { int[] abcd = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); var list = new List<int>(); list.Add(abcd[0] * abcd[2]); list.Add(abcd[0] * abcd[3]); list.Add(abcd[1] * abcd[2]); list.Add(abcd[1] * abcd[3]); Console.WriteLine(list.Max()); } } }
using System; using System.Collections.Generic; using System.Linq; namespace ConsoleApp2 { class Program { static void Main(string[] args) { long[] abcd = Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); var list = new List<long>(); list.Add(abcd[0] * abcd[2]); list.Add(abcd[0] * abcd[3]); list.Add(abcd[1] * abcd[2]); list.Add(abcd[1] * abcd[3]); Console.WriteLine(list.Max()); } } }
[["-", 8, 196, 0, 197, 0, 198, 39, 224, 39, 199], ["+", 8, 196, 0, 197, 0, 198, 39, 224, 39, 199], ["-", 205, 213, 3, 4, 0, 28, 0, 214, 205, 199], ["+", 205, 213, 3, 4, 0, 28, 0, 214, 205, 199], ["-", 0, 212, 0, 230, 39, 236, 237, 238, 0, 199], ["+", 0, 212, 0, 230, 39, 236, 237, 238, 0, 199]]
8
145
6
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Text; class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); long a = long.Parse(input[0]); long b = long.Parse(input[1]); long c = long.Parse(input[2]); long d = long.Parse(input[3]); long ac = a * c; long ad = a * d; long bc = b * d; long bd = b * d; long max = ac; if (ad > max) max = ad; if (bc > max) max = bc; if (bd > max) max = bd; Console.WriteLine(max); } }
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Text; class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(' '); long a = long.Parse(input[0]); long b = long.Parse(input[1]); long c = long.Parse(input[2]); long d = long.Parse(input[3]); long ac = a * c; long ad = a * d; long bc = b * c; long bd = b * d; long max = ac; if (ad > max) max = ad; if (bc > max) max = bc; if (bd > max) max = bd; Console.WriteLine(max); } }
[["-", 0, 198, 0, 200, 0, 212, 0, 16, 12, 22], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 12, 22]]
8
195
2
using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Linq; namespace contest_Csharp { class Program { public static (long m, long s)[,] dp; public static long mod; public static List<int> getprimes(int n) { var result = new List<int>(); result.Add(2); int i = 3; while (result.Last() <= n) { var flg = true; foreach (var p in result) { if (i % p == 0) { flg = false; } } if (flg) result.Add(i); i = i + 2; } return result; } static void Main(string[] args) { checked { var sw = new System.IO.StreamWriter( Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList(); var a = vals[0]; var b = vals[1]; var c = vals[2]; var d = vals[3]; long[] A = { a * c, a * d, b * c, b * d }; var ans = A.Max(); Console.WriteLine(ans); Console.Out.Flush(); } // cheked } static long gcd(long a, long b) { long large = Math.Max(a, b); long small = Math.Min(a, b); while (large % small != 0) { var S = small; small = large % small; large = S; } return small; } } }
using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Linq; namespace contest_Csharp { class Program { public static (long m, long s)[,] dp; public static long mod; public static List<int> getprimes(int n) { var result = new List<int>(); result.Add(2); int i = 3; while (result.Last() <= n) { var flg = true; foreach (var p in result) { if (i % p == 0) { flg = false; } } if (flg) result.Add(i); i = i + 2; } return result; } static void Main(string[] args) { checked { var sw = new System.IO.StreamWriter( Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); var vals = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); var a = vals[0]; var b = vals[1]; var c = vals[2]; var d = vals[3]; long[] A = { a * c, a * d, b * c, b * d }; var ans = A.Max(); Console.WriteLine(ans); Console.Out.Flush(); } // cheked } static long gcd(long a, long b) { long large = Math.Max(a, b); long small = Math.Min(a, b); while (large % small != 0) { var S = small; small = large % small; large = S; } return small; } } }
[["-", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199], ["+", 0, 28, 0, 218, 8, 213, 63, 214, 205, 199]]
8
367
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using static System.Console; using static System.Math; namespace AtTest.ABC_178 { class C { static void Main(string[] args) { var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false }; SetOut(sw); Method(args); Out.Flush(); } static void Method(string[] args) { int n = ReadInt(); long mask = 1000000000 + 7; long all = 1; long no0or9 = 1; long no0and9 = 1; for (int i = 0; i < n; i++) { all *= 10; all %= mask; no0or9 *= 9; no0or9 %= mask; no0and9 *= 8; no0and9 %= mask; } long res = all + (mask - no0or9 * 2) + no0and9; res %= mask; WriteLine(res); } private static string Read() { return ReadLine(); } private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using static System.Console; using static System.Math; namespace AtTest.ABC_178 { class C { static void Main(string[] args) { var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false }; SetOut(sw); Method(args); Out.Flush(); } static void Method(string[] args) { int n = ReadInt(); long mask = 1000000000 + 7; long all = 1; long no0or9 = 1; long no0and9 = 1; for (int i = 0; i < n; i++) { all *= 10; all %= mask; no0or9 *= 9; no0or9 %= mask; no0and9 *= 8; no0and9 %= mask; } long res = all + (mask - no0or9) * 2 + no0and9; res %= mask; WriteLine(res); } private static string Read() { return ReadLine(); } private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); } private static int ReadInt() { return int.Parse(Read()); } private static long ReadLong() { return long.Parse(Read()); } private static double ReadDouble() { return double.Parse(Read()); } private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); } private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); } private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); } } }
[["+", 0, 16, 31, 16, 12, 16, 31, 23, 0, 25], ["-", 0, 212, 0, 16, 31, 16, 12, 23, 0, 25]]
8
375
2
using System; using System.Text; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; using static System.Math; namespace AtCoder { public class Program { public static void Main(string[] args) { new Program().Solve(new ConsoleInput(Console.In, ' ')); } public void Solve(ConsoleInput cin) { long N = cin.ReadLong; long a = 1, b = 1, c = 1; for (int i = 0; i < N; i++) { a = 10 * a % 1000000007; b = 9 * b % 1000000007; c = 8 * c % 1000000007; } long ans = 0; if (a - 2 * b + c >= 0) ans = (a - 2 * b + c) % 1000000007; else { ans = ((a - 2 * b + c) + 1000000007) % 1000000007; } Console.WriteLine(ans); } } public class ConsoleInput { private readonly System.IO.TextReader _stream; private char _separator = ' '; private Queue<string> inputStream; public ConsoleInput(System.IO.TextReader stream, char separator = ' ') { this._separator = separator; this._stream = stream; inputStream = new Queue<string>(); } public string Read { get { if (inputStream.Count != 0) return inputStream.Dequeue(); string[] tmp = _stream.ReadLine().Split(_separator); for (int i = 0; i < tmp.Length; ++i) inputStream.Enqueue(tmp[i]); return inputStream.Dequeue(); } } public string ReadLine { get { return _stream.ReadLine(); } } public int ReadInt { get { return int.Parse(Read); } } public long ReadLong { get { return long.Parse(Read); } } public double ReadDouble { get { return double.Parse(Read); } } public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; } public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; } public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; } } }
using System; using System.Text; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; using static System.Math; namespace AtCoder { public class Program { public static void Main(string[] args) { new Program().Solve(new ConsoleInput(Console.In, ' ')); } public void Solve(ConsoleInput cin) { long N = cin.ReadLong; long a = 1, b = 1, c = 1; for (int i = 0; i < N; i++) { a = 10 * a % 1000000007; b = 9 * b % 1000000007; c = 8 * c % 1000000007; } long ans = 0; if (a - 2 * b + c >= 0) ans = (a - 2 * b + c) % 1000000007; else { ans = ((a - 2 * b + c) + 2 * 1000000007) % 1000000007; } Console.WriteLine(ans); } } public class ConsoleInput { private readonly System.IO.TextReader _stream; private char _separator = ' '; private Queue<string> inputStream; public ConsoleInput(System.IO.TextReader stream, char separator = ' ') { this._separator = separator; this._stream = stream; inputStream = new Queue<string>(); } public string Read { get { if (inputStream.Count != 0) return inputStream.Dequeue(); string[] tmp = _stream.ReadLine().Split(_separator); for (int i = 0; i < tmp.Length; ++i) inputStream.Enqueue(tmp[i]); return inputStream.Dequeue(); } } public string ReadLine { get { return _stream.ReadLine(); } } public int ReadInt { get { return int.Parse(Read); } } public long ReadLong { get { return long.Parse(Read); } } public double ReadDouble { get { return double.Parse(Read); } } public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; } public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; } public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; } } }
[["+", 12, 16, 31, 23, 0, 16, 12, 16, 31, 203], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 17, 48]]
8
543
2
using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net.WebSockets; class Test { // Driver code public static void Main() { /// var t = int.Parse(Console.ReadLine()); // while (t > 0) { // t--; var ii = Console.ReadLine() .Split(' ') .Where(xx => !string.IsNullOrEmpty(xx)) .Select(xx => int.Parse(xx)) .ToArray(); var n = ii[0]; var x = ii[1]; var tt = ii[2]; // var arr = Console.ReadLine().Split(' ').Where(x => // !string.IsNullOrEmpty(x)).Select(xx => int.Parse(xx)).ToList(); // var str = Console.ReadLine(); var ans1 = n / x; var nas2 = n % x; var final = ans1 * tt + nas2 > 0 ? tt : 0; Console.WriteLine(final); } } }
using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net.WebSockets; class Test { // Driver code public static void Main() { /// var t = int.Parse(Console.ReadLine()); // while (t > 0) { // t--; var ii = Console.ReadLine() .Split(' ') .Where(xx => !string.IsNullOrEmpty(xx)) .Select(xx => int.Parse(xx)) .ToArray(); var n = ii[0]; var x = ii[1]; var tt = ii[2]; // var arr = Console.ReadLine().Split(' ').Where(x => // !string.IsNullOrEmpty(x)).Select(xx => int.Parse(xx)).ToList(); // var str = Console.ReadLine(); var ans1 = n / x; var nas2 = n % x; var final = ans1 * tt + (nas2 > 0 ? tt : 0); Console.WriteLine(final); } } }
[["+", 0, 200, 0, 212, 0, 16, 12, 23, 0, 24], ["+", 0, 200, 0, 212, 0, 16, 12, 23, 0, 25]]
8
155
2
using System; using System.Text; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; using static System.Math; namespace atcoder151 { public class MainClass { public static void Main(string[] args) { new MainClass().Solve(new ConsoleInput(Console.In, ' ')); } public void Solve(ConsoleInput cin) { string[] array = Console.ReadLine().Split(' ').ToArray(); int n = int.Parse(array[0]); int x = int.Parse(array[1]); int t = int.Parse(array[2]); // int[] h = cin.ReadIntArray(n); // List<int> hl = h.ToList(); // hl.Sort(); int ans = 0; if (n / x > 0 && x != 1) { ans = n / x + 1; WriteLine(ans * t); } else if (x == 1) { ans = n / x; WriteLine(ans * t); } else if (n < x || n == x) { ans = t; WriteLine(ans); } } public class ConsoleInput { // string[] arr; // int x; // int y; // for (int i = 0; i<n; i++) // { // arr = Console.ReadLine().Split(' ').ToArray(); // x = int.Parse(arr[0]); // y = int.Parse(arr[1]); // var power = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2)); // if (power <= d) // { // counter++; // } // } private readonly System.IO.TextReader _stream; private char _separator = ' '; private Queue<string> inputStream; public ConsoleInput(System.IO.TextReader stream, char separator = ' ') { this._separator = separator; this._stream = stream; inputStream = new Queue<string>(); } public string Read { get { if (inputStream.Count != 0) return inputStream.Dequeue(); string[] tmp = _stream.ReadLine().Split(_separator); for (int i = 0; i < tmp.Length; ++i) inputStream.Enqueue(tmp[i]); return inputStream.Dequeue(); } } public string ReadLine { get { return _stream.ReadLine(); } } public int ReadInt { get { return int.Parse(Read); } } public long ReadLong { get { return long.Parse(Read); } } public double ReadDouble { get { return double.Parse(Read); } } public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; } public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; } public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; } } } }
using System; using System.Text; using System.Linq; using System.Collections; using System.Collections.Generic; using static System.Console; using static System.Math; namespace atcoder151 { public class MainClass { public static void Main(string[] args) { new MainClass().Solve(new ConsoleInput(Console.In, ' ')); } public void Solve(ConsoleInput cin) { string[] array = Console.ReadLine().Split(' ').ToArray(); int n = int.Parse(array[0]); int x = int.Parse(array[1]); int t = int.Parse(array[2]); // int[] h = cin.ReadIntArray(n); // List<int> hl = h.ToList(); // hl.Sort(); int ans = 0; if (n % x > 0 && x != 1) { ans = n / x + 1; WriteLine(ans * t); } else if (n % x == 0) { ans = n / x; WriteLine(ans * t); } else if (n < x || n == x) { ans = t; WriteLine(ans); } } public class ConsoleInput { // string[] arr; // int x; // int y; // for (int i = 0; i<n; i++) // { // arr = Console.ReadLine().Split(' ').ToArray(); // x = int.Parse(arr[0]); // y = int.Parse(arr[1]); // var power = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2)); // if (power <= d) // { // counter++; // } // } private readonly System.IO.TextReader _stream; private char _separator = ' '; private Queue<string> inputStream; public ConsoleInput(System.IO.TextReader stream, char separator = ' ') { this._separator = separator; this._stream = stream; inputStream = new Queue<string>(); } public string Read { get { if (inputStream.Count != 0) return inputStream.Dequeue(); string[] tmp = _stream.ReadLine().Split(_separator); for (int i = 0; i < tmp.Length; ++i) inputStream.Enqueue(tmp[i]); return inputStream.Dequeue(); } } public string ReadLine { get { return _stream.ReadLine(); } } public int ReadInt { get { return int.Parse(Read); } } public long ReadLong { get { return long.Parse(Read); } } public double ReadDouble { get { return double.Parse(Read); } } public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; } public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; } public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; } } } }
[["-", 0, 57, 15, 16, 31, 16, 31, 16, 17, 85], ["+", 0, 57, 15, 16, 31, 16, 31, 16, 17, 109], ["+", 0, 57, 75, 57, 15, 16, 31, 16, 31, 22], ["+", 0, 57, 75, 57, 15, 16, 31, 16, 17, 109], ["-", 8, 196, 0, 57, 75, 57, 15, 16, 12, 203], ["+", 8, 196, 0, 57, 75, 57, 15, 16, 12, 203]]
8
580
6
using System; using System.Linq; namespace AtCoderContest { class Program { static void Main() { var inputs = Console.ReadLine().Split(" ").Select(int.Parse).ToList(); var (n, x, t) = (inputs[0], inputs[1], inputs[2]); if (n % t == 0) { Console.WriteLine((n / x) * t); } else { Console.WriteLine((n / x + 1) * t); } } } }
using System; using System.Linq; namespace AtCoderContest { class Program { static void Main() { var inputs = Console.ReadLine().Split(" ").Select(int.Parse).ToList(); var (n, x, t) = (inputs[0], inputs[1], inputs[2]); if (n % x == 0) { Console.WriteLine((n / x) * t); } else { Console.WriteLine((n / x + 1) * t); } } } }
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 12, 22], ["+", 8, 196, 0, 57, 15, 16, 31, 16, 12, 22]]
8
117
2
using System; using System.Collections.Generic; using System.Linq; namespace ABC086A { class Program { static void Main(string[] args) { var input = Console.ReadLine().Split(' '); var N = int.Parse(input[0]); var X = int.Parse(input[1]); var T = int.Parse(input[2]); var count = (Math.Round((double)N / X)); System.Console.WriteLine(count * T); } } }
using System; using System.Collections.Generic; using System.Linq; namespace ABC086A { class Program { static void Main(string[] args) { var input = Console.ReadLine().Split(' '); var N = int.Parse(input[0]); var X = int.Parse(input[1]); var T = int.Parse(input[2]); var count = (Math.Ceiling((double)N / X)); System.Console.WriteLine(count * T); } } }
[["-", 0, 212, 0, 23, 0, 213, 63, 214, 141, 22], ["+", 0, 212, 0, 23, 0, 213, 63, 214, 141, 22]]
8
117
2
using System; using System.Linq; namespace atc { class Program { static void Main(string[] args) { int num = 0; string input = Console.ReadLine(); foreach (char c in input) { num += Convert.ToInt32(c); } // long p = long.Parse(Console.ReadLine()); // int[] p = Console.ReadLine().Split(' ').Select(i => // int.Parse(i)).ToArray(); if (num % 9 == 0) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; using System.Linq; namespace atc { class Program { static void Main(string[] args) { int num = 0; string input = Console.ReadLine(); foreach (char c in input) { num += Convert.ToInt32(c.ToString()); } // long p = long.Parse(Console.ReadLine()); // int[] p = Console.ReadLine().Split(' ').Select(i => // int.Parse(i)).ToArray(); if (num % 9 == 0) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
[["+", 3, 4, 0, 28, 0, 213, 63, 214, 0, 131], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["+", 3, 4, 0, 28, 0, 213, 3, 4, 0, 24], ["+", 0, 1, 0, 11, 12, 213, 3, 4, 0, 25]]
8
93
4
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using static System.Console; namespace Atcoder.Abc { // https://atcoder.jp/contests/abc176/tasks/abc176_b public class Abc176_B { public static void Main(string[] args) { var sw = new System.IO.StreamWriter( Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); string s = Console.ReadLine(); var loop = s.Length - 1; var sum = 0; for (int i = 0; i < loop; i++) { sum += int.Parse(s.Substring(i, 1)); } WriteLine(sum % 9 == 0 ? "Yes" : "No"); Console.Out.Flush(); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using static System.Console; namespace Atcoder.Abc { // https://atcoder.jp/contests/abc176/tasks/abc176_b public class Abc176_B { public static void Main(string[] args) { var sw = new System.IO.StreamWriter( Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); string s = Console.ReadLine(); var loop = s.Length - 1; var sum = 0; for (int i = 0; i <= loop; i++) { sum += int.Parse(s.Substring(i, 1)); } WriteLine(sum % 9 == 0 ? "Yes" : "No"); Console.Out.Flush(); } } }
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
8
171
2
using System; class Program { static void Main(string[] args) {   string N = Console.ReadLine(); //標準入力 int count = 0; for (int i = 0; i < N.Length; i++) { string s2 = N.Substring(i, 1); int a = int.Parse(s2); count = (count + a) % 9; } if (count == 0) { Console.WriteLine("{0}", "YES"); //改行付き出力 } else { Console.WriteLine("{0}", "NO"); //改行付き出力 } // Console.WriteLine("{0}", count);//改行付き出力 } }
using System; class Program { static void Main(string[] args) {   string N = Console.ReadLine(); //標準入力 int count = 0; for (int i = 0; i < N.Length; i++) { string s2 = N.Substring(i, 1); int a = int.Parse(s2); count = (count + a) % 9; } if (count == 0) { Console.WriteLine("{0}", "Yes"); //改行付き出力 } else { Console.WriteLine("{0}", "No"); //改行付き出力 } // Console.WriteLine("{0}", count);//改行付き出力 } }
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
8
124
4
using System; using System.Collections.Generic; using System.Linq; namespace KCLC { class Program { static void Main() { string Input = Console.ReadLine(); int Length = Input.Length; int[] Hairetu = new int[Length]; for (int i = 0; i < Length; i++) { Hairetu[i] = (int)Input[i]; } int Wa = 0; for (int j = 0; j < Length; j++) { Wa += Hairetu[j]; } if (Wa % 9 == 0) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; using System.Collections.Generic; using System.Linq; namespace KCLC { class Program { static void Main() { string Input = Console.ReadLine(); int Length = Input.Length; int[] Hairetu = new int[Length]; for (int i = 0; i < Length; i++) { Hairetu[i] = (int)Input[i] - 48; } int Wa = 0; for (int j = 0; j < Length; j++) { Wa += Hairetu[j]; } if (Wa % 9 == 0) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
[["+", 8, 196, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 12, 203]]
8
145
2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC174 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); int n = 0; foreach (char cs in s) { n += cs - '0'; } if (n != 0 && n % 9 == 0) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ABC174 { class Program { static void Main(string[] args) { string s = Console.ReadLine(); int n = 0; foreach (char cs in s) { n += cs - '0'; } if (n % 9 == 0) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
[["-", 8, 196, 0, 57, 15, 16, 31, 16, 17, 79], ["-", 8, 196, 0, 57, 15, 16, 31, 16, 12, 203], ["-", 0, 195, 8, 196, 0, 57, 15, 16, 17, 98], ["-", 0, 57, 15, 16, 12, 16, 31, 16, 31, 22]]
8
112
4