@jtahstu
2016-01-09T11:59:30.000000Z
字数 35310
阅读 5319
C# ACM Code
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1100 {class Program {static void Main(string[] args) {long n = Convert.ToInt64(Console.ReadLine());long sum = (1 + n) * n / 2;Console.WriteLine("{0}", sum);}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1101 {class Program {static void Main(string[] args) {int x = int.Parse(Console.ReadLine());double PI = Math.Atan(1.0) * 4.0;double s = Math.Sin(x * PI / 180);double b = Math.Cos(x * PI / 180);Console.WriteLine(s.ToString("0.000") + " " + b.ToString("0.000"));}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1102 {class Program {static void Main(string[] args) {string[] values = Console.ReadLine().Split(' ');double x1 = double.Parse(values[0]), y1 = double.Parse(values[1]);double x2 = double.Parse(values[2]), y2 = double.Parse(values[3]);double l = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));string s = l.ToString("0.000");Console.WriteLine(s);}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1103 {class Program {static void Main(string[] args) {int n = Convert.ToInt32(Console.ReadLine());if (n % 2 == 0)Console.WriteLine("yes");elseConsole.WriteLine("no");}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1104 {class Program {static void Main(string[] args) {int n = Convert.ToInt32(Console.ReadLine());if (n >= 4) {double s = n * 95 * 0.85;string res = s.ToString("0.00");Console.WriteLine(res);} else {Console.WriteLine("{0}", n * 95);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1105 {class Program {static void Main(string[] args) {double n = Convert.ToDouble(Console.ReadLine());if (n >= 0) {string str = n.ToString("0.00");Console.WriteLine(str);} else {n = -n;string str = n.ToString("0.00");Console.WriteLine(str);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1106 {class Program {static void Main(string[] args) {int[] a = new int[3];string[] values = Console.ReadLine().Split(' ');a[0] = int.Parse(values[0]); a[1] = int.Parse(values[1]); a[2] = int.Parse(values[2]);Array.Sort(a);if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2])Console.WriteLine("yes");else if (a[0] + a[1] <= a[2] || a[2] - a[1] >= a[0])Console.WriteLine("not a triangle");elseConsole.WriteLine("no");}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1107 {class Program {static void Main(string[] args) {int n = Convert.ToInt32(Console.ReadLine());if ((n % 4 == 0 && n % 100 != 0) || n % 400 == 0) {Console.WriteLine("yes");} else {Console.WriteLine("no");}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1108 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());for (int i = 1; i <= n; i++) {Console.WriteLine(i);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1109 {class Program {static void Main(string[] args) {Console.WriteLine("7744");}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1110 {class Program {static long tt(long n) {long number = 0;while (n != 1) {if (n % 2 == 0)n /= 2;elsen = 3 * n + 1;number++;}return number;}static void Main(string[] args) {long n = long.Parse(Console.ReadLine());Console.WriteLine(tt(n));}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1111 {class Program {static void Main(string[] args) {int i = 1, n, s = 1, sum = 0;n = int.Parse(Console.ReadLine());while (i <= n) {s *= i;s %= 1000000;sum += s;i++;}sum %= 1000000;Console.WriteLine(sum);}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Text.RegularExpressions;namespace AK1112 {class Program {static void Main(string[] args) {string[] s = Regex.Split(Console.In.ReadToEnd().Trim(), @"\s+");//what's a fuck!!!int[] a = new int[1005];int max = int.Parse(s[0]), min = int.Parse(s[0]);int sum = int.Parse(s[0]);for (int i = 1; i < s.Length; i++) {a[i] = int.Parse(s[i]);if (a[i] > max) max = a[i];if (a[i] < min) min = a[i];sum += a[i];}double jt = sum * 1.0 / s.Length;Console.WriteLine("{0} {1} {2}", min, max, jt.ToString("0.000"));//Console.ReadKey();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1113 {class Program {static void Main(string[] args) {long n = long.Parse(Console.ReadLine()), i = 0;while (n > 0) {i++;n /= 10;}Console.WriteLine(i);}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1114 {class Program {static void Main(string[] args) {int a, b, x, y, z, i;string[] values = Console.ReadLine().Split(' ');a = int.Parse(values[0]); b = int.Parse(values[1]);if (a < 100) a = 100;if (b > 999) b = 999;for (i = a; i <= b; i++) {x = i / 100;y = i / 10 % 10;z = i % 10;if (x * x * x + y * y * y + z * z * z == i)Console.WriteLine(i);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1115 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int a = int.Parse(s[0]), b = int.Parse(s[1]), c = int.Parse(s[2]);bool flag = false;for (int i = 10; i <= 100; i++) {if (i % 3 == a && i % 5 == b && i % 7 == c) {flag = true;Console.WriteLine(i);break;}}if (!flag)Console.WriteLine("No answer");}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1116 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());for (int i = 0; i < n; i++) {for (int j = 1; j <= 2 * n - i - 1; j++) {if (i >= j)Console.Write(" ");elseConsole.Write("#");}Console.WriteLine();}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1117 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {int n = int.Parse(sb);string[] a = Console.ReadLine().Split(' ');int m = int.Parse(Console.ReadLine());int count = 0;for (int i = 0; i < n; i++) {if (int.Parse(a[i]) < m)count++;}Console.WriteLine(count);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1118 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {int n = int.Parse(sb);double sum = 0;for (int i = 1; i <= n; i++) {sum += 1.0 / i;}Console.WriteLine(sum.ToString("0.000"));}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1119 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {int n = int.Parse(sb);double sum = 0;int sign = 1;for (int i = 1; i <= n; i += 2) {sum += 1.0 / i * sign;sign *= -1;}sum *= 4.0;Console.WriteLine(sum.ToString("0.000000"));}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1120 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();long n = long.Parse(s[0]), m = long.Parse(s[1]);double sum = 0;for (long i = n; i <= m; i++) {sum += (1.0 / (i * i));}Console.WriteLine(sum.ToString("0.00000"));}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Ak1121 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int a = int.Parse(s[0]), b = int.Parse(s[1]), c = int.Parse(s[2]);int integer = a / b;//整数部分a = a % b;int[] ans = new int[105];for (int i = 0; i <= c; i++) {ans[i] = a * 10 / b;a = a * 10 % b;}int jt = 0;//用于四舍五入if (ans[c] > 5) {jt = 1;for (int i = c - 1; i >= 0; i--)//处理后面来的的进位{ans[i] = (ans[i] + jt) % 10;jt = ans[i] / 10;if (jt == 0) break;}}Console.Write(integer + ".");for (int i = 0; i < c; i++)Console.Write(ans[i]);Console.WriteLine();}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace AK1122 {class Program {static void Main(string[] args) {Console.WriteLine("192 384 576\n219 438 657\n273 546 819\n327 654 981");}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1123 {class Program {static void Main(string[] args) {string[] s = Console.ReadLine().Split();int a = int.Parse(s[0]), b = int.Parse(s[1]);Console.WriteLine(a + b);//Console.ReadLine();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1124 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {long n = long.Parse(sb);long ans = n * n * n;Console.WriteLine(ans);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1125 {class Program {static void Main(string[] args) {string sb = Console.ReadLine();for (int i = 0; i < sb.Length; i++) {if (sb[i] >= 'a' && sb[i] <= 'z')Console.Write(sb[i].ToString().ToUpper());elseConsole.Write(sb[i]);}Console.WriteLine();//Console.ReadLine();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1126 {class Program {static void Main(string[] args) {string[] sb = Console.ReadLine().Split();int a = int.Parse(sb[0]), b = int.Parse(sb[1]);int x = (a / 10 + b / 10) % 10;int y = (a % 10 + b % 10) % 10;if (x == 0)Console.WriteLine(y);elseConsole.WriteLine("{0}{1}", x, y);//Console.ReadKey();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1127 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());long sum = 0, count = 1;for (int i = 1; i <= n; i++) {count *= i;sum += count;}Console.WriteLine(sum);//Console.ReadLine();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1128 {class Program {static void Main(string[] args) {string[] s = Console.ReadLine().Split();int[] a = new int[10];for (int i = 0; i < 10; i++)a[i] = int.Parse(s[i]);Array.Sort(a);foreach (int i in a)Console.Write(i + " ");Console.WriteLine();//Console.ReadLine();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1129 {class Program {static void Main(string[] args) {string s = Console.ReadLine();int i = s.IndexOf('@');string b = s.Substring(0, i);Console.WriteLine(b);//Console.ReadLine();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1130 {class Program {static void Main(string[] args) {string[] s;int[,] a = new int[5, 5];int max = -100000000, ii = 0, jj = 0;for (int i = 0; i < 4; i++) {s = Console.ReadLine().Split();for (int j = 0; j < 3; j++) {a[i, j] = int.Parse(s[j]);if (a[i, j] > max) {max = a[i, j];ii = i;jj = j;}}}Console.WriteLine("{0} {1} {2}", max, ii, jj);//Console.ReadLine();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1131 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());int a = 2, b = 1;double sum = 0;for (int i = 0; i < n; i++) {sum += a * 1.0 / b;int c = a;a = a + b;b = c;}Console.WriteLine(sum.ToString("0.000"));//Console.ReadLine();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1132 {class Program {static void Main(string[] args) {string[] s = Console.ReadLine().Split();double[] a = new double[3];for (int i = 0; i < 3; i++)a[i] = double.Parse(s[i]);Array.Sort(a);if (a[2] - a[0] >= a[1])Console.WriteLine("Input error!");else {double b = (a[0] + a[1] + a[2]) / 2;double c = Math.Sqrt(b * (b - a[0]) * (b - a[1]) * (b - a[2]));Console.WriteLine(c.ToString("0.00"));}//Console.ReadLine();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1133 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());int x = (int)Math.Sqrt(n * 1.0);if (x * x == n)Console.WriteLine(n);else {if (Math.Abs((x + 1) * (x + 1) - n) < Math.Abs((x) * (x) - n))//这里比较的是n和n+1Console.WriteLine((x + 1) * (x + 1));elseConsole.WriteLine((x) * (x));}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1134 {class Program {static bool prime(int n) {if (n == 1) return false;if (n == 2) return true;for (int i = 2; i * i <= n; i++)if (n % i == 0)return false;return true;}static void Main(string[] args) {string[] s = Console.ReadLine().Split();int[] a = new int[2];int n = int.Parse(s[0]), m = int.Parse(s[1]);int count = 0;for (int i = n; i <= m; i++)if (prime(i))count++;Console.WriteLine(count);}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1135 {class Program {static void Main(string[] args) {string s = Console.ReadLine();for (int i = s.Length - 1; i >= 0; i--)Console.Write(s[i]);Console.WriteLine();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1136 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());for (int i = 1; i <= n; i++) {if (i % 7 == 0 || i % 10 == 7 || i / 10 % 10 == 7 || i / 100 % 10 == 7)Console.WriteLine(i);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1137 {class Program {static void Main(string[] args) {Console.WriteLine("Happy new year \"2014\"");}}}
1138 游程编码
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1139 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {string[] s = Console.ReadLine().Split();int a = int.Parse(s[0]), b = int.Parse(s[1]);Console.WriteLine((a + b) * (a + b + 1) / 2 + a + 1);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1140 {/// <summary>/// 这道题就是千万不要想太多,数据不难,这题和连接电脑那题差不多/// </summary>class Program {static void Main(string[] args) {string[] s = Console.ReadLine().Split();int n = int.Parse(s[0]), m = int.Parse(s[1]);string[] b = Console.ReadLine().Split();int[] a = new int[205];int count = 1;a[int.Parse(b[0])] = count;a[int.Parse(b[1])] = count;for (int i = 1; i < m; i++) {string[] sb = Console.ReadLine().Split();int p = int.Parse(sb[0]), q = int.Parse(sb[1]);if (a[p] != 0) a[q] = count;else {count++;a[p] = count;a[q] = a[p];}}Console.WriteLine(count);}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1141 {class Program {static void Main(string[] args) {int t = int.Parse(Console.ReadLine());while (t-- > 0) {string[] a = Console.ReadLine().Split();long n = long.Parse(a[0]), m = long.Parse(a[1]);long sum = 0;for (int i = 1; i <= n; i++)sum += i % m;Console.WriteLine(sum);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1142 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {string[] s = Console.ReadLine().Split();string a = s[0], b = s[1];int[] p = new int[26], q = new int[26];for (int i = 0; i < a.Length; i++) {p[a[i] - 'a']++;}for (int i = 0; i < b.Length; i++) {q[b[i] - 'a']++;}bool flag = true;for (int i = 0; i < 26; i++) {if ((p[i] == 0 && q[i] != 0) || (p[i] != 0 && q[i] == 0)) flag = false;}if (flag)Console.WriteLine("Yes");elseConsole.WriteLine("No");}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1143 {class Program {static void Main(string[] args) {int[] a = new int[10005];a[0] = 1;for (int i = 1; i < 10001; i++)a[i] = a[i - 1] + 2 * (i - 1);int n = int.Parse(Console.ReadLine());while (n-- > 0) {int x = int.Parse(Console.ReadLine());Console.WriteLine(a[x]);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1144 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());int[] a = new int[1001], b = new int[1001];double[] k = new double[1001];for (int i = 0; i < n; i++) {string[] sb = Console.ReadLine().Split();a[i] = int.Parse(sb[0]);b[i] = int.Parse(sb[1]);k[i] = 1.0 * a[i] / b[i];}Array.Sort(k, 0, n);int count = 1, max = 0;for (int i = 1; i < n; i++) {if (k[i] == k[i - 1]) {count++;if (count > max)max = count;} else count = 1;}Console.WriteLine(max);}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1145 {class Program {static void Main(string[] args) {Console.WriteLine("I am an \"ACMer\", I love \"ACM\".");//Console.ReadKey();}}}
1146 结义兄弟
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1147 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {int m = int.Parse(Console.ReadLine());int[] a = new int[10];int max = 0, len = (int)Math.Log10(m * 1.0) + 1, i, j, s;//Console.WriteLine(len);max = m / 10;for (i = len - 1; i >= 0; i--) {a[i] = m % 10;m /= 10;}for (i = 0; i < len; i++)//删除第i位,然后把这个数与max比较,遍历一遍得最大值{s = 0;for (j = 0; j < len; j++) {if (i == j) continue;s = s * 10 + a[j];}if (s > max) max = s;}Console.WriteLine(max);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1148 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {long x = long.Parse(Console.ReadLine());Console.WriteLine("{0}471", x - 1);}}}}
1149 光棍节的快乐
1150 寻找最大数
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1151 {class Program {static int fun(int n, int d)//整数转化为d进制的各个位之和{int sum = 0, a;while (n > 0) {a = n % d;sum += a;n /= d;}return sum;}static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {int n = int.Parse(sb);if (n == 0) break;if (fun(n, 10) == fun(n, 12) && fun(n, 12) == fun(n, 16))Console.WriteLine("{0} is a Sky Number.", n);elseConsole.WriteLine("{0} is not a Sky Number.", n);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1152 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();long a = long.Parse(s[0]), b = long.Parse(s[1]);Console.WriteLine(a / b);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1153 {class Program {static int erfen(int n, int p) {int a = n;int b = p;int result = 1;while (b != 0) {if (b % 2 == 1) {result = (result * a) % 10003; //乘一个a,也就是i}a = (a * a) % 10003; //平方b /= 2; //把这个数截一半}return result;}static void Main(string[] args) {int t = int.Parse(Console.ReadLine());while (t-- > 0) {string[] sb = Console.ReadLine().Split();int n = int.Parse(sb[0]), p = int.Parse(sb[1]);int sum = 0;for (int i = 1; i <= n; i++)sum = (sum + erfen(i, p)) % 10003;Console.WriteLine(sum);}}}}
1154 算菜价
1155 Problem of IP
1156 分数加减法
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1157 {class Program {static void Main(string[] args) {string s;while ((s = Console.ReadLine()) != null) {int n = int.Parse(s);while (n-- > 0) {string sb = Console.ReadLine();Console.WriteLine(sb);}}}}}
1158 关于521
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1159 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {for (int i = 0; i < sb.Length; i++) {if (sb[i] == 'a' || sb[i] == 'b' || sb[i] == 'c') Console.Write("2");if (sb[i] == 'd' || sb[i] == 'e' || sb[i] == 'f') Console.Write("3");if (sb[i] == 'g' || sb[i] == 'h' || sb[i] == 'i') Console.Write("4");if (sb[i] == 'j' || sb[i] == 'k' || sb[i] == 'l') Console.Write("5");if (sb[i] == 'm' || sb[i] == 'n' || sb[i] == 'o') Console.Write("6");if (sb[i] == 'p' || sb[i] == 'p' || sb[i] == 'r' || sb[i] == 's') Console.Write("7");if (sb[i] == 't' || sb[i] == 'u' || sb[i] == 'v') Console.Write("8");if (sb[i] == 'w' || sb[i] == 'x' || sb[i] == 'y' || sb[i] == 'z') Console.Write("9");}Console.WriteLine();}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1160 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int n = int.Parse(s[0]), m = int.Parse(s[1]);if (n + m == 0) break;string[] b = Console.ReadLine().Split();int[] count = new int[1100];for (int i = 0; i < n; i++)count[i] = int.Parse(b[i]);Array.Sort(count, 0, n);for (int i = n - 1; i >= n - m; i--)Console.Write(count[i] + " ");Console.WriteLine();}}}}
1161 路径打印
1162 计算表达式
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1163 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {if (sb.Equals("E")) break;int a = 0, o = 0, j = 0;for (int i = 0; i < sb.Length; i++) {if (sb[i] == 'A')a++;if (sb[i] == 'O')o++;if (sb[i] == 'J')j++;}while (a > 0 && o > 0 && j > 0) {Console.Write("AOJ");a--;o--;j--;}while (a > 0 && o > 0) {Console.Write("AO");a--;o--;}while (a > 0 && j > 0) {Console.Write("AJ");a--;j--;}while (o > 0 && j > 0) {Console.Write("OJ");o--;j--;}while (a > 0) {Console.Write("A");a--;}while (o > 0) {Console.Write("O");o--;}while (j > 0) {Console.Write("J");j--;}Console.WriteLine();}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1164 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();double[] a = new double[3];a[0] = double.Parse(s[0]);a[1] = double.Parse(s[1]);a[2] = double.Parse(s[2]);Array.Sort(a, 0, 3);if (a[0] * a[0] + a[1] * a[1] < a[2] * a[2])//钝角三角形Console.WriteLine("Obtuse Triangle");if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2])//直角三角形Console.WriteLine("Rect Triangle");if (a[0] * a[0] + a[1] * a[1] > a[2] * a[2])//锐角三角形Console.WriteLine("Actue Triangle");}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1165 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int a = int.Parse(s[0]), b = int.Parse(s[1]);int c = 0, sum1 = 0, sum2 = 0;for (int i = 1; i <= a; i++)sum1 += i;for (int n = 1; n <= b; n++)sum2 += n;c = sum1 * sum2;Console.WriteLine(c);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1166 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int n = int.Parse(s[0]);if (n == 0) break;int[] a = new int[105];int min = 100000000, x = 0;for (int i = 1; i <= n; i++) {a[i] = int.Parse(s[i]);if (a[i] < min) { min = a[i]; x = i; }}a[x] = a[1];a[1] = min;for (int i = 1; i <= n; i++)Console.Write(a[i] + " ");Console.WriteLine();}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1167 {class Program {static int max(int a, int b, int c) {int max = a;if (b > max) max = b;if (c > max) max = c;return max;}static int min(int a, int b, int c) {int min = a;if (b < min) min = b;if (c < min) min = c;return min;}static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {int n = int.Parse(sb);int[] a = new int[11000];string[] s = Console.ReadLine().Split();for (int i = 0; i < n; i++)a[i] = int.Parse(s[i]);int x, maxx = -100000000;for (int i = 0; i < n - 2; i += 3) {if ((i / 3) % 2 == 0)//奇数组求最大x = max(a[i], a[i + 1], a[i + 2]);else//偶数组求最小x = min(a[i], a[i + 1], a[i + 2]);if (x > maxx) maxx = x;//找最大}Console.WriteLine(maxx);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1168 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {int h = int.Parse(Console.ReadLine());if (h <= 10) Console.WriteLine("1");else {if (h % 5 == 0)Console.WriteLine(h / 5 - 1);elseConsole.WriteLine(h / 5);}}}}}
1169 车牌号
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1170 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {string a = Console.ReadLine();if (a.Length % 2 == 1) { Console.WriteLine(a.Length); continue; }int count = a.Length;bool flag = true;while (count % 2 != 1) {for (int i = 0, j = count - 1; i < count / 2; i++, j--) {if (a[i] == a[j]) continue;else flag = false;}if (flag) count = count / 2;//如果对半比较都一样,折半else { Console.WriteLine(count); break; }//否则输出长度}if (flag) Console.WriteLine(count);//如果最后是1了,输出}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1171 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {string s = Console.ReadLine();int r = 0, w = 0, b = 0;for (int i = 0; i < s.Length; i++) {if (s[i] == 'R') r++;if (s[i] == 'W') w++;if (s[i] == 'B') b++;}for (int i = 0; i < r; i++)Console.Write("R");for (int i = 0; i < w; i++)Console.Write("W");for (int i = 0; i < b; i++)Console.Write("B");Console.WriteLine();}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1172 {/// <summary>/// 实际上这题就是简单的结构体排序,但是这样写也可以/// </summary>class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {int m = int.Parse(Console.ReadLine());int[] a = new int[1001], b = new int[1001], c = new int[1001];for (int i = 0; i < m; i++) {string[] sb = Console.ReadLine().Split();a[i] = int.Parse(sb[0]);b[i] = int.Parse(sb[1]);c[i] = int.Parse(sb[2]);}int max = 0, min = 1000000, mmax = 0;for (int i = 0; i < m; i++) if (a[i] > max) max = a[i];//先找到最长的for (int j = 0; j < m; j++) if (a[j] == max && b[j] < min) min = b[j];//然后找到最长中的最细的for (int i = 0; i < m; i++) if (a[i] == max && b[i] == min && c[i] > mmax) mmax = c[i];//然后找到最长中的最细的编码最大的Console.WriteLine(mmax);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1173 {class Program {static void Main(string[] args) {string[] sb = Console.ReadLine().Split();int n = int.Parse(sb[0]), k = int.Parse(sb[1]);if (2 * n % k == 0) Console.WriteLine(2 * n / k);//总共2n面,如果可以整除else Console.WriteLine(2 * n / k + 1);//不能整除+1}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1174 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {int a = int.Parse(Console.ReadLine());double pi = 3.1415926;double sb = a * a * pi / 3;Console.WriteLine(sb.ToString("0.00"));}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1175 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {string sb = Console.ReadLine();int count = 0;for (int i = 0; i < sb.Length; i++)if (sb[i] >= 'a' && sb[i] <= 'z')count++;count %= 26;if (count == 0) Console.WriteLine("z");else Console.WriteLine((char)(count + 'a' - 1));}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1177 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int[] a = new int[6];for (int i = 0; i < 6; i++)a[i] = int.Parse(s[i]);if (a[0] + a[1] + a[2] + a[3] + a[4] + a[5] == 0) break;double b = Math.Sqrt((a[3] - a[1]) * (a[3] - a[1]) + (a[2] - a[0]) * (a[2] - a[0]));double c = Math.Sqrt((a[5] - a[3]) * (a[5] - a[3]) + (a[4] - a[2]) * (a[4] - a[2]));double d = Math.Sqrt((a[5] - a[1]) * (a[5] - a[1]) + (a[4] - a[0]) * (a[4] - a[0]));double q = (b + c + d) / 2;double area = Math.Sqrt(q * (q - b) * (q - c) * (q - d));Console.WriteLine(area.ToString("0.0"));}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1178 {class Program {static bool prime(int n) {if (n == 0 || n == 1) return false;if (n == 2) return true;for (int i = 2; i * i <= n; i++)if (n % i == 0)return false;return true;}static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {string sb = Console.ReadLine();int max = -1, min = 10000;int[] a = new int[27];for (int i = 0; i < sb.Length; i++)a[sb[i] - 'a']++;for (int i = 0; i < 26; i++) {if (a[i] > max && a[i] != 0) max = a[i];if (a[i] < min && a[i] != 0) min = a[i];}if (prime(max - min)) {Console.WriteLine("Lucky Word");Console.WriteLine(max - min);} else {Console.WriteLine("No Answer");Console.WriteLine("0");}}}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1178 {class Program {static bool prime(int n) {if (n == 0 || n == 1) return false;if (n == 2) return true;for (int i = 2; i * i <= n; i++)if (n % i == 0)return false;return true;}static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {string sb = Console.ReadLine();int max = -1, min = 10000;int[] a = new int[27];for (int i = 0; i < sb.Length; i++)a[sb[i] - 'a']++;for (int i = 0; i < 26; i++) {if (a[i] > max && a[i] != 0) max = a[i];if (a[i] < min && a[i] != 0) min = a[i];}if (prime(max - min)) {Console.WriteLine("Lucky Word");Console.WriteLine(max - min);} else {Console.WriteLine("No Answer");Console.WriteLine("0");}}}}}
1179 N!
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1180 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int[] a = new int[6];for (int i = 0; i < 6; i++) a[i] = int.Parse(s[i]);if (a[0] + a[1] + a[2] + a[3] + a[4] + a[5] == 0) break;//2-0 * 5-1 - 3-1 * 4-0if ((a[2] - a[0]) * (a[5] - a[1]) - (a[3] - a[1]) * (a[4] - a[0]) > 0)Console.WriteLine("0");elseConsole.WriteLine("1");}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1181 {/// <summary>/// 也是RE,不知道测试数据是一行在一起的,还是一行一个/// 第二下AC了/// </summary>class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();long n = 0;for (int k = 0; k < s.Length; k++)//这种写法不管是一行一个还是一行多个都可以处理,what's a fuck{n = long.Parse(s[k]);if (n == 0) Console.WriteLine("0");else {long[] a = new long[105];int i = 0;while (n > 0) {a[i++] = n % 2;n /= 2;}int satrt = 0;for (int j = i - 1; j >= 0; j--) if (a[j] != 0) { satrt = j; break; }for (int j = satrt; j >= 0; j--)Console.Write(a[j]);Console.WriteLine();}}}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1182 {class Program {static void solve(int a, int b) {int[] s = new int[1001];bool flag = false;for (int i = 1; i <= a / 2; i++) {s[i] = i * (a - i);if (s[i] == b) {Console.WriteLine("YES");flag = true;break;}}if (!flag)Console.WriteLine("NO");}static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int a = int.Parse(s[0]), b = int.Parse(s[1]);if (a + b == 0) break;solve(a, b);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1183 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();long a = long.Parse(s[0]), b = long.Parse(s[1]);Console.WriteLine(a / b);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1184 {class Program {static void Main(string[] args) {int n = int.Parse(Console.ReadLine());while (n-- > 0) {string s = Console.ReadLine();int[] a = new int[3];for (int i = 0; i < 3; i++)a[i] = s[i] - 'a';Array.Sort(a);Console.WriteLine("{0} {1} {2}", (char)(a[2] + 'a'), (char)(a[1] + 'a'), (char)(a[0] + 'a'));}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1185 {class Program {static void Main(string[] args) {int t = int.Parse(Console.ReadLine());while (t-- > 0) {int n = int.Parse(Console.ReadLine());int count = 1;while (n != 6174) {int[] a = new int[4];int j = 0;while (n > 0) {a[j++] = n % 10;n /= 10;}Array.Sort(a, 0, 4);int min = a[0] * 1000 + a[1] * 100 + a[2] * 10 + a[3];int max = a[3] * 1000 + a[2] * 100 + a[1] * 10 + a[0];n = max - min;count++;}Console.WriteLine(count);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1186 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int m = int.Parse(s[0]), n = int.Parse(s[1]);if (m + n == 0) break;int a = m / 100;int b = m / 10 % 10;int c = m % 10;int x = n / 100;int y = n / 10 % 10;int z = n % 10;int i = 0;if ((c + z) >= 10) { i++; b++; }if ((b + y) >= 10) { i++; a++; }if ((a + x) >= 10) { i++; }Console.WriteLine(i);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1187 {class Program {static void Main(string[] args) {string[] sb = Console.ReadLine().Split();int n = int.Parse(sb[0]), k = int.Parse(sb[1]);int[] a = new int[1001];int i, j;for (i = 1; i <= k; i++) {for (j = i; j <= n; j += i) {if (a[j] == 0)a[j] = 1;//0代表关,1代表开elsea[j] = 0;}}for (i = 1; i <= n; i++)if (a[i] == 1)Console.Write(i + " ");Console.WriteLine();}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1188 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {int n = int.Parse(sb);if (n == 0) break;else {string[] s = Console.ReadLine().Split();int[] a = new int[10005];for (int i = 0; i < n; i++)a[i] = int.Parse(s[i]);Array.Sort(a, 0, n);if (n % 2 == 1)Console.WriteLine(a[n / 2]);elseConsole.WriteLine(Math.Floor((a[n / 2] + a[n / 2 - 1] * 1.0) / 2));}}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1189 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string s = Console.ReadLine();for (int i = 0; i < sb.Length; i++)if (sb[i] != s[0])Console.Write(sb[i]);Console.WriteLine();}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1190 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {int n = int.Parse(sb);int[] a = new int[n];string[] s = Console.ReadLine().Split();for (int i = 0; i < n; i++) a[i] = int.Parse(s[i]);int x = int.Parse(Console.ReadLine());bool flag = true;for(int i=0;i<n;i++)if (a[i] == x) {flag = false;Console.WriteLine(i);break;}if (flag) Console.WriteLine("-1");}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1191 {class Program {static void Main(string[] args) {int[] ans = new int[10005];ans[0] = 1; ans[1] = 2; ans[2] = 0; ans[3] = 2;for (int i = 4; i <= 10000; i++)ans[i] = ans[i / 2] + 1;string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int a = int.Parse(s[0]), b = int.Parse(s[1]);int sum = 0;for (int i = a; i <= b; i++)sum += ans[i];Console.WriteLine(sum);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1192 {class Program {static long f(long n) {if (n == 0) return 0;long[] s = new long[40];long i = 0;while (n > 0) {//二进制转换s[i++] = n % 2;n /= 2;}int count = 1, x = 1;for (int j = 1; j < i; j++) {if (s[j] == 1 && s[j - 1] == 1) count++;if (count > x) x = count;//找到最长的1if (s[j] != s[j - 1]) count = 0;//置零}return x;}static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();long a = long.Parse(s[0]), b = long.Parse(s[1]);if (f(a) > f(b)) Console.WriteLine("fat");else if (f(a) == f(b)) Console.WriteLine("fat and thin");else Console.WriteLine("thin");}}}}//找到最长的1
1193 小周的种田梦
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1194 {class Program {static void Main(string[] args) {int t = int.Parse(Console.ReadLine());while (t-- > 0) {string[] s = Console.ReadLine().Split();int n = int.Parse(s[0]), a = int.Parse(s[1]), b = int.Parse(s[2]);int[] ans = new int[105];string[] sb = Console.ReadLine().Split();for (int i = 1; i < n; i++)ans[i] = int.Parse(sb[i-1]);int sum = 0;if (a > b) { int temp = a; a = b; b = temp; }for (int i = a; i < b; i++)sum += ans[i];Console.WriteLine(sum);}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1195 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {int n = int.Parse(sb);while (n-- > 0) {string[] s = Console.ReadLine().Split();int y = int.Parse(s[0]), m = int.Parse(s[1]), d = int.Parse(s[2]);if (y == 2014 && m == 4 && d == 20) Console.WriteLine("nice day");else if (y < 2014 || (y == 2014 && m < 4) || (y == 2014 && m == 4 && d < 20))Console.WriteLine("before");else Console.WriteLine("after");}}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1196 {class Program {static void Main(string[] args) {string s;while ((s = Console.ReadLine()) != null) {int n = int.Parse(s);while (n-- > 0) {string[] a = Console.ReadLine().Split();for (int i = 0; i < a.Length; i++)Console.Write(a[i]);Console.WriteLine();}}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1197 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int[] a = new int[4];for (int i = 0; i < 4; i++)a[i] = int.Parse(s[i]);Array.Sort(a, 0, 4);if (a[0] + a[1] + a[2] < 13)Console.WriteLine("good luck");elseConsole.WriteLine("oh no");}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1198 {class Program {static long fun(long n) {long f;if (n == 2)f = 1;else if (n == 3)f = 2;else f = (n - 1) * (fun(n - 2) + fun(n - 1));return f;}static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {long n = long.Parse(sb);Console.WriteLine(fun(n));}}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace AK1199 {class Program {static void Main(string[] args) {string sb;while ((sb = Console.ReadLine()) != null) {string[] s = sb.Split();int n = int.Parse(s[0]), k = int.Parse(s[1]);string[] b = Console.ReadLine().Split();int[] a = new int[10005];for (int i = 0; i < n; i++)a[i] = int.Parse(b[i]);Array.Sort(a, 0, n);Console.WriteLine(a[n - k]);}}}}