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;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
for (int first = 0; first < 10; first++) {
for (int second = 0; second < 10; second++) {
Console.WriteLine(first.ToString() + "x" + second.ToString() + "=" +
(first * second).ToString());
}
}
}
}
}
|
using System;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
for (int first = 1; first < 10; first++) {
for (int second = 1; second < 10; second++) {
Console.WriteLine(first.ToString() + "x" + second.ToString() + "=" +
(first * second).ToString());
}
}
}
}
}
|
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
| 8
| 89
| 4
|
using System;
class calc {
static void Main() {
int i, j;
for (i = 0; i < 10; i++) {
for (j = 1; j < 10; j++) {
Console.WriteLine("{0}x{1}={2}", i, j, i * j);
}
}
}
}
|
using System;
class calc {
static void Main() {
int i, j;
for (i = 1; i < 10; i++) {
for (j = 1; j < 10; j++) {
Console.WriteLine("{0}x{1}={2}", i, j, i * j);
}
}
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 10, 11, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 10, 11, 12, 203]]
| 8
| 66
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace contest {
class Program {
static void Main(string[] args) {
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
Console.WriteLine("{0}x{1}={2}", x, y, x * y);
}
}
Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace contest {
class Program {
static void Main(string[] args) {
for (int x = 1; x < 10; x++) {
for (int y = 1; y < 10; y++) {
Console.WriteLine("{0}x{1}={2}", x, y, x * y);
}
}
Console.ReadKey();
}
}
}
|
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
| 8
| 94
| 4
|
public class Hello {
public static void Main() {
int f = 0;
int s = 0;
int t = 0;
for (int i = 0; i < 10; i++) {
int height = int.Parse(System.Console.ReadLine());
if (t > height) {
t = height;
}
if (s > height) {
t = s;
s = height;
}
if (f > height) {
s = f;
f = height;
}
}
System.Console.WriteLine(f.ToString());
System.Console.WriteLine(s.ToString());
System.Console.WriteLine(t.ToString());
}
}
|
public class Hello {
public static void Main() {
int f = 0;
int s = 0;
int t = 0;
for (int i = 0; i < 10; i++) {
int height = int.Parse(System.Console.ReadLine());
if (t < height) {
t = height;
}
if (s < height) {
t = s;
s = height;
}
if (f < height) {
s = f;
f = height;
}
}
System.Console.WriteLine(f.ToString());
System.Console.WriteLine(s.ToString());
System.Console.WriteLine(t.ToString());
}
}
|
[["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 18]]
| 8
| 143
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program {
static void Main(string[] args) {
var inputs = new int[10];
foreach (var i in Enumerable.Range(0, 9)) {
inputs[i] = int.Parse(Console.ReadLine());
}
foreach (var x in inputs.OrderByDescending(x => x).Take(3)) {
Console.WriteLine(x);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program {
static void Main(string[] args) {
var inputs = new int[10];
foreach (var i in Enumerable.Range(0, inputs.Length)) {
inputs[i] = int.Parse(Console.ReadLine());
}
foreach (var x in inputs.OrderByDescending(x => x).Take(3)) {
Console.WriteLine(x);
}
}
}
|
[["-", 0, 210, 12, 213, 3, 4, 0, 28, 0, 203], ["+", 12, 213, 3, 4, 0, 28, 0, 214, 205, 22], ["+", 12, 213, 3, 4, 0, 28, 0, 214, 0, 131], ["+", 12, 213, 3, 4, 0, 28, 0, 214, 141, 22]]
| 8
| 104
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp15 {
public class Program {
static void Main(string[] args) {
List<int> b = new List<int>();
for (int f = 0; f < 10; f++) {
int a = int.Parse(Console.ReadLine());
b.Add(a);
}
b.Sort();
Console.Write(b[7] + "\n");
Console.Write(b[8] + "\n");
Console.Write(b[9] + "\n");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp15 {
public class Program {
static void Main(string[] args) {
List<int> b = new List<int>();
for (int f = 0; f < 10; f++) {
int a = int.Parse(Console.ReadLine());
b.Add(a);
}
b.Sort();
Console.Write(b[9] + "\n");
Console.Write(b[8] + "\n");
Console.Write(b[7] + "\n");
}
}
}
|
[["-", 0, 16, 31, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 16, 31, 204, 206, 207, 0, 28, 0, 203]]
| 8
| 139
| 4
|
using System;
namespace practise {
class Program {
static void Main(string[] args) {
int[] num = new int[10];
for (int i = 1; i < num.Length; i++) {
num[i] = int.Parse(Console.ReadLine());
}
Array.Sort(num);
Array.Reverse(num);
for (int j = 0; j < 3; j++) {
Console.WriteLine(num[j]);
}
}
}
}
|
using System;
namespace practise {
class Program {
static void Main(string[] args) {
int[] num = new int[10];
for (int i = 0; i < num.Length; i++) {
num[i] = int.Parse(Console.ReadLine());
}
Array.Sort(num);
Array.Reverse(num);
for (int j = 0; j < 3; j++) {
Console.WriteLine(num[j]);
}
}
}
}
|
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
| 8
| 107
| 2
|
using System;
class yama {
static void Main() {
int[] a = new int[10];
int[] b = new int[3];
for (int i = 0; i < 10; i++) {
a[i] = int.Parse(Console.ReadLine());
for (int j = 0; j < 3; j++) {
if (b[j] <= a[i]) {
if (j == 0) {
b[j + 2] = b[j + 1];
b[j + 1] = b[j];
b[j] = a[i];
goto stop;
}
if (j == 1) {
b[j + 1] = b[j];
b[j] = a[i];
}
if (j == 2) {
b[j] = a[i];
}
}
}
stop:;
}
for (int i = 0; i < 3; i++) {
Console.WriteLine(b[i]);
}
}
}
|
using System;
class yama {
static void Main() {
int[] a = new int[10];
int[] b = new int[3];
for (int i = 0; i < 10; i++) {
a[i] = int.Parse(Console.ReadLine());
for (int j = 0; j < 3; j++) {
if (b[j] <= a[i]) {
if (j == 0) {
b[j + 2] = b[j + 1];
b[j + 1] = b[j];
b[j] = a[i];
goto stop;
}
if (j == 1) {
b[j + 1] = b[j];
b[j] = a[i];
goto stop;
}
if (j == 2) {
b[j] = a[i];
goto stop;
}
}
}
stop:;
}
for (int i = 0; i < 3; i++) {
Console.WriteLine(b[i]);
}
}
}
|
[["+", 64, 196, 0, 57, 64, 196, 0, 126, 0, 127], ["+", 64, 196, 0, 57, 64, 196, 0, 126, 0, 22], ["+", 64, 196, 0, 57, 64, 196, 0, 126, 0, 35], ["+", 64, 196, 0, 57, 64, 196, 0, 1, 0, 35]]
| 8
| 222
| 6
|
using System;
public class Program {
public static void Main() {
int[] a = new int[9];
for (int i = 0; i < 10; i++)
a[i] = int.Parse(Console.ReadLine());
Array.Sort(a);
for (int i = 9; i > 6; i--)
Console.WriteLine(a[i]);
}
}
|
using System;
public class Program {
public static void Main() {
int[] a = new int[10];
for (int i = 0; i < 10; i++)
a[i] = int.Parse(Console.ReadLine());
Array.Sort(a);
for (int i = 9; i > 6; i--)
Console.WriteLine(a[i]);
}
}
|
[["-", 0, 212, 0, 227, 39, 224, 225, 226, 0, 203], ["+", 0, 212, 0, 227, 39, 224, 225, 226, 0, 203]]
| 8
| 88
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _0066 {
class Program {
static void Main(string[] args) {
const int gridSize = 3 * 3;
int[][] winRowIndexs = { new int[] { 0, 1, 2 }, new int[] { 3, 4, 5 },
new int[] { 6, 7, 8 },
new int[] { 0, 3, 6 }, new int[] { 1, 4, 7 },
new int[] { 2, 5, 8 },
new int[] { 0, 4, 8 }, new int[] { 2, 4, 6 } };
const char drowJudge = 'd';
const char winOSide = 'o';
const char winXSide = 'x';
while (true) {
var grid = Console.ReadLine();
if (grid == null || grid.Length != gridSize)
break;
var result = drowJudge;
foreach (var winRowIndex in winRowIndexs) {
if (grid[winRowIndex[0]] != grid[winRowIndex[1]] ||
grid[winRowIndex[0]] != grid[winRowIndex[2]]) {
continue;
}
if (grid[winRowIndex[0]] != winOSide ||
grid[winRowIndex[0]] != winXSide) {
continue;
}
result = grid[winRowIndex[0]];
break;
}
Console.WriteLine(result);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _0066 {
class Program {
static void Main(string[] args) {
const int gridSize = 3 * 3;
int[][] winRowIndexs = { new int[] { 0, 1, 2 }, new int[] { 3, 4, 5 },
new int[] { 6, 7, 8 },
new int[] { 0, 3, 6 }, new int[] { 1, 4, 7 },
new int[] { 2, 5, 8 },
new int[] { 0, 4, 8 }, new int[] { 2, 4, 6 } };
const char drowJudge = 'd';
const char winOSide = 'o';
const char winXSide = 'x';
while (true) {
var grid = Console.ReadLine();
if (grid == null || grid.Length != gridSize)
break;
var result = drowJudge;
foreach (var winRowIndex in winRowIndexs) {
if (grid[winRowIndex[0]] != grid[winRowIndex[1]] ||
grid[winRowIndex[0]] != grid[winRowIndex[2]]) {
continue;
}
if (grid[winRowIndex[0]] != winOSide &&
grid[winRowIndex[0]] != winXSide) {
continue;
}
result = grid[winRowIndex[0]];
break;
}
Console.WriteLine(result);
}
}
}
}
|
[["-", 0, 210, 8, 196, 0, 57, 15, 16, 17, 106], ["+", 0, 210, 8, 196, 0, 57, 15, 16, 17, 98]]
| 8
| 302
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _071_BombsChain {
class Program {
const char Bomb = '1';
const char Nothing = '0';
const int Width = 8;
const int Height = 8;
static void Main(string[] args) {
int dataCount = int.Parse(Console.ReadLine());
char[][] map = new char [Height][];
StringBuilder output = new StringBuilder(80 * dataCount);
for (int i = 1; i <= dataCount; i++) {
// input
// delete space
string space = Console.ReadLine();
space = space.Trim();
for (int lp = 0; lp < Height; lp++) {
map[lp] = Console.ReadLine().ToCharArray();
}
int x = int.Parse(Console.ReadLine());
int y = int.Parse(Console.ReadLine());
// process
Queue<Vector> bombPoint = new Queue<Vector>(10);
bombPoint.Enqueue(new Vector(x - 1, y - 1));
do {
Vector item = bombPoint.Dequeue();
// bomb delete
map[item.Y][item.X] = Nothing;
// search bomb
// top
for (int top = item.Y - 1; top > item.Y - 1 - 3; top--) {
if (0 <= top) {
if (map[top][item.X] == Bomb) {
bombPoint.Enqueue(new Vector(item.X, top));
}
} else {
break;
}
}
// left
for (int left = item.X - 1; left > item.X - 1 - 3; left--) {
if (0 <= left) {
if (map[item.Y][left] == Bomb) {
bombPoint.Enqueue(new Vector(left, item.Y));
}
} else {
break;
}
}
// right
for (int right = item.X + 1; right < item.X + 1 + 3; right++) {
if (right < Width) {
if (map[item.Y][right] == Bomb) {
bombPoint.Enqueue(new Vector(right, item.Y));
}
} else {
break;
}
}
// buttom
for (int buttom = item.Y + 1; buttom < item.Y + 1 + 3; buttom++) {
if (buttom < Height) {
if (map[buttom][item.X] == Bomb) {
bombPoint.Enqueue(new Vector(item.X, buttom));
}
} else {
break;
}
}
} while (bombPoint.Count != 0);
output.Append("Data " + i);
output.AppendLine();
for (int lp = 0; lp < Width; lp++) {
output.Append(map[lp]);
output.AppendLine();
}
}
// output
Console.Write(output);
}
}
class Vector {
public Vector(int x, int y) {
this.X = x;
this.Y = y;
}
public int X { private set; get; }
public int Y { private set; get; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _071_BombsChain {
class Program {
const char Bomb = '1';
const char Nothing = '0';
const int Width = 8;
const int Height = 8;
static void Main(string[] args) {
int dataCount = int.Parse(Console.ReadLine());
char[][] map = new char [Height][];
StringBuilder output = new StringBuilder(80 * dataCount);
for (int i = 1; i <= dataCount; i++) {
// input
// delete space
string space = Console.ReadLine();
space = space.Trim();
for (int lp = 0; lp < Height; lp++) {
map[lp] = Console.ReadLine().ToCharArray();
}
int x = int.Parse(Console.ReadLine());
int y = int.Parse(Console.ReadLine());
// process
Queue<Vector> bombPoint = new Queue<Vector>(10);
bombPoint.Enqueue(new Vector(x - 1, y - 1));
do {
Vector item = bombPoint.Dequeue();
// bomb delete
map[item.Y][item.X] = Nothing;
// search bomb
// top
for (int top = item.Y - 1; top > item.Y - 1 - 3; top--) {
if (0 <= top) {
if (map[top][item.X] == Bomb) {
bombPoint.Enqueue(new Vector(item.X, top));
}
} else {
break;
}
}
// left
for (int left = item.X - 1; left > item.X - 1 - 3; left--) {
if (0 <= left) {
if (map[item.Y][left] == Bomb) {
bombPoint.Enqueue(new Vector(left, item.Y));
}
} else {
break;
}
}
// right
for (int right = item.X + 1; right < item.X + 1 + 3; right++) {
if (right < Width) {
if (map[item.Y][right] == Bomb) {
bombPoint.Enqueue(new Vector(right, item.Y));
}
} else {
break;
}
}
// buttom
for (int buttom = item.Y + 1; buttom < item.Y + 1 + 3; buttom++) {
if (buttom < Height) {
if (map[buttom][item.X] == Bomb) {
bombPoint.Enqueue(new Vector(item.X, buttom));
}
} else {
break;
}
}
} while (bombPoint.Count != 0);
output.Append("Data " + i + ":");
output.AppendLine();
for (int lp = 0; lp < Width; lp++) {
output.Append(map[lp]);
output.AppendLine();
}
}
// output
Console.Write(output);
}
}
class Vector {
public Vector(int x, int y) {
this.X = x;
this.Y = y;
}
public int X { private set; get; }
public int Y { private set; get; }
}
}
|
[["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72], ["+", 3, 4, 0, 28, 0, 16, 12, 5, 0, 62], ["+", 3, 4, 0, 28, 0, 16, 12, 5, 0, 222]]
| 8
| 659
| 4
|
using System;
using System.Text;
using System.Collections.Generic;
namespace AOJ2 {
class Program {
class Point {
public int x { get; set; }
public int y { get; set; }
public Point() {
this.x = 0;
this.y = 0;
}
public Point(int x, int y) {
this.x = x;
this.y = y;
}
}
static void Main(string[] args) {
List<bool[,]> resultList = new List<bool[,]>();
int num = int.Parse(Console.ReadLine());
for (int i = 0; i < num; i++) {
Console.ReadLine();
bool[,] mas = new bool[8, 8];
for (int j = 0; j < 8; j++) {
string input = Console.ReadLine();
for (int k = 0; k < 8; k++) {
if (input[k] == '1') {
mas[k, j] = true;
} else {
mas[k, j] = false;
}
}
}
int bombX = int.Parse(Console.ReadLine()) - 1;
int bombY = int.Parse(Console.ReadLine()) - 1;
Point firstBomb = new Point(bombX, bombY);
resultList.Add(GetAfterBomb(mas, firstBomb));
}
int count = 1;
foreach (bool[,] mas in resultList) {
Console.WriteLine("Data {0}:", count);
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
if (mas[j, i]) {
Console.Write("1");
} else {
Console.Write("0");
}
}
Console.WriteLine();
}
}
}
static bool[,] GetAfterBomb(bool[,] mas, Point firstBomb) {
List<Point> bombList = new List<Point>();
bombList.Add(firstBomb);
while (bombList.Count != 0) {
Point bomb = bombList[0];
bombList.RemoveAt(0);
mas[bomb.x, bomb.y] = false;
for (int i = bomb.x - 3; i <= bomb.x + 3; i++) {
if (i >= 0 && i <= 7 && mas[i, bomb.y]) {
bombList.Add(new Point(i, bomb.y));
mas[i, bomb.y] = false;
}
}
for (int j = bomb.y - 3; j <= bomb.y + 3; j++) {
if (j >= 0 && j <= 7 && mas[bomb.x, j]) {
bombList.Add(new Point(bomb.x, j));
mas[bomb.x, j] = false;
}
}
}
return mas;
}
}
}
|
using System;
using System.Text;
using System.Collections.Generic;
namespace AOJ2 {
class Program {
class Point {
public int x { get; set; }
public int y { get; set; }
public Point() {
this.x = 0;
this.y = 0;
}
public Point(int x, int y) {
this.x = x;
this.y = y;
}
}
static void Main(string[] args) {
List<bool[,]> resultList = new List<bool[,]>();
int num = int.Parse(Console.ReadLine());
for (int i = 0; i < num; i++) {
Console.ReadLine();
bool[,] mas = new bool[8, 8];
for (int j = 0; j < 8; j++) {
string input = Console.ReadLine();
for (int k = 0; k < 8; k++) {
if (input[k] == '1') {
mas[k, j] = true;
} else {
mas[k, j] = false;
}
}
}
int bombX = int.Parse(Console.ReadLine()) - 1;
int bombY = int.Parse(Console.ReadLine()) - 1;
Point firstBomb = new Point(bombX, bombY);
resultList.Add(GetAfterBomb(mas, firstBomb));
}
int count = 1;
foreach (bool[,] mas in resultList) {
Console.WriteLine("Data {0}:", count);
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
if (mas[j, i]) {
Console.Write("1");
} else {
Console.Write("0");
}
}
Console.WriteLine();
}
count++;
}
}
static bool[,] GetAfterBomb(bool[,] mas, Point firstBomb) {
List<Point> bombList = new List<Point>();
bombList.Add(firstBomb);
while (bombList.Count != 0) {
Point bomb = bombList[0];
bombList.RemoveAt(0);
mas[bomb.x, bomb.y] = false;
for (int i = bomb.x - 3; i <= bomb.x + 3; i++) {
if (i >= 0 && i <= 7 && mas[i, bomb.y]) {
bombList.Add(new Point(i, bomb.y));
mas[i, bomb.y] = false;
}
}
for (int j = bomb.y - 3; j <= bomb.y + 3; j++) {
if (j >= 0 && j <= 7 && mas[bomb.x, j]) {
bombList.Add(new Point(bomb.x, j));
mas[bomb.x, j] = false;
}
}
}
return mas;
}
}
}
|
[["+", 0, 210, 8, 196, 0, 1, 0, 223, 0, 22], ["+", 0, 210, 8, 196, 0, 1, 0, 223, 0, 29], ["+", 8, 196, 0, 210, 8, 196, 0, 1, 0, 35]]
| 8
| 617
| 3
|
using System;
class Program {
static void Main(string[] args) {
while (true) {
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
if (a == b && a == 0) {
break;
}
double g = Math.Sqrt(b * b + (a / 2 * a / 2));
Console.WriteLine((a * a) + (2 * a * g));
}
}
}
|
using System;
class Program {
static void Main(string[] args) {
while (true) {
double a = int.Parse(Console.ReadLine());
double b = int.Parse(Console.ReadLine());
if (a == b && a == 0) {
break;
}
double g = Math.Sqrt(b * b + (a / 2 * a / 2));
Console.WriteLine((a * a) + (2 * a * g));
}
}
}
|
[["-", 0, 52, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 52, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 107
| 4
|
using System;
namespace _0073 {
class Program {
static void Main(string[] args) {
while (true) {
int x = int.Parse(Console.ReadLine());
int h = int.Parse(Console.ReadLine());
if (x == 0 && h == 0) {
break;
}
Console.WriteLine(x * x + Math.Sqrt(x * x / 4 + h * h) * x * 2);
}
}
}
}
|
using System;
namespace _0073 {
class Program {
static void Main(string[] args) {
while (true) {
double x = int.Parse(Console.ReadLine());
double h = int.Parse(Console.ReadLine());
if (x == 0 && h == 0) {
break;
}
Console.WriteLine(x * x + Math.Sqrt(x * x / 4 + h * h) * x * 2);
}
}
}
}
|
[["-", 0, 52, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 52, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 98
| 4
|
using System;
namespace AOJ.Volume0 {
public class Videotape {
public static int Main() {
while (true) {
var input = Console.ReadLine().Split(' ');
int t = int.Parse(input[0]);
int h = int.Parse(input[1]);
int s = int.Parse(input[2]);
if (t == -1 && h == -1 && s == -1) {
break;
}
// ????????????????§???§?¨????
// 3?????????????¨????
int rest = 7200 - (t * 60 * 60) - (h * 60) - s;
int rest_3x = rest * 3;
// ??????
// ???
string output =
((int)Math.Floor((decimal)rest / 3600)).ToString("00") + ":";
string output_3x =
((int)Math.Floor((decimal)rest_3x / 3600)).ToString("00") + ":";
rest = rest % 3600;
rest_3x = rest_3x % 3600;
// ???
output += ((int)Math.Floor((decimal)rest / 60)).ToString("00") + ":";
output_3x +=
((int)Math.Floor((decimal)rest_3x / 60)).ToString("00") + ":";
rest = rest % 60;
rest_3x = rest % 60;
// ?§?
output += rest.ToString("00");
output_3x += rest_3x.ToString("00");
Console.WriteLine(output);
Console.WriteLine(output_3x);
}
return 0;
}
}
}
|
using System;
namespace AOJ.Volume0 {
public class Videotape {
public static int Main() {
while (true) {
var input = Console.ReadLine().Split(' ');
int t = int.Parse(input[0]);
int h = int.Parse(input[1]);
int s = int.Parse(input[2]);
if (t == -1 && h == -1 && s == -1) {
break;
}
// ????????????????§???§?¨????
// 3?????????????¨????
int rest = 7200 - (t * 60 * 60) - (h * 60) - s;
int rest_3x = rest * 3;
// ??????
// ???
string output =
((int)Math.Floor((decimal)rest / 3600)).ToString("00") + ":";
string output_3x =
((int)Math.Floor((decimal)rest_3x / 3600)).ToString("00") + ":";
rest = rest % 3600;
rest_3x = rest_3x % 3600;
// ???
output += ((int)Math.Floor((decimal)rest / 60)).ToString("00") + ":";
output_3x +=
((int)Math.Floor((decimal)rest_3x / 60)).ToString("00") + ":";
rest = rest % 60;
rest_3x = rest_3x % 60;
// ?§?
output += rest.ToString("00");
output_3x += rest_3x.ToString("00");
Console.WriteLine(output);
Console.WriteLine(output_3x);
}
return 0;
}
}
}
|
[["-", 8, 196, 0, 1, 0, 11, 12, 16, 31, 22], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 31, 22]]
| 8
| 323
| 2
|
using System;
using System.Collections.Generic;
namespace aizu {
class OnlineJudge {
static void Main() {
string input;
while ((input = Console.ReadLine()) != null) {
double weight = double.Parse(input);
Console.WriteLine(weight <= 48.0 ? "light fly"
: weight <= 51.0 ? "fly"
: weight <= 54.0 ? "bantam"
: weight <= 57.0 ? "feather"
: weight <= 60.0 ? "light"
: weight <= 64.0 ? "light welter"
: weight <= 69.0 ? "middle"
: weight <= 75.0 ? "light middle"
: weight <= 81.0 ? "middle"
: weight <= 91.0 ? "light heavy"
: "heavy");
}
}
}
}
|
using System;
using System.Collections.Generic;
namespace aizu {
class OnlineJudge {
static void Main() {
string input;
while ((input = Console.ReadLine()) != null) {
double weight = double.Parse(input);
Console.WriteLine(weight <= 48.0 ? "light fly"
: weight <= 51.0 ? "fly"
: weight <= 54.0 ? "bantam"
: weight <= 57.0 ? "feather"
: weight <= 60.0 ? "light"
: weight <= 64.0 ? "light welter"
: weight <= 69.0 ? "welter"
: weight <= 75.0 ? "light middle"
: weight <= 81.0 ? "middle"
: weight <= 91.0 ? "light heavy"
: "heavy");
}
}
}
}
|
[["-", 75, 41, 75, 41, 75, 41, 64, 5, 0, 222], ["+", 75, 41, 75, 41, 75, 41, 64, 5, 0, 222]]
| 8
| 143
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AOJ {
class Program {
public static void Main() {
var currentDirection = 90;
var currentX = 0.0;
var currentY = 0.0;
foreach (var direction in ReadNumbers().TakeWhile(ds => ds[0] != 0 &&
ds[1] != 0)) {
var rad = DegreeToRadian(currentDirection);
currentX += Math.Cos(rad) * direction[0];
currentY += Math.Sin(rad) * direction[0];
currentDirection -= direction[1];
}
Console.WriteLine((int)currentX);
Console.WriteLine((int)currentY);
}
static IEnumerable<int[]> ReadNumbers() {
string line;
while (!string.IsNullOrEmpty(line = Console.ReadLine()))
yield return line.Split(',').Select(s => int.Parse(s)).ToArray();
}
static double DegreeToRadian(double degree) {
return degree / 180.0 * Math.PI;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AOJ {
class Program {
public static void Main() {
var currentDirection = 90;
var currentX = 0.0;
var currentY = 0.0;
foreach (var direction in ReadNumbers().TakeWhile(
ds => !(ds[0] == 0 && ds[1] == 0))) {
var rad = DegreeToRadian(currentDirection);
currentX += Math.Cos(rad) * direction[0];
currentY += Math.Sin(rad) * direction[0];
currentDirection -= direction[1];
}
Console.WriteLine((int)currentX);
Console.WriteLine((int)currentY);
}
static IEnumerable<int[]> ReadNumbers() {
string line;
while (!string.IsNullOrEmpty(line = Console.ReadLine()))
yield return line.Split(',').Select(s => int.Parse(s)).ToArray();
}
static double DegreeToRadian(double degree) {
return degree / 180.0 * Math.PI;
}
}
}
|
[["+", 3, 4, 0, 28, 0, 218, 8, 241, 0, 111], ["+", 0, 28, 0, 218, 8, 241, 0, 23, 0, 24], ["-", 0, 28, 0, 218, 8, 16, 31, 16, 17, 79], ["+", 8, 241, 0, 23, 0, 16, 31, 16, 17, 60], ["-", 0, 28, 0, 218, 8, 16, 12, 16, 17, 79], ["+", 8, 241, 0, 23, 0, 16, 12, 16, 17, 60], ["+", 0, 28, 0, 218, 8, 241, 0, 23, 0, 25]]
| 8
| 215
| 7
|
using System;
using System.Linq;
namespace Test06 {
class MainClass {
public static void Main(string[] args) {
int[] mountains = new int[10];
for (int i = 0; i < 10; i++) {
mountains[i] = int.Parse(Console.ReadLine());
}
Console.WriteLine(mountains.Max());
for (int i = 0; i < 10; i++) {
if (mountains[i] == mountains.Max()) {
mountains[i] = 0;
}
}
Console.WriteLine(mountains.Max());
for (int i = 0; i < 10; i++) {
if (mountains[i] == mountains.Max()) {
mountains[i] = 0;
}
}
Console.WriteLine(mountains.Max());
}
}
}
|
using System;
using System.Linq;
namespace Test06 {
class MainClass {
public static void Main(string[] args) {
int[] mountains = new int[10];
for (int i = 0; i < 10; i++) {
mountains[i] = int.Parse(Console.ReadLine());
}
Console.WriteLine(mountains.Max());
for (int i = 0; i < 10; i++) {
if (mountains[i] == mountains.Max()) {
mountains[i] = 0;
break;
}
}
Console.WriteLine(mountains.Max());
for (int i = 0; i < 10; i++) {
if (mountains[i] == mountains.Max()) {
mountains[i] = 0;
break;
}
}
Console.WriteLine(mountains.Max());
}
}
}
|
[["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 35], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35]]
| 8
| 180
| 4
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace AOJV0 {
public class P0001 {
public static void Main() {
foreach (var i in Enumerable.Range(0, 10)
.Select(_ => Console.ReadLine())
.Select(int.Parse)
.OrderBy(x => x)
.Take(3))
Console.WriteLine(i);
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace AOJV0 {
public class P0001 {
public static void Main() {
foreach (var i in Enumerable.Range(0, 10)
.Select(_ => Console.ReadLine())
.Select(int.Parse)
.OrderByDescending(x => x)
.Take(3))
Console.WriteLine(i);
}
}
}
|
[["-", 12, 213, 63, 214, 205, 213, 63, 214, 141, 22], ["+", 12, 213, 63, 214, 205, 213, 63, 214, 141, 22]]
| 8
| 83
| 2
|
using System;
class Program {
static void Main(string[] args) {
double[] x = new double[1000];
double[] y = new double[1000];
int count = -1;
string str = Console.ReadLine();
while (!string.IsNullOrEmpty(str)) {
count++;
string[] s = str.Split(' ');
double a = double.Parse(s[0]);
double b = double.Parse(s[1]);
double c = double.Parse(s[2]);
double d = double.Parse(s[3]);
double e = double.Parse(s[4]);
double f = double.Parse(s[5]);
y[count] = (c * d - a * f) / (b * d - a * e);
x[count] = (c - b * y[count]) / a;
str = Console.ReadLine();
}
for (int n = 0; n <= count; n++)
Console.WriteLine(string.Format("{0:0.000}", x[count]) + " " +
string.Format("{0:0.000}", y[count]));
}
}
|
using System;
class Program {
static void Main(string[] args) {
double[] x = new double[1000];
double[] y = new double[1000];
int count = -1;
string str = Console.ReadLine();
while (!string.IsNullOrEmpty(str)) {
count++;
string[] s = str.Split(' ');
double a = double.Parse(s[0]);
double b = double.Parse(s[1]);
double c = double.Parse(s[2]);
double d = double.Parse(s[3]);
double e = double.Parse(s[4]);
double f = double.Parse(s[5]);
y[count] = (c * d - a * f) / (b * d - a * e);
x[count] = (c - b * y[count]) / a;
str = Console.ReadLine();
}
for (int n = 0; n <= count; n++)
Console.WriteLine(string.Format("{0:0.000}", x[n]) + " " +
string.Format("{0:0.000}", y[n]));
}
}
|
[["-", 0, 28, 0, 204, 206, 207, 0, 28, 0, 22], ["+", 0, 28, 0, 204, 206, 207, 0, 28, 0, 22]]
| 8
| 264
| 4
|
using System;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
while (true) {
string input = Console.ReadLine();
if (input == null)
break;
string[] split = input.Split();
double a = double.Parse(split[0]);
double b = double.Parse(split[1]);
double c = double.Parse(split[2]);
double d = double.Parse(split[3]);
double e = double.Parse(split[4]);
double f = double.Parse(split[5]);
// x = (c-by)/a
// y = (f-dx)/e
// ey = f-dx
// ey = f-d((c-by)/a)
// ey = f-(dc-dby)/a
// f-ey= (dc-dby)/a
// fa-aey = dc-dby
// dby-aey = dc-fa
// y(db-ae) = dc-fa
// y = (dc-fa)/(db-ae)
double y = (d * c - f * a) / (d * b - a * e);
double x = (c - b * y) / a;
string ans = x.ToString(".000") + " " + y.ToString(".000");
Console.WriteLine(ans);
}
Console.ReadLine();
}
}
}
|
using System;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
while (true) {
string input = Console.ReadLine();
if (input == null)
break;
string[] split = input.Split();
double a = double.Parse(split[0]);
double b = double.Parse(split[1]);
double c = double.Parse(split[2]);
double d = double.Parse(split[3]);
double e = double.Parse(split[4]);
double f = double.Parse(split[5]);
// x = (c-by)/a
// y = (f-dx)/e
// ey = f-dx
// ey = f-d((c-by)/a)
// ey = f-(dc-dby)/a
// f-ey= (dc-dby)/a
// fa-aey = dc-dby
// dby-aey = dc-fa
// y(db-ae) = dc-fa
// y = (dc-fa)/(db-ae)
double y = (d * c - f * a) / (d * b - a * e);
double x = (c - b * y) / a;
string ans = x.ToString("0.000") + " " + y.ToString("0.000");
Console.WriteLine(ans);
}
Console.ReadLine();
}
}
}
|
[["-", 31, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 31, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["-", 12, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 12, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 218
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static string ReadLine() { return Console.ReadLine(); }
static int ReadInt() { return int.Parse(ReadLine()); }
static int[] ReadInts() {
return ReadLine().Split().Select(int.Parse).ToArray();
}
static string[] ReadStrings() { return ReadLine().Split(); }
static float Scala(float a, float b, float c, float d) {
return a * d - b * c;
}
// ax + by = c
// dx + ey = f
static void Calc(float a, float b, float c, float d, float e, float f) {
var nume = Scala(a, b, d, e);
var xd = Scala(c, b, f, e);
var yd = Scala(a, c, d, f);
var x = xd / nume;
var y = yd / nume;
Console.WriteLine("{0} {1}", x, y);
}
static void Main() {
string s;
while ((s = ReadLine()) != null) {
var xs = s.Split().Select(int.Parse).ToArray();
Calc(xs[0], xs[1], xs[2], xs[3], xs[4], xs[5]);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static string ReadLine() { return Console.ReadLine(); }
static int ReadInt() { return int.Parse(ReadLine()); }
static int[] ReadInts() {
return ReadLine().Split().Select(int.Parse).ToArray();
}
static string[] ReadStrings() { return ReadLine().Split(); }
static float Scala(float a, float b, float c, float d) {
return a * d - b * c;
}
// ax + by = c
// dx + ey = f
static void Calc(float a, float b, float c, float d, float e, float f) {
var nume = Scala(a, b, d, e);
var xd = Scala(c, b, f, e);
var yd = Scala(a, c, d, f);
var x = xd / nume;
var y = yd / nume;
Console.WriteLine("{0:f3} {1:f3}", x, y);
}
static void Main() {
string s;
while ((s = ReadLine()) != null) {
var xs = s.Split().Select(int.Parse).ToArray();
Calc(xs[0], xs[1], xs[2], xs[3], xs[4], xs[5]);
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 296
| 2
|
using System;
class _0016 {
public static void Main() {
char[] splitChar = { ',' };
vector2 origin = new vector2();
double degree = 90.0;
string str = Console.ReadLine();
string[] data = str.Split(splitChar);
while (data[0] != "0" && data[1] != "0") {
vector2 move =
new vector2(double.Parse(data[0]), Math.PI *degree / 180.0);
origin += move;
degree -= double.Parse(data[1]);
str = Console.ReadLine();
data = str.Split(splitChar);
}
Console.WriteLine((int)origin.getX);
Console.WriteLine((int)origin.getY);
}
}
class vector2 {
private double x, y, s;
public vector2() {
x = 0.0;
y = 0.0;
}
public vector2(double i, double j) {
s = i;
x = s * Math.Cos(j);
y = s * Math.Sin(j);
}
public static vector2 operator +(vector2 op1, vector2 op2) {
vector2 result = new vector2();
result.x = op1.x + op2.x;
result.y = op1.y + op2.y;
return result;
}
public double size {
get { return s; }
}
public double getX {
get { return x; }
}
public double getY {
get { return y; }
}
}
|
using System;
class _0016 {
public static void Main() {
char[] splitChar = { ',' };
vector2 origin = new vector2();
int degree = 90;
string str = Console.ReadLine();
string[] data = str.Split(splitChar);
while (data[0] != "0" || data[1] != "0") {
vector2 move =
new vector2(double.Parse(data[0]), Math.PI *degree / 180.0);
origin += move;
degree -= int.Parse(data[1]);
str = Console.ReadLine();
data = str.Split(splitChar);
}
Console.WriteLine((int)origin.getX);
Console.WriteLine((int)origin.getY);
}
}
class vector2 {
private double x, y, s;
public vector2() {
x = 0.0;
y = 0.0;
}
public vector2(double i, double j) {
s = i;
x = s * Math.Cos(j);
y = s * Math.Sin(j);
}
public static vector2 operator +(vector2 op1, vector2 op2) {
vector2 result = new vector2();
result.x = op1.x + op2.x;
result.y = op1.y + op2.y;
return result;
}
public double size {
get { return s; }
}
public double getX {
get { return x; }
}
public double getY {
get { return y; }
}
}
|
[["-", 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, 212, 0, 250], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["-", 0, 195, 8, 196, 0, 52, 15, 16, 17, 98], ["+", 0, 195, 8, 196, 0, 52, 15, 16, 17, 106], ["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199]]
| 8
| 309
| 8
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp16 {
class Program {
public static void Main() {
while (true) {
string a = Console.ReadLine();
if (a == null)
break;
decimal[] b = a.Split().Select(decimal.Parse).ToArray();
decimal[] c = { b[1] * b[3] / b[0], b[2] * b[3] / b[0] };
decimal d = (b[5] - c[1]) / (b[4] - c[0]);
decimal e = (b[2] - d) / b[0];
Console.WriteLine("{0,0:F3} {1,1:F3}", e, d);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp16 {
class Program {
public static void Main() {
while (true) {
string a = Console.ReadLine();
if (a == null)
break;
decimal[] b = a.Split().Select(decimal.Parse).ToArray(); // 1 2 3 4 5 6
decimal[] c = { b[1] * b[3] / b[0], b[2] * b[3] / b[0] }; // 8 12
decimal d = (b[5] - c[1]) / (b[4] - c[0]); //-6 -3
decimal e = (b[2] - d * b[1]) / b[0]; // 3 2
Console.WriteLine("{0,0:F3} {1,1:F3}", e, d);
}
}
}
}
|
[["+", 0, 16, 31, 23, 0, 16, 12, 16, 17, 48], ["+", 31, 23, 0, 16, 12, 16, 12, 204, 205, 22], ["+", 0, 16, 12, 16, 12, 204, 206, 207, 0, 70], ["+", 12, 16, 12, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 16, 12, 16, 12, 204, 206, 207, 0, 73]]
| 8
| 175
| 5
|
using System;
class A {
static void Main() {
string a = Console.ReadLine();
a.Replace("apple", "RaAaYssdHOTATEISTHESTRONGEST");
a.Replace("peach", "apple");
a.Replace("RaAaYssdHOTATEISTHESTRONGEST", "peach");
Console.WriteLine(a);
}
}
|
using System;
class A {
static void Main() {
string a = Console.ReadLine();
a = a.Replace("apple", "RaAaYssdHOTATEISTHESTRONGEST");
a = a.Replace("peach", "apple");
a = a.Replace("RaAaYssdHOTATEISTHESTRONGEST", "peach");
Console.WriteLine(a);
}
}
|
[["+", 8, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 205, 22], ["+", 0, 195, 8, 196, 0, 1, 0, 11, 31, 22]]
| 8
| 69
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AOJ {
class Program {
static void Main(string[] args) {
string line = "";
while ((line = Console.ReadLine()) != null) {
String[] arg = line.Split(',');
double o = double.Parse(arg[1]);
double s = double.Parse(arg[2]);
double bmi = o / s * s;
if (bmi >= 25)
Console.WriteLine(arg[0]);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AOJ {
class Program {
static void Main(string[] args) {
string line = "";
while ((line = Console.ReadLine()) != null) {
String[] arg = line.Split(',');
double o = double.Parse(arg[1]);
double s = double.Parse(arg[2]);
double bmi = o / (s * s);
if (bmi >= 25)
Console.WriteLine(arg[0]);
}
}
}
}
|
[["+", 0, 200, 0, 212, 0, 16, 12, 23, 0, 24], ["+", 0, 200, 0, 212, 0, 16, 12, 23, 0, 25]]
| 8
| 126
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace JagArrayTest {
class Program {
static void Main(string[] args) {
while (true) {
var readline = Console.ReadLine();
if (readline == null) {
break;
}
var d = readline.Split(' ').ToList().ConvertAll(double.Parse).ToArray();
Console.WriteLine("{0}", (d[0] + d[1]).ToString());
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace JagArrayTest {
class Program {
static void Main(string[] args) {
while (true) {
var readline = Console.ReadLine();
if (readline == null) {
break;
}
var d = readline.Split(' ').ToList().ConvertAll(double.Parse).ToArray();
Console.WriteLine((d[0] + d[1]).ToString().Length);
}
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 62], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["-", 8, 196, 0, 1, 0, 213, 3, 4, 0, 21], ["+", 0, 213, 3, 4, 0, 28, 0, 214, 0, 131], ["+", 0, 213, 3, 4, 0, 28, 0, 214, 141, 22]]
| 8
| 111
| 6
|
using System;
using System.Linq;
class DigitNumber {
static void Main() {
var sums =
from numpair in Enumerable.Range(0, 1000000)
.Select(_ => Console.ReadLine())
.TakeWhile(_ => _ != null)
.Select(_ => _.Split(' ').Select(__ => int.Parse(__))) let a =
numpair.First() let b = numpair.Last() select "" + a + b;
foreach (var sum in sums)
Console.WriteLine(sum.ToString());
}
}
|
using System;
using System.Linq;
class DigitNumber {
static void Main() {
var sums =
from numpair in Enumerable.Range(0, 1000000)
.Select(_ => Console.ReadLine())
.TakeWhile(_ => _ != null)
.Select(_ => _.Split(' ').Select(__ => int.Parse(__))) let a =
numpair.First() let b = numpair.Last() select "" + (a + b);
foreach (var sum in sums)
Console.WriteLine(sum.Length);
}
}
|
[["+", 0, 242, 0, 244, 0, 16, 12, 23, 0, 24], ["+", 0, 242, 0, 244, 0, 16, 12, 23, 0, 25], ["-", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["-", 3, 4, 0, 28, 0, 213, 3, 4, 0, 24], ["-", 3, 4, 0, 28, 0, 213, 3, 4, 0, 25], ["+", 0, 213, 3, 4, 0, 28, 0, 214, 141, 22]]
| 8
| 121
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
StringBuilder sb = new StringBuilder();
while (true) {
int n = int.Parse(Console.ReadLine());
if (n == 0)
break;
int x = 5, count = 0;
while (x < n) {
count += n / x;
x *= 5;
}
sb.AppendLine(count.ToString());
}
Console.Write(sb);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
StringBuilder sb = new StringBuilder();
while (true) {
int n = int.Parse(Console.ReadLine());
if (n == 0)
break;
int x = 5, count = 0;
while (x <= n) {
count += n / x;
x *= 5;
}
sb.AppendLine(count.ToString());
}
Console.Write(sb);
}
}
}
|
[["-", 0, 52, 8, 196, 0, 52, 15, 16, 17, 18], ["+", 0, 52, 8, 196, 0, 52, 15, 16, 17, 19]]
| 8
| 120
| 2
|
using System;
class aoj {
static void Main() {
while (true) {
string a = Console.ReadLine();
if (String.IsNullOrEmpty(a))
break;
string[] b = a.Split(' ');
int c = int.Parse(b[0]), d = int.Parse(b[1]), n = int.Parse(b[2]);
double e = (double)c / (double)d;
string f = e.ToString();
string[] g = f.Split('.');
if (g.Length == 0) {
Console.WriteLine("0");
goto stop;
}
int k = 0;
char[] h = new char[n];
h = g[1].ToCharArray();
for (int i = 0; i < h.Length; i++) {
if (i <= n - 1) {
int l = (int)(h[i] - '0');
k += l;
} else
break;
}
Console.WriteLine(k);
stop:;
}
}
}
|
using System;
class aoj {
static void Main() {
while (true) {
string a = Console.ReadLine();
if (String.IsNullOrEmpty(a))
break;
string[] b = a.Split(' ');
int c = int.Parse(b[0]), d = int.Parse(b[1]), n = int.Parse(b[2]);
double e = (double)c / (double)d;
string f = e.ToString();
string[] g = f.Split('.');
if (g.Length == 1) {
Console.WriteLine("0");
goto stop;
}
int k = 0;
char[] h = new char[n];
h = g[1].ToCharArray();
for (int i = 0; i < h.Length; i++) {
if (i < n) {
int l = (int)(h[i] - '0');
k += l;
} else
break;
}
Console.WriteLine(k);
stop:;
}
}
}
|
[["-", 0, 52, 8, 196, 0, 57, 15, 16, 12, 203], ["+", 0, 52, 8, 196, 0, 57, 15, 16, 12, 203], ["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 18], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 57, 15, 16, 12, 16, 12, 203]]
| 8
| 238
| 6
|
using System;
using System.IO;
using System.Linq;
namespace Simultaneous_Equation {
class Program {
static void Main(string[] args) {
var result =
Enumerable.Range(0, int.MaxValue)
.Select(_ => Console.ReadLine())
.TakeWhile(x => x != null)
.Select(x => x.Split(' ').Select(y => double.Parse(y)).ToArray())
.Select(x => new {
X = (x[2] * x[4] - x[1] * x[5]) / (x[0] * x[4] - x[1] * x[3]),
Y = (x[0] * x[5] - x[2] * x[3]) / (x[0] * x[4] - x[1] * x[3])
});
foreach (var item in result) {
Console.WriteLine("{0:f4} {1:f4}", item.X, item.Y);
}
}
}
}
|
using System;
using System.IO;
using System.Linq;
namespace Simultaneous_Equation {
class Program {
static void Main(string[] args) {
var result =
Enumerable.Range(0, int.MaxValue)
.Select(_ => Console.ReadLine())
.TakeWhile(x => x != null)
.Select(x => x.Split(' ').Select(y => double.Parse(y)).ToArray())
.Select(x => new {
X = (x[2] * x[4] - x[1] * x[5]) / (x[0] * x[4] - x[1] * x[3]),
Y = (x[0] * x[5] - x[2] * x[3]) / (x[0] * x[4] - x[1] * x[3])
});
foreach (var item in result) {
Console.WriteLine("{0:f3} {1:f3}", item.X, item.Y);
}
}
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 222
| 2
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace AOJ2 {
class Program {
static void Main(string[] args) {
List<int> resultList = new List<int>();
string input;
while ((input = Console.ReadLine()) != null) {
decimal[] array =
input.Split(' ').Select(s => decimal.Parse(s)).ToArray();
decimal child = array[0];
decimal mother = array[1];
int n = (int)array[2];
decimal sho = child / mother;
string str = sho.ToString().Split('.')[1];
int sum = 0;
for (int i = 0; i < str.Length && i < n; i++) {
sum += int.Parse(str.Substring(i, 1));
}
resultList.Add(sum);
}
foreach (int a in resultList) {
Console.WriteLine(a);
}
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
namespace AOJ2 {
class Program {
static void Main(string[] args) {
List<int> resultList = new List<int>();
string input;
while ((input = Console.ReadLine()) != null) {
decimal[] array =
input.Split(' ').Select(s => decimal.Parse(s)).ToArray();
decimal child = array[0];
decimal mother = array[1];
int n = (int)array[2];
decimal sho = child / mother;
string str = sho.ToString("F15").Split('.')[1];
int sum = 0;
for (int i = 0; i < str.Length && i < n; i++) {
sum += int.Parse(str.Substring(i, 1));
}
resultList.Add(sum);
}
foreach (int a in resultList) {
Console.WriteLine(a);
}
}
}
}
|
[["+", 205, 213, 3, 4, 0, 28, 0, 5, 0, 62], ["+", 205, 213, 3, 4, 0, 28, 0, 5, 0, 222]]
| 8
| 216
| 3
|
using System;
using System.Collections.Generic;
namespace test {
class MainClass {
public static void Main(string[] args) {
string input;
List<string> outList = new List<string>();
while ((input = Console.ReadLine()) != "0") {
string[] array = input.Split(' ');
List<double> list = new List<double>();
foreach (string s in array) {
list.Add(double.Parse(s));
}
double y = Math.Round((list[2] * list[3] - list[0] * list[5]) /
(list[1] * list[3] - list[0] * list[4]),
3, MidpointRounding.AwayFromZero);
double x = Math.Round((list[2] * list[4] - list[1] * list[5]) /
(list[0] * list[4] - list[1] * list[3]),
3, MidpointRounding.AwayFromZero);
string outString = string.Format("{0:f3} {1:f3}", x, y);
outList.Add(outString);
}
foreach (string s in outList) {
Console.WriteLine(s);
}
}
}
}
|
using System;
using System.Collections.Generic;
namespace test {
class MainClass {
public static void Main(string[] args) {
string input;
List<string> outList = new List<string>();
while ((input = Console.ReadLine()) != null) {
string[] array = input.Split(' ');
List<double> list = new List<double>();
foreach (string s in array) {
list.Add(double.Parse(s));
}
double y = Math.Round((list[2] * list[3] - list[0] * list[5]) /
(list[1] * list[3] - list[0] * list[4]),
3, MidpointRounding.AwayFromZero);
double x = Math.Round((list[2] * list[4] - list[1] * list[5]) /
(list[0] * list[4] - list[1] * list[3]),
3, MidpointRounding.AwayFromZero);
string outString = string.Format("{0:f3} {1:f3}", x, y);
outList.Add(outString);
}
foreach (string s in outList) {
Console.WriteLine(s);
}
}
}
}
|
[["-", 8, 196, 0, 52, 15, 16, 12, 5, 0, 62], ["-", 8, 196, 0, 52, 15, 16, 12, 5, 0, 222], ["+", 0, 195, 8, 196, 0, 52, 15, 16, 12, 215]]
| 8
| 269
| 4
|
using System;
namespace v0_0005 {
class Program {
static void Main(string[] args) {
string line;
while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
var ab = line.Split(' ');
var a = int.Parse(ab[0]);
var b = int.Parse(ab[1]);
int LCM = 1;
int GCD = 1;
int divVal;
while ((divVal = GetDivisor(a, b)) != -1) {
a /= divVal;
b /= divVal;
GCD *= divVal;
}
LCM = GCD * a * b;
Console.WriteLine("{0} {1}", GCD, LCM);
}
}
static int GetDivisor(int a, int b) {
if ((a % 2 == 0) && (b % 2 == 0)) {
return 2;
}
for (int i = 3; i <= Math.Min(a, b); i += 3) {
if ((a % i == 0) && (b % i == 0)) {
return i;
}
}
return -1;
}
}
}
|
using System;
namespace v0_0005 {
class Program {
static void Main(string[] args) {
string line;
while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
var ab = line.Split(' ');
var a = int.Parse(ab[0]);
var b = int.Parse(ab[1]);
int LCM = 1;
int GCD = 1;
int divVal;
while ((divVal = GetDivisor(a, b)) != -1) {
a /= divVal;
b /= divVal;
GCD *= divVal;
}
LCM = GCD * a * b;
Console.WriteLine("{0} {1}", GCD, LCM);
}
}
static int GetDivisor(int a, int b) {
if ((a % 2 == 0) && (b % 2 == 0)) {
return 2;
}
for (int i = 3; i <= Math.Min(a, b); i += 2) {
if ((a % i == 0) && (b % i == 0)) {
return i;
}
}
return -1;
}
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 26, 11, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 26, 11, 12, 203]]
| 8
| 231
| 2
|
using System;
class Program {
public static void Main() {
string s;
while ((s = Console.ReadLine()) != null) {
int[] n = Array.ConvertAll(s.Split(' '), int.Parse);
int a = GCD(n[0], n[1]);
Console.WriteLine(a + " " + n[0] * n[1] / a);
}
}
static int GCD(int x, int y) {
if (y == 0)
return x;
return GCD(y, x % y);
}
}
|
using System;
class Program {
public static void Main() {
string s;
while ((s = Console.ReadLine()) != null) {
int[] n = Array.ConvertAll(s.Split(' '), int.Parse);
int a = GCD(n[0], n[1]);
Console.WriteLine(a + " " + n[0] / a * n[1]);
}
}
static int GCD(int x, int y) {
if (y == 0)
return x;
return GCD(y, x % y);
}
}
|
[["+", 0, 28, 0, 16, 12, 16, 31, 16, 17, 85], ["+", 0, 28, 0, 16, 12, 16, 31, 16, 12, 22], ["-", 3, 4, 0, 28, 0, 16, 12, 16, 17, 85], ["-", 3, 4, 0, 28, 0, 16, 12, 16, 12, 22]]
| 8
| 127
| 4
|
using System;
class main {
static void Main(string[] args) {
const int N = 50;
string[] I = new string[N];
string[] I1;
int a, b, G, L;
for (int i = 0; i < N; i++) {
I[i] = Console.ReadLine();
}
for (int i = 0; i < N; i++) {
if (string.IsNullOrEmpty(I[i]))
break;
I1 = I[i].Split();
a = int.Parse(I1[0]);
b = int.Parse(I1[1]);
G = Gojo(a, b);
L = a / G * b;
Console.WriteLine(G);
Console.WriteLine(L);
}
}
public static int Gojo(int a, int b) {
if (a == 0 || b == 0)
return 0;
int c = a;
do {
c = a % b;
a = b;
b = c;
} while (b != 0);
return a;
}
}
|
using System;
class main {
static void Main(string[] args) {
const int N = 50;
string[] I = new string[N];
string[] I1;
int a, b, G, L;
for (int i = 0; i < N; i++) {
I[i] = Console.ReadLine();
}
for (int i = 0; i < N; i++) {
if (string.IsNullOrEmpty(I[i]))
break;
I1 = I[i].Split();
a = int.Parse(I1[0]);
b = int.Parse(I1[1]);
G = Gojo(a, b);
L = a / G * b;
Console.WriteLine(G + " " + L);
}
}
public static int Gojo(int a, int b) {
if (a == 0 || b == 0)
return 0;
int c = a;
do {
c = a % b;
a = b;
b = c;
} while (b != 0);
return a;
}
}
|
[["-", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25], ["-", 8, 196, 0, 7, 8, 196, 0, 1, 0, 35], ["-", 8, 196, 0, 1, 0, 213, 63, 214, 205, 22], ["-", 8, 196, 0, 1, 0, 213, 63, 214, 0, 131], ["-", 8, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["-", 8, 196, 0, 1, 0, 213, 3, 4, 0, 24], ["+", 3, 4, 0, 28, 0, 16, 31, 16, 17, 72], ["+", 0, 28, 0, 16, 31, 16, 12, 5, 0, 62], ["+", 0, 28, 0, 16, 31, 16, 12, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 72]]
| 8
| 230
| 11
|
using System;
using System.Text;
namespace GCDandLCM {
class Program {
static void Main(string[] args) {
var sb = new StringBuilder();
while (true) {
string str = Console.ReadLine();
if (str == "") {
break;
}
double[] inputs = Array.ConvertAll(str.Split(' '), double.Parse);
double gcd;
if (inputs[0] > inputs[1]) {
gcd = Myfunc(inputs[0], inputs[1]);
} else {
gcd = Myfunc(inputs[1], inputs[0]);
}
sb.AppendFormat("{0} {1}\n", gcd, inputs[0] * inputs[1] / gcd);
}
sb.Remove(sb.Length - 1, 1);
Console.WriteLine(sb);
}
public static double Myfunc(double a, double b) {
double r = a % b;
if (r != 0) {
b = Myfunc(b, r);
}
return b;
}
}
}
|
using System;
using System.Text;
namespace GCDandLCM {
class Program {
static void Main(string[] args) {
var sb = new StringBuilder();
while (true) {
string str = Console.ReadLine();
if (str == null) {
break;
}
double[] inputs = Array.ConvertAll(str.Split(' '), double.Parse);
double gcd;
if (inputs[0] > inputs[1]) {
gcd = Myfunc(inputs[0], inputs[1]);
} else {
gcd = Myfunc(inputs[1], inputs[0]);
}
sb.AppendFormat("{0} {1}\n", gcd, inputs[0] * inputs[1] / gcd);
}
sb.Remove(sb.Length - 1, 1);
Console.WriteLine(sb);
}
public static double Myfunc(double a, double b) {
double r = a % b;
if (r != 0) {
b = Myfunc(b, r);
}
return b;
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 12, 5, 0, 62], ["+", 0, 52, 8, 196, 0, 57, 15, 16, 12, 215]]
| 8
| 218
| 3
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AOJ {
class Program {
public static void Main() {
var candidateBase = new[] { "the", "this", "that" };
var candidates = new Dictionary<string, List<string>>();
foreach (var candidate in candidateBase) {
candidates[candidate] = new List<string>();
foreach (var i in Enumerable.Range(0, 25))
candidates[candidate].Add(Caesar(candidate, i));
}
string line;
while ((line = Console.ReadLine()) != null) {
var words = line.Split(' ');
var rot = -1;
foreach (var candidate in candidates) {
if (words.Any(w => candidate.Value.Contains(w))) {
foreach (var c in candidate.Value) {
if (words.Contains(c)) {
rot = candidate.Value.IndexOf(c);
break;
}
if (rot != -1)
break;
}
}
if (rot != -1)
break;
}
Console.WriteLine(Caesar(line, -rot));
}
}
static string Caesar(string str, int rot) {
return new string(str.Select(c => Caesar(c, rot)).ToArray());
}
static char Caesar(char c, int rot) {
if (c < 'a' || 'z' < c)
return c;
int tmp = (c - 'a') + rot;
if (tmp < 0)
tmp += 'z';
else
tmp = (tmp % 26) + 'a';
return (char)tmp;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AOJ {
class Program {
public static void Main() {
var candidateBase = new[] { "the", "this", "that" };
var candidates = new Dictionary<string, List<string>>();
foreach (var candidate in candidateBase) {
candidates[candidate] = new List<string>();
foreach (var i in Enumerable.Range(0, 25))
candidates[candidate].Add(Caesar(candidate, i));
}
string line;
while ((line = Console.ReadLine()) != null) {
var words = line.Split(' ');
var rot = -1;
foreach (var candidate in candidates) {
if (words.Any(w => candidate.Value.Contains(w))) {
foreach (var c in candidate.Value) {
if (words.Contains(c)) {
rot = candidate.Value.IndexOf(c);
break;
}
if (rot != -1)
break;
}
}
if (rot != -1)
break;
}
Console.WriteLine(Caesar(line, -rot));
}
}
static string Caesar(string str, int rot) {
return new string(str.Select(c => Caesar(c, rot)).ToArray());
}
static char Caesar(char c, int rot) {
if (c < 'a' || 'z' < c)
return c;
int tmp = (c - 'a') + rot;
if (tmp < 0)
tmp += 'z' + 1;
else
tmp = (tmp % 26) + 'a';
return (char)tmp;
}
}
}
|
[["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 72], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 203]]
| 8
| 358
| 2
|
using System;
class AOJ {
static void Main(string[] args) {
string s = Console.ReadLine();
string ans = "";
int[] x = Array.ConvertAll(s.Split(' '), int.Parse);
Array.Sort(x);
for (int i = 0; i < 5; i++) {
ans += (4 - x[i]);
if (i != 4)
ans += " ";
}
Console.WriteLine(ans);
}
}
|
using System;
class AOJ {
static void Main(string[] args) {
string s = Console.ReadLine();
string ans = "";
int[] x = Array.ConvertAll(s.Split(' '), int.Parse);
Array.Sort(x);
for (int i = 0; i < 5; i++) {
ans += (x[4 - i]);
if (i != 4)
ans += " ";
}
Console.WriteLine(ans);
}
}
|
[["-", 0, 1, 0, 11, 12, 23, 0, 16, 31, 203], ["-", 0, 1, 0, 11, 12, 23, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 31, 203], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33]]
| 8
| 109
| 4
|
using System;
class Program {
static void Main() {
int[] n = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
Array.Sort(n);
for (int i = 3; i > 0; i--)
Console.Write(n[i] + " ");
Console.WriteLine(n[0]);
}
}
|
using System;
class Program {
static void Main() {
int[] n = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
Array.Sort(n);
for (int i = 4; i > 0; i--)
Console.Write(n[i] + " ");
Console.WriteLine(n[0]);
}
}
|
[["-", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 7, 10, 198, 0, 200, 0, 212, 0, 203]]
| 8
| 86
| 2
|
using System;
using System.Collections.Generic;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
List<int> hList = new List<int>();
string s = "";
int dat = 0;
while (true) {
s = Console.ReadLine();
if (s == "") {
break;
}
dat = Convert.ToInt32(s.Split(' ')[0]) + Convert.ToInt32(s.Split(' ')[1]);
hList.Add(dat.ToString().Length);
}
for (int i = 0; i < hList.Count; i++) {
Console.WriteLine(hList[i].ToString());
}
Console.ReadLine();
}
}
}
|
using System;
using System.Collections.Generic;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
List<int> hList = new List<int>();
string s = "";
int dat = 0;
while (true) {
s = Console.ReadLine();
if (s == null) {
break;
}
dat = Convert.ToInt32(s.Split(' ')[0]) + Convert.ToInt32(s.Split(' ')[1]);
hList.Add(dat.ToString().Length);
}
for (int i = 0; i < hList.Count; i++) {
Console.WriteLine(hList[i].ToString());
}
Console.ReadLine();
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 12, 5, 0, 62], ["+", 0, 52, 8, 196, 0, 57, 15, 16, 12, 215]]
| 8
| 166
| 3
|
using System;
namespace GCDandLCM {
class Program {
static void Main(string[] args) {
string buf;
while (!string.IsNullOrEmpty(buf = Console.ReadLine())) {
string[] str = buf.Split(' ');
int a = int.Parse(str[0]), b = int.Parse(str[1]);
int gcd = (a > b) ? Myfunc(a, b) : Myfunc(b, a);
Console.WriteLine("{0} {1}", gcd, a * b / gcd);
}
}
public static int Myfunc(int a, int b) {
if (b == 0) {
return a;
}
return Myfunc(b, a % b);
}
}
}
|
using System;
namespace GCDandLCM {
class Program {
static void Main(string[] args) {
string buf;
while (!string.IsNullOrEmpty(buf = Console.ReadLine())) {
string[] str = buf.Split(' ');
int a = int.Parse(str[0]), b = int.Parse(str[1]);
int gcd = (a > b) ? Myfunc(a, b) : Myfunc(b, a);
Console.WriteLine("{0} {1}", gcd, a / gcd * b);
}
}
public static int Myfunc(int a, int b) {
if (b == 0) {
return a;
}
return Myfunc(b, a % b);
}
}
}
|
[["-", 3, 4, 0, 28, 0, 16, 31, 16, 17, 48], ["-", 3, 4, 0, 28, 0, 16, 31, 16, 12, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 17, 48], ["+", 0, 213, 3, 4, 0, 28, 0, 16, 12, 22]]
| 8
| 156
| 4
|
using System;
class main {
static void Main(string[] args) {
string s = string.Empty;
while ((s = Console.ReadLine()) != null) {
string[] s1 = s.Split(' ');
int[] a = new int[3];
a[0] = int.Parse(s1[0]);
a[1] = int.Parse(s1[1]);
a[2] = 0;
Array.Sort(a);
Array.Reverse(a);
long c = a[0] * a[1];
if (a[1] != 0) {
while (true) {
a[2] = a[1];
a[1] = a[0] % a[1];
a[0] = a[2];
if (a[1] == 0) {
Console.WriteLine("{0} {1}", a[0], (c / a[0]));
break;
}
}
} else {
Console.WriteLine("{0} {1}", a[0], (c / a[0]));
}
}
}
}
|
using System;
class main {
static void Main(string[] args) {
string s = string.Empty;
while ((s = Console.ReadLine()) != null) {
string[] s1 = s.Split(' ');
long[] a = new long[3];
a[0] = long.Parse(s1[0]);
a[1] = long.Parse(s1[1]);
a[2] = 0;
Array.Sort(a);
Array.Reverse(a);
long c = a[0] * a[1];
if (a[1] != 0) {
while (true) {
a[2] = a[1];
a[1] = a[0] % a[1];
a[0] = a[2];
if (a[1] == 0) {
Console.WriteLine("{0} {1}", a[0], (c / a[0]));
break;
}
}
} else {
Console.WriteLine("{0} {1}", a[0], (c / a[0]));
}
}
}
}
|
[["-", 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, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199]]
| 8
| 244
| 8
|
using System;
class main {
static void Main(string[] args) {
string s = string.Empty;
while ((s = Console.ReadLine()) != null) {
string[] s1 = s.Split(' ');
long[] a = new long[3];
a[0] = long.Parse(s1[0]);
a[1] = long.Parse(s1[1]);
a[2] = 0;
Array.Sort(a);
Array.Reverse(a);
long c = a[0] * a[1];
if (a[1] != 0)
while (true) {
a[2] = a[1];
a[1] = a[0] % a[1];
a[0] = a[2];
if (a[1] == 0)
Console.WriteLine("{0} {1}", a[0], (c / a[0]));
break;
}
else
Console.WriteLine("{0} {1}", a[0], (c / a[0]));
}
}
}
|
using System;
class main {
static void Main(string[] args) {
string s = string.Empty;
while ((s = Console.ReadLine()) != null) {
string[] s1 = s.Split(' ');
long[] a = new long[3];
a[0] = long.Parse(s1[0]);
a[1] = long.Parse(s1[1]);
a[2] = 0;
Array.Sort(a);
Array.Reverse(a);
long c = a[0] * a[1];
if (a[1] != 0)
while (true) {
a[2] = a[1];
a[1] = a[0] % a[1];
a[0] = a[2];
if (a[1] == 0) {
Console.WriteLine("{0} {1}", a[0], (c / a[0]));
break;
}
}
else
Console.WriteLine("{0} {1}", a[0], (c / a[0]));
}
}
}
|
[["+", 64, 52, 8, 196, 0, 57, 64, 196, 0, 45], ["+", 64, 52, 8, 196, 0, 57, 64, 196, 0, 46]]
| 8
| 238
| 2
|
using System;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
char[] c = Console.ReadLine().ToCharArray();
Array.Reverse(c);
Console.WriteLine(c.ToString());
}
}
}
|
using System;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
char[] c = Console.ReadLine().ToCharArray();
Array.Reverse(c);
Console.WriteLine(new String(c));
}
}
}
|
[["-", 3, 4, 0, 28, 0, 213, 63, 214, 205, 22], ["-", 3, 4, 0, 28, 0, 213, 63, 214, 0, 131], ["-", 3, 4, 0, 28, 0, 213, 63, 214, 141, 22], ["+", 0, 213, 3, 4, 0, 28, 0, 230, 0, 228], ["+", 0, 213, 3, 4, 0, 28, 0, 230, 39, 22], ["+", 0, 28, 0, 230, 3, 4, 0, 28, 0, 22]]
| 8
| 55
| 6
|
using System;
class Program {
static void Main() {
int n = int.Parse(Console.ReadLine());
int sum = n;
for (int i = n - 1; i >= 1; i--) {
sum = sum * i;
}
Console.WriteLine(sum);
}
}
|
using System;
class Program {
static void Main() {
int n = int.Parse(Console.ReadLine());
long sum = n;
for (int i = n - 1; i >= 1; i--) {
sum = sum * i;
}
Console.WriteLine(sum);
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 64
| 2
|
using System;
namespace AOJ.Volume0 {
class Factorial {
public static void Main() {
int n = int.Parse(Console.ReadLine());
uint ans = 1;
for (int i = 2; i <= n; i++) {
ans = ans * (uint)i;
}
Console.WriteLine(ans);
}
}
}
|
using System;
namespace AOJ.Volume0 {
class Factorial {
public static void Main() {
int n = int.Parse(Console.ReadLine());
long ans = 1;
for (int i = 2; i <= n; i++) {
ans = ans * i;
}
Console.WriteLine(ans);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 1, 0, 11, 12, 16, 12, 74, 0, 24], ["-", 0, 1, 0, 11, 12, 16, 12, 74, 39, 199], ["-", 0, 1, 0, 11, 12, 16, 12, 74, 0, 25]]
| 8
| 72
| 5
|
using System;
namespace OJcsharp {
class Program {
static void Main(string[] args) {
int N;
N = int.Parse(Console.ReadLine());
int ans = 1;
for (int n = 2; n <= N; n++) {
ans *= n;
}
Console.WriteLine(ans);
}
}
}
|
using System;
namespace OJcsharp {
class Program {
static void Main(string[] args) {
int N;
N = int.Parse(Console.ReadLine());
long ans = 1;
for (int n = 2; n <= N; n++) {
ans *= n;
}
Console.WriteLine(ans);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 70
| 2
|
using System;
using System.Linq;
namespace AOJ {
class Program {
static void Main(string[] args) {
var n = int.Parse(Console.ReadLine());
Console.WriteLine(Enumerable.Range(1, n).Aggregate((a, b) => a * b));
}
}
}
|
using System;
using System.Linq;
namespace AOJ {
class Program {
static void Main(string[] args) {
var n = int.Parse(Console.ReadLine());
Console.WriteLine(
Enumerable.Range(1, n).Aggregate((long)1, (a, b) => a * b));
}
}
}
|
[["+", 0, 213, 3, 4, 0, 28, 0, 74, 39, 199], ["+", 0, 213, 3, 4, 0, 28, 0, 74, 0, 25], ["+", 0, 213, 3, 4, 0, 28, 0, 74, 51, 203], ["+", 3, 4, 0, 28, 0, 213, 3, 4, 0, 21], ["+", 3, 4, 0, 28, 0, 218, 54, 55, 0, 24]]
| 8
| 68
| 5
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication34 {
class Program {
static void Main() {
int a = 1, s = int.Parse(Console.ReadLine());
for (int b = 1; b <= s; b++) {
a *= b;
}
Console.WriteLine(a);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication34 {
class Program {
static void Main() {
long a = 1;
int s = int.Parse(Console.ReadLine());
for (int b = 1; b <= s; b++) {
a *= b;
}
Console.WriteLine(a);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 195, 8, 196, 0, 197, 0, 198, 0, 21], ["+", 8, 201, 0, 195, 8, 196, 0, 197, 0, 35]]
| 8
| 80
| 5
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp5 {
class Program {
static void Main(string[] args) {
{
string a = Console.ReadLine();
int b = a.Length;
for (; b > 0; b--) {
Console.Write(a[b]);
}
Console.WriteLine();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp9 {
class Program {
public static void Main(string[] args)
{
{
string a = Console.ReadLine();
int b = a.Length;
for (; b > 0; b--) {
Console.Write(a[b - 1]);
}
Console.WriteLine();
}
}
}
}
|
[["-", 36, 36, 36, 36, 0, 208, 0, 209, 141, 22], ["+", 36, 36, 36, 36, 0, 208, 0, 209, 141, 22], ["+", 0, 235, 8, 201, 0, 195, 0, 251, 0, 259], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 17, 33], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 85
| 5
|
using System;
using System.Linq;
class AOJ {
static void Main(string[] args) {
string s = Console.ReadLine();
Console.WriteLine(s.Reverse());
}
}
|
using System;
using System.Linq;
class AOJ {
static void Main(string[] args) {
string s = Console.ReadLine();
Console.WriteLine(s.Reverse().ToArray());
}
}
|
[["+", 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], ["+", 8, 196, 0, 1, 0, 213, 3, 4, 0, 25]]
| 8
| 43
| 4
|
using System;
class Program {
static void Main() {
int n = int.Parse(Console.ReadLine());
double price = 100000;
for (int i = 0; i < n; i++) {
price = price * 1.05;
}
price = price / 10000;
double tmp = Math.Ceiling(price);
price = tmp * 10000;
Console.WriteLine(price);
}
}
|
using System;
class Program {
static void Main() {
int n = int.Parse(Console.ReadLine());
double price = 100000;
for (int i = 0; i < n; i++) {
price = price * 1.05;
price = price / 1000;
double tmp = Math.Ceiling(price);
price = tmp * 1000;
}
Console.WriteLine(price);
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46], ["-", 8, 196, 0, 1, 0, 11, 12, 16, 12, 203], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 12, 203], ["+", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46]]
| 8
| 84
| 6
|
using System;
class Program {
static void Main(string[] args) {
int n = int.Parse(Console.ReadLine());
double money = 1000;
for (int i = 0; i < n + 1; i++) {
money = Math.Ceiling(money * 1.05);
}
Console.WriteLine(money * 1000);
}
}
|
using System;
class Program {
static void Main(string[] args) {
int n = int.Parse(Console.ReadLine());
double money = 100;
for (int i = 0; i < n; i++) {
money = Math.Ceiling(money * 1.05);
}
Console.WriteLine(money * 1000);
}
}
|
[["-", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["+", 0, 197, 0, 198, 0, 200, 0, 212, 0, 203], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 72], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203]]
| 8
| 75
| 4
|
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.IO;
public class Sample8 {
public static void Main() {
int week = int.Parse(Console.ReadLine());
double result = debutResult(week);
Console.WriteLine(result);
}
public static double debutResult(int week) {
double debut = 100000;
for (int i = 0; i < week; i++) {
debut = debut * 1.05;
}
debut *= 0.001;
//
debut = Math.Ceiling(debut);
//
debut *= 1000;
return debut;
}
}
|
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.IO;
public class Sample8 {
public static void Main() {
int week = int.Parse(Console.ReadLine());
double result = debutResult(week);
Console.WriteLine(result);
}
public static double debutResult(int week) {
double debut = 100000;
for (int i = 0; i < week; i++) {
debut = debut * 1.05;
debut *= 0.001;
debut = Math.Ceiling(debut);
debut *= 1000;
}
return debut;
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46], ["+", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46]]
| 8
| 126
| 2
|
using System;
class _0007 {
public static void Main() {
double money = 100000;
int n = int.Parse(Console.ReadLine());
for (int i = 0; i < n; i++) {
money += money * 0.05;
money = Math.Ceiling(money / 1000.0) * 1000.0;
}
Console.WriteLine();
}
}
|
using System;
class _0007 {
public static void Main() {
double money = 100000;
int n = int.Parse(Console.ReadLine());
for (int i = 0; i < n; i++) {
money += money * 0.05;
money = Math.Ceiling(money / 1000.0) * 1000.0;
}
Console.WriteLine(money);
}
}
|
[["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
| 8
| 75
| 1
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
//空白で分割する
var line_origin = Console.ReadLine();
if (string.IsNullOrEmpty(line_origin)) {
return;
}
int week_num = int.Parse(line_origin);
double money = 100000; //10万円
for (int i = 0; i < week_num; i++) {
money *= 1.05;
// 1000未満の切り上げ
money = Math.Floor(money / 1000) * 1000;
}
Console.WriteLine("{0}", (int)money);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
var line_origin = Console.ReadLine();
if (string.IsNullOrEmpty(line_origin)) {
return;
}
int week_num = int.Parse(line_origin);
double money = 100000; //10万円
for (int i = 0; i < week_num; i++) {
money *= 1.05;
// 1000未満の切り上げ
money = Math.Ceiling((money / 1000)) * 1000;
}
Console.WriteLine("{0}", (int)money);
}
}
}
|
[["-", 0, 11, 12, 16, 31, 213, 63, 214, 141, 22], ["+", 0, 11, 12, 16, 31, 213, 63, 214, 141, 22], ["+", 0, 11, 12, 16, 31, 213, 3, 4, 0, 24], ["+", 31, 213, 3, 4, 0, 28, 0, 23, 0, 25]]
| 8
| 126
| 4
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static string InputPattern = "Input1";
static List<string> GetInputList() {
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("35");
WillReturn.Add("1");
} else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null)
WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main() {
List<string> InputList = GetInputList();
Func<int, int> DeriveCombiCntFunc = (pSum) => {
int WillReturn = 0;
for (int A = 0; A <= 9; A++) {
for (int B = 0; B <= 9; B++) {
for (int C = 0; C <= 9; C++) {
for (int D = 0; D <= 9; D++) {
if (A + B + C + D == pSum)
WillReturn++;
}
}
}
}
return WillReturn;
};
InputList.ForEach(X => Console.WriteLine(DeriveCombiCntFunc(int.Parse(X))));
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static string InputPattern = "Input2";
static List<string> GetInputList() {
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("35");
WillReturn.Add("1");
} else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null)
WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main() {
List<string> InputList = GetInputList();
Func<int, int> DeriveCombiCntFunc = (pSum) => {
int WillReturn = 0;
for (int A = 0; A <= 9; A++) {
for (int B = 0; B <= 9; B++) {
for (int C = 0; C <= 9; C++) {
for (int D = 0; D <= 9; D++) {
if (A + B + C + D == pSum)
WillReturn++;
}
}
}
}
return WillReturn;
};
InputList.ForEach(X => Console.WriteLine(DeriveCombiCntFunc(int.Parse(X))));
}
}
|
[["-", 0, 198, 0, 200, 0, 212, 0, 5, 0, 222], ["+", 0, 198, 0, 200, 0, 212, 0, 5, 0, 222]]
| 8
| 247
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication51 {
class Program {
static void Main() {
while (true) {
string l = Console.ReadLine();
if (l == null)
break;
int[] a = l.Split().Select(int.Parse).ToArray();
int b = a[0] * 10000 + a[1] * 100 * a[2];
if (b < 18680908) {
Console.WriteLine("pre-meiji");
continue;
} else if (b < 19120730)
Console.Write("meiji " + (a[0] - 1867) + " ");
else if (b < 19261225)
Console.Write("taisho " + (a[0] - 1911) + " ");
else if (b < 19890108)
Console.Write("showa " + (a[0] - 1925) + " ");
else
Console.Write("heisei " + (a[0] - 1988) + " ");
Console.WriteLine(a[1] + " " + a[2]);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication51 {
class Program {
static void Main() {
while (true) {
string l = Console.ReadLine();
if (l == null)
break;
int[] a = l.Split().Select(int.Parse).ToArray();
int b = a[0] * 10000 + a[1] * 100 + a[2];
if (b < 18680908) {
Console.WriteLine("pre-meiji");
continue;
} else if (b < 19120730)
Console.Write("meiji " + (a[0] - 1867) + " ");
else if (b < 19261225)
Console.Write("taisho " + (a[0] - 1911) + " ");
else if (b < 19890108)
Console.Write("showa " + (a[0] - 1925) + " ");
else
Console.Write("heisei " + (a[0] - 1988) + " ");
Console.WriteLine(a[1] + " " + a[2]);
}
}
}
}
|
[["-", 0, 200, 0, 212, 0, 16, 12, 16, 17, 48], ["+", 0, 198, 0, 200, 0, 212, 0, 16, 17, 72]]
| 8
| 250
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4 {
class Program {
static void Main(string[] args) {
string input;
int sum = 0, digit = 1;
while ((input = Console.ReadLine()) != null) {
foreach (string num in input.Split()) {
sum += int.Parse(num);
}
while ((sum /= 10) >= 1) {
digit++;
}
Console.WriteLine(digit);
digit = 0;
sum = 0;
}
return;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4 {
class Program {
static void Main(string[] args) {
string input;
int sum = 0, digit = 1;
while ((input = Console.ReadLine()) != null) {
foreach (string num in input.Split()) {
sum += int.Parse(num);
}
while ((sum /= 10) >= 1) {
digit++;
}
Console.WriteLine(digit);
digit = 1;
sum = 0;
}
return;
}
}
}
|
[["-", 0, 52, 8, 196, 0, 1, 0, 11, 12, 203], ["+", 0, 52, 8, 196, 0, 1, 0, 11, 12, 203]]
| 8
| 121
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
int a, b;
string tmp;
string[] inp;
List<int> res = new List<int>();
while (true) {
tmp = Console.ReadLine();
if (tmp == "") {
break;
}
inp = tmp.Split(' ');
a = int.Parse(inp[0]);
b = int.Parse(inp[1]);
int c = a + b;
int keta = 1;
while (c > 9) {
c = c / 10;
keta++;
}
res.Add(keta);
}
for (int i = 0; i < res.Count; i++) {
Console.WriteLine(res[i]);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
int a, b;
string tmp;
string[] inp;
List<int> res = new List<int>();
while (true) {
tmp = Console.ReadLine();
if (tmp == null) {
break;
}
inp = tmp.Split(' ');
a = int.Parse(inp[0]);
b = int.Parse(inp[1]);
int c = a + b;
int keta = 1;
while (c > 9) {
c = c / 10;
keta++;
}
res.Add(keta);
}
for (int i = 0; i < res.Count; i++) {
Console.WriteLine(res[i]);
}
}
}
}
|
[["-", 8, 196, 0, 57, 15, 16, 12, 5, 0, 62], ["+", 0, 52, 8, 196, 0, 57, 15, 16, 12, 215]]
| 8
| 185
| 3
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication32 {
class Program {
static void Main(string[] args) {
int s = 1;
int a = int.Parse(Console.ReadLine());
for (int f = 2; f < a + 1; f++)
s *= f;
Console.WriteLine(s);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication32 {
class Program {
static void Main(string[] args) {
long s = 1;
int a = int.Parse(Console.ReadLine());
for (int f = 2; f < a + 1; f++)
s *= f;
Console.WriteLine(s);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 85
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AOJ.Volume0 {
class Program0002 {
static void Main(string[] args) {
const int N = 2;
string input;
Queue<int[]> queue = new Queue<int[]>();
while ((input = Console.ReadLine()) != string.Empty) {
string[] splitedInput = input.Split(' ');
int[] pair = new int[N];
for (int i = 0; i < N; i++) {
pair[i] = int.Parse(splitedInput[i]);
}
queue.Enqueue(pair);
}
foreach (var pair in queue) {
Console.WriteLine("{0}", pair.Sum().ToString().Length);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AOJ.Volume0 {
class Program0002 {
static void Main(string[] args) {
const int N = 2;
string input;
Queue<int[]> queue = new Queue<int[]>();
while ((input = Console.ReadLine()) != null) {
string[] splitedInput = input.Split(' ');
int[] pair = new int[N];
for (int i = 0; i < N; i++) {
pair[i] = int.Parse(splitedInput[i]);
}
queue.Enqueue(pair);
}
foreach (var pair in queue) {
Console.WriteLine("{0}", pair.Sum().ToString().Length);
}
}
}
}
|
[["-", 8, 196, 0, 52, 15, 16, 12, 214, 205, 199], ["-", 8, 196, 0, 52, 15, 16, 12, 214, 0, 131], ["-", 8, 196, 0, 52, 15, 16, 12, 214, 141, 22], ["+", 0, 195, 8, 196, 0, 52, 15, 16, 12, 215]]
| 8
| 174
| 4
|
using System;
using System.Text;
namespace _083_EraNameTransformation {
class Program {
static void Main(string[] args) {
DateTime meiji = new DateTime(1868, 9, 8);
DateTime taisyo = new DateTime(1912, 7, 30);
DateTime showa = new DateTime(1926, 12, 25);
DateTime heisei = new DateTime(1989, 1, 8);
string inputStr;
StringBuilder output = new StringBuilder(15 * 50);
while ((inputStr = Console.ReadLine()) != null) {
int[] tmp = Array.ConvertAll(inputStr.Split(' '), int.Parse);
DateTime now = new DateTime(tmp[0], tmp[1], tmp[2]);
// = pre-meiji
if (now < meiji) {
output.AppendLine("pre-meiji");
}
// = meiji
else if (now < taisyo) {
output.Append("meiji ");
output = AppendDate(output, now.Year - meiji.Year + 1, tmp[1], tmp[2]);
output.AppendLine();
}
// = taisyo
else if (now < showa) {
output.Append("taisyo ");
output = AppendDate(output, now.Year - taisyo.Year + 1, tmp[1], tmp[2]);
output.AppendLine();
}
// = showa
else if (now < heisei) {
output.Append("showa ");
output = AppendDate(output, now.Year - showa.Year + 1, tmp[1], tmp[2]);
output.AppendLine();
}
// = heisei
else {
output.Append("heisei ");
output = AppendDate(output, now.Year - heisei.Year + 1, tmp[1], tmp[2]);
output.AppendLine();
}
}
Console.Write(output);
}
static StringBuilder AppendDate(StringBuilder s, int year, int month,
int day) {
s.Append(year);
s.Append(" ");
s.Append(month);
s.Append(" ");
s.Append(day);
return s;
}
}
}
|
using System;
using System.Text;
namespace _083_EraNameTransformation {
class Program {
static void Main(string[] args) {
DateTime meiji = new DateTime(1868, 9, 8);
DateTime taisho = new DateTime(1912, 7, 30);
DateTime showa = new DateTime(1926, 12, 25);
DateTime heisei = new DateTime(1989, 1, 8);
string inputStr;
StringBuilder output = new StringBuilder(15 * 50);
while ((inputStr = Console.ReadLine()) != null) {
int[] tmp = Array.ConvertAll(inputStr.Split(' '), int.Parse);
DateTime now = new DateTime(tmp[0], tmp[1], tmp[2]);
// = pre-meiji
if (now < meiji) {
output.AppendLine("pre-meiji");
}
// = meiji
else if (now < taisho) {
output.Append("meiji ");
output = AppendDate(output, now.Year - meiji.Year + 1, tmp[1], tmp[2]);
output.AppendLine();
}
// = taisyo
else if (now < showa) {
output.Append("taisho ");
output = AppendDate(output, now.Year - taisho.Year + 1, tmp[1], tmp[2]);
output.AppendLine();
}
// = showa
else if (now < heisei) {
output.Append("showa ");
output = AppendDate(output, now.Year - showa.Year + 1, tmp[1], tmp[2]);
output.AppendLine();
}
// = heisei
else {
output.Append("heisei ");
output = AppendDate(output, now.Year - heisei.Year + 1, tmp[1], tmp[2]);
output.AppendLine();
}
}
Console.Write(output);
}
static StringBuilder AppendDate(StringBuilder s, int year, int month,
int day) {
s.Append(year);
s.Append(" ");
s.Append(month);
s.Append(" ");
s.Append(day);
return s;
}
}
}
|
[["-", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["+", 8, 196, 0, 197, 0, 198, 0, 200, 141, 22], ["-", 8, 196, 0, 57, 75, 57, 15, 16, 12, 22], ["+", 8, 196, 0, 57, 75, 57, 15, 16, 12, 22], ["-", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["+", 0, 213, 3, 4, 0, 28, 0, 5, 0, 222], ["-", 0, 28, 0, 16, 31, 16, 12, 214, 205, 22], ["+", 0, 28, 0, 16, 31, 16, 12, 214, 205, 22]]
| 8
| 441
| 8
|
using System;
using System.Text;
using System.Collections.Generic;
namespace AOJ2 {
class Program {
static void Main(string[] args) {
List<string> resultList = new List<string>();
string input;
while ((input = Console.ReadLine()) != null) {
string[] inputArray = input.Split(' ');
int date = SetDate(inputArray);
if (date <= 18680907) {
resultList.Add("pre-meiji");
} else if (date <= 19120729) {
resultList.Add(string.Format("meiji {0} {1} {2}",
(date - 18680000) / 10000 + 1,
inputArray[1], inputArray[2]));
} else if (date <= 19261224) {
resultList.Add(string.Format("taisho {0} {1} {2}",
date - 19120000 / 10000 + 1, inputArray[1],
inputArray[2]));
} else if (date <= 19890107) {
resultList.Add(string.Format("showa {0} {1} {2}",
(date - 19260000) / 10000 + 1,
inputArray[1], inputArray[2]));
} else {
resultList.Add(string.Format("heisei {0} {1} {2}",
(date - 19890000) / 10000 + 1,
inputArray[1], inputArray[2]));
}
}
foreach (string s in resultList) {
Console.WriteLine(s);
}
}
static int SetDate(string[] array) {
string date;
date = array[0];
if (array[1].Length == 1) {
date += "0" + array[1];
} else {
date += array[1];
}
if (array[2].Length == 1) {
date += "0" + array[2];
} else {
date += array[2];
}
return int.Parse(date);
}
}
}
|
using System;
using System.Text;
using System.Collections.Generic;
namespace AOJ2 {
class Program {
static void Main(string[] args) {
List<string> resultList = new List<string>();
string input;
while ((input = Console.ReadLine()) != null) {
string[] inputArray = input.Split(' ');
int date = SetDate(inputArray);
if (date <= 18680907) {
resultList.Add("pre-meiji");
} else if (date <= 19120729) {
resultList.Add(string.Format("meiji {0} {1} {2}",
(date - 18680000) / 10000 + 1,
inputArray[1], inputArray[2]));
} else if (date <= 19261224) {
resultList.Add(string.Format("taisho {0} {1} {2}",
(date - 19120000) / 10000 + 1,
inputArray[1], inputArray[2]));
} else if (date <= 19890107) {
resultList.Add(string.Format("showa {0} {1} {2}",
(date - 19260000) / 10000 + 1,
inputArray[1], inputArray[2]));
} else {
resultList.Add(string.Format("heisei {0} {1} {2}",
(date - 19890000) / 10000 + 1,
inputArray[1], inputArray[2]));
}
}
foreach (string s in resultList) {
Console.WriteLine(s);
}
}
static int SetDate(string[] array) {
string date;
date = array[0];
if (array[1].Length == 1) {
date += "0" + array[1];
} else {
date += array[1];
}
if (array[2].Length == 1) {
date += "0" + array[2];
} else {
date += array[2];
}
return int.Parse(date);
}
}
}
|
[["+", 0, 28, 0, 16, 31, 16, 31, 23, 0, 24], ["+", 0, 28, 0, 16, 31, 16, 31, 23, 0, 25]]
| 8
| 383
| 2
|
using System;
class aoj {
static void Main() {
int a = int.Parse(Console.ReadLine());
int b = 1;
for (int i = 1; i <= a; i++) {
b *= i;
}
Console.WriteLine(b);
}
}
|
using System;
class aoj {
static void Main() {
int a = int.Parse(Console.ReadLine());
ulong b = 1;
for (int i = 1; i <= a; i++) {
b *= (ulong)i;
}
Console.WriteLine(b);
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 8, 196, 0, 1, 0, 11, 12, 74, 0, 24], ["+", 8, 196, 0, 1, 0, 11, 12, 74, 39, 199], ["+", 8, 196, 0, 1, 0, 11, 12, 74, 0, 25]]
| 8
| 60
| 5
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Miscelleneous {
class Program {
static Dictionary<char, string> Encode0 =
new Dictionary<char, string>() { { ' ', "101" }, { '\'', "000000" },
{ ',', "000011" }, { '-', "10010001" },
{ '.', "010001" }, { '?', "000001" } };
static void Main(string[] args) {
string[] alphaomega = { "100101", "10011010", "0101", "0001",
"110", "01001", "10011011", "010000",
"0111", "10011000", "0110", "00100",
"10011001", "10011110", "00101", "111",
"10011111", "1000", "00110", "00111",
"10011100", "10011101", "000010", "10010010",
"10010011", "10010000" };
for (int i = 0; i < alphaomega.Length; i++)
Encode0.Add((char)(i + 65), alphaomega[i]);
StringBuilder sb = new StringBuilder();
List<char> Res = new List<char>();
int j;
string s1;
int k;
while (true) {
string s = Console.ReadLine();
if (string.IsNullOrEmpty(s))
return;
foreach (char c in s)
sb.Append(Encode0[c]);
if (sb.Length % 5 != 0)
sb.Append(new string('0', 5 - sb.Length % 5));
string ss = sb.ToString();
for (j = 0; 5 * j < sb.Length; j++) {
s1 = new string(ss.Skip(5 * j).Take(5).ToArray());
k = Convert.ToInt32(s1, 2);
Res.Add(Encode1(k));
}
Console.WriteLine(new string(Res.ToArray()));
Res.Clear();
sb.Remove(0, sb.Length);
}
}
static char[] Symbols1 = { ' ', '.', ',', '-', '\'', '?' };
static char Encode1(int h) {
return h < 25 ? (char)(h + 65) : Symbols1[h - 26];
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Miscelleneous {
class Program {
static Dictionary<char, string> Encode0 =
new Dictionary<char, string>() { { ' ', "101" }, { '\'', "000000" },
{ ',', "000011" }, { '-', "10010001" },
{ '.', "010001" }, { '?', "000001" } };
static void Main(string[] args) {
string[] alphaomega = { "100101", "10011010", "0101", "0001",
"110", "01001", "10011011", "010000",
"0111", "10011000", "0110", "00100",
"10011001", "10011110", "00101", "111",
"10011111", "1000", "00110", "00111",
"10011100", "10011101", "000010", "10010010",
"10010011", "10010000" };
for (int i = 0; i < alphaomega.Length; i++)
Encode0.Add((char)(i + 65), alphaomega[i]);
StringBuilder sb = new StringBuilder();
List<char> Res = new List<char>();
int j;
string s1;
int k;
while (true) {
string s = Console.ReadLine();
if (string.IsNullOrEmpty(s))
return;
foreach (char c in s)
sb.Append(Encode0[c]);
if (sb.Length % 5 != 0)
sb.Append(new string('0', 5 - sb.Length % 5));
string ss = sb.ToString();
for (j = 0; 5 * j < sb.Length; j++) {
s1 = new string(ss.Skip(5 * j).Take(5).ToArray());
k = Convert.ToInt32(s1, 2);
Res.Add(Encode1(k));
}
Console.WriteLine(new string(Res.ToArray()));
Res.Clear();
sb.Remove(0, sb.Length);
}
}
static char[] Symbols1 = { ' ', '.', ',', '-', '\'', '?' };
static char Encode1(int h) {
return h <= 25 ? (char)(h + 65) : Symbols1[h - 26];
}
}
}
|
[["-", 8, 196, 0, 37, 0, 41, 15, 16, 17, 18], ["+", 8, 196, 0, 37, 0, 41, 15, 16, 17, 19]]
| 8
| 537
| 2
|
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Threading;
class Program {
public const int Inf = 1 << 29;
private static int[,] dp = new int[100, 100];
private static int[,] arrayList = new int[100, 100];
private static int cnt = 0;
static void Main() {
string line;
for (int i = 0; i < 100; ++i) {
for (int j = 0; j < 100; j++) {
dp[i, j] = -1;
arrayList[i, j] = -1;
}
}
while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
string[] s = line.Split(',');
for (int i = 0; i < s.Length; i++) {
arrayList[cnt, i] = int.Parse(s[i]);
}
cnt++;
}
Console.WriteLine(solve(0, 0));
}
static int solve(int a, int b) {
if (cnt == a) {
return 0;
}
if (b < 0 || arrayList[a, b] == -1) {
return -Inf;
}
if (dp[a, b] >= 0) {
return dp[a, b];
}
int res = cnt / 2 >= a ? Math.Max(solve(a + 1, b) + arrayList[a, b],
solve(a + 1, b + 1) + arrayList[a, b])
: Math.Max(solve(a + 1, b) + arrayList[a, b],
solve(a + 1, b - 1) + arrayList[a, b]);
return dp[a, b] = res;
}
}
|
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Threading;
class Program {
public const int Inf = 1 << 29;
public static int[,] dp = new int[100, 100];
public static int[,] arrayList = new int[100, 100];
public static int cnt = 0;
static void Main() {
string line;
for (int i = 0; i < 100; ++i) {
for (int j = 0; j < 100; j++) {
dp[i, j] = -1;
arrayList[i, j] = -1;
}
}
while (!string.IsNullOrEmpty(line = Console.ReadLine())) {
string[] s = line.Split(',');
for (int i = 0; i < s.Length; i++) {
arrayList[cnt, i] = int.Parse(s[i]);
}
cnt++;
}
Console.WriteLine(solve(0, 0));
}
static int solve(int a, int b) {
if (cnt == a) {
return 0;
}
if (b < 0 || arrayList[a, b] == -1) {
return -Inf;
}
if (dp[a, b] >= 0) {
return dp[a, b];
}
var res = cnt / 2 > a ? Math.Max(solve(a + 1, b) + arrayList[a, b],
solve(a + 1, b + 1) + arrayList[a, b])
: Math.Max(solve(a + 1, b) + arrayList[a, b],
solve(a + 1, b - 1) + arrayList[a, b]);
return dp[a, b] = res;
}
}
|
[["-", 0, 235, 8, 201, 0, 124, 0, 251, 0, 261], ["+", 0, 235, 8, 201, 0, 124, 0, 251, 0, 259], ["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 8, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["-", 0, 200, 0, 212, 0, 41, 15, 16, 17, 20], ["+", 0, 200, 0, 212, 0, 41, 15, 16, 17, 47]]
| 8
| 401
| 10
|
using System;
public class Hello {
public static void Main() {
var a = new int[99, 50];
var j = 0;
string line;
for (; (line = Console.ReadLine()) != null;) {
string[] line2 = line.Trim().Split(',');
for (int i = 0; i < line2.Length; i++)
a[j, i] = int.Parse(line2[i]);
j++;
}
var w = (j + 1) / 2;
var dp = new int[j, w];
goDp(a, dp);
Console.WriteLine(dp[j - 1, 0]);
}
public static void goDp(int[,] a, int[,] dp) {
var h = dp.GetLength(0);
var w = dp.GetLength(1);
dp[0, 0] = a[0, 0];
for (int i = 1; i < w; i++) {
dp[i, 0] = dp[i - 1, 0] + a[i, 0];
dp[i, i] = dp[i - 1, i - 1] + a[i, i];
}
for (int i = 2; i <= w; i++)
for (int j = 1; j <= i - 1; j++)
dp[i, j] = a[i, j] + Math.Max(dp[i - 1, j - 1], dp[i - 1, j]);
for (int i = w + 1; i < h; i++)
for (int j = 0; j <= h - 1 - i; j++)
dp[i, j] = a[i, j] + Math.Max(dp[i - 1, j], dp[i - 1, j + 1]);
}
}
|
using System;
public class Hello {
public static void Main() {
var a = new int[99, 50];
var j = 0;
string line;
for (; (line = Console.ReadLine()) != null;) {
string[] line2 = line.Trim().Split(',');
for (int i = 0; i < line2.Length; i++)
a[j, i] = int.Parse(line2[i]);
j++;
}
var w = (j + 1) / 2;
var dp = new int[j, w];
goDp(a, dp);
Console.WriteLine(dp[j - 1, 0]);
}
public static void goDp(int[,] a, int[,] dp) {
var h = dp.GetLength(0);
var w = dp.GetLength(1);
dp[0, 0] = a[0, 0];
for (int i = 1; i < w; i++) {
dp[i, 0] = dp[i - 1, 0] + a[i, 0];
dp[i, i] = dp[i - 1, i - 1] + a[i, i];
}
for (int i = 2; i < w; i++)
for (int j = 1; j <= i - 1; j++)
dp[i, j] = a[i, j] + Math.Max(dp[i - 1, j - 1], dp[i - 1, j]);
for (int i = w; i < h; i++)
for (int j = 0; j <= h - 1 - i; j++)
dp[i, j] = a[i, j] + Math.Max(dp[i - 1, j], dp[i - 1, j + 1]);
}
}
|
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["-", 10, 198, 0, 200, 0, 212, 0, 16, 17, 72], ["-", 10, 198, 0, 200, 0, 212, 0, 16, 12, 203]]
| 8
| 409
| 4
|
using System;
class Program {
static void Main() {
int n = int.Parse(Console.ReadLine());
int ans = 1;
while (n > 0)
ans *= n--;
Console.WriteLine(ans);
}
}
|
using System;
class Program {
static void Main() {
int n = int.Parse(Console.ReadLine());
long ans = 1;
while (n > 0)
ans *= n--;
Console.WriteLine(ans);
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 51
| 2
|
using System;
namespace _0019 {
class Program {
static void Main(string[] args) {
int n = int.Parse(Console.ReadLine());
int output = n;
for (int i = n - 1; i > 0; i--) {
output *= i;
}
Console.WriteLine(output);
Console.ReadLine();
}
}
}
|
using System;
namespace _0019 {
class Program {
static void Main(string[] args) {
int n = int.Parse(Console.ReadLine());
long output = n;
for (int i = n - 1; i > 0; i--) {
output *= i;
}
Console.WriteLine(output);
Console.ReadLine();
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 76
| 2
|
using System;
namespace _019_Factorial {
class Program {
static void Main(string[] args) {
int inputNum = int.Parse(Console.ReadLine());
int sum = 1;
for (int lp = 2; lp <= inputNum; lp++) {
sum *= lp;
}
Console.WriteLine(sum);
}
}
}
|
using System;
namespace _019_Factorial {
class Program {
static void Main(string[] args) {
int inputNum = int.Parse(Console.ReadLine());
long sum = 1;
for (int lp = 2; lp <= inputNum; lp++) {
sum *= lp;
}
Console.WriteLine(sum);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 68
| 2
|
using System;
namespace Factorial {
class Program {
static void Main(string[] args) {
int k = int.Parse(Console.ReadLine());
int ans = 1;
for (int i = 1; i <= k; i++)
ans *= i;
Console.WriteLine(ans);
}
}
}
|
using System;
namespace Factorial {
class Program {
static void Main(string[] args) {
int k = int.Parse(Console.ReadLine());
long ans = 1;
for (int i = 1; i <= k; i++)
ans *= i;
Console.WriteLine(ans);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 66
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static int Main(string[] args) {
// List<int> list = new List<int>();
string v = Console.ReadLine();
// string[] vs = v.Split(' ');
int n = int.Parse(v);
int x = n;
for (int i = n - 1; i >= 1; i--) {
x = x * i;
}
Console.WriteLine(x);
return 0;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
class Program {
static int Main(string[] args) {
// List<int> list = new List<int>();
string v = Console.ReadLine();
// string[] vs = v.Split(' ');
int n = int.Parse(v);
long x = n;
for (int i = n - 1; i >= 1; i--) {
x = x * i;
}
Console.WriteLine(x);
return 0;
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 90
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AOJ {
class Program {
public static void Main() {
Console.WriteLine(Factorial(int.Parse(Console.ReadLine())));
}
static int Factorial(int n) { return Factorial(n, 1); }
static int Factorial(int n, int acc) {
if (n == 1)
return acc;
return Factorial(n - 1, n * acc);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace AOJ {
class Program {
public static void Main() {
Console.WriteLine(Factorial(decimal.Parse(Console.ReadLine())));
}
static decimal Factorial(decimal n) { return Factorial(n, 1); }
static decimal Factorial(decimal n, decimal acc) {
if (n == 1)
return acc;
return Factorial(n - 1, n * acc);
}
}
}
|
[["-", 3, 4, 0, 28, 0, 213, 63, 214, 205, 199], ["+", 3, 4, 0, 28, 0, 213, 63, 214, 205, 199], ["-", 8, 201, 0, 235, 8, 201, 0, 195, 39, 199], ["+", 8, 201, 0, 235, 8, 201, 0, 195, 39, 199], ["-", 8, 201, 0, 195, 54, 55, 0, 220, 39, 199], ["+", 8, 201, 0, 195, 54, 55, 0, 220, 39, 199]]
| 8
| 100
| 12
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AOJ {
class Program {
static void Main(string[] args) {
var n = int.Parse(Console.ReadLine());
var r = 1;
while (n-- != 0)
r *= n + 1;
Console.WriteLine(r);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AOJ {
class Program {
static void Main(string[] args) {
var n = int.Parse(Console.ReadLine());
long r = 1;
while (n-- != 0)
r *= n + 1;
Console.WriteLine(r);
}
}
}
|
[["-", 8, 196, 0, 197, 0, 198, 39, 216, 0, 217], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 78
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace test {
class Program {
static void Main(string[] args) {
int n = int.Parse(Console.ReadLine());
int a = 1;
for (int i = 1; i <= n; i++) {
a *= i;
}
Console.WriteLine(a);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace test {
class Program {
static void Main(string[] args) {
int n = int.Parse(Console.ReadLine());
long a = 1;
for (int i = 1; i <= n; i++) {
a *= i;
}
Console.WriteLine(a);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 85
| 2
|
using System;
class Factorial {
static void Main() {
int input;
input = int.Parse(Console.ReadLine());
Console.WriteLine(Fact(input));
}
static int Fact(int num) {
if (num == 0) {
return 1;
} else {
return num * Fact(num - 1);
}
}
}
|
using System;
class Factorial {
static void Main() {
long input;
input = long.Parse(Console.ReadLine());
Console.WriteLine(Fact(input));
}
static long Fact(long num) {
if (num == 0) {
return 1;
} else {
return num * Fact(num - 1);
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["+", 0, 1, 0, 11, 12, 213, 63, 214, 205, 199], ["-", 0, 208, 0, 235, 8, 201, 0, 195, 39, 199], ["+", 0, 208, 0, 235, 8, 201, 0, 195, 39, 199], ["-", 8, 201, 0, 195, 54, 55, 0, 220, 39, 199], ["+", 8, 201, 0, 195, 54, 55, 0, 220, 39, 199]]
| 8
| 73
| 8
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace contest19 {
class Program {
static void Main(string[] args) {
var read_line_origin = Console.ReadLine();
// string[] read_line = read_line_origin.Split();
int n = int.Parse(read_line_origin);
int ans = 1;
for (int i = n; i > 0; i--) {
ans *= i;
}
Console.WriteLine("{0}", ans);
// Console.ReadKey();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace contest19 {
class Program {
static void Main(string[] args) {
var read_line_origin = Console.ReadLine();
// string[] read_line = read_line_origin.Split();
int n = int.Parse(read_line_origin);
long ans = 1;
for (int i = n; i > 0; i--) {
ans *= i;
}
Console.WriteLine("{0}", ans);
// Console.ReadKey();
}
}
}
|
[["-", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199], ["+", 0, 195, 8, 196, 0, 197, 0, 198, 39, 199]]
| 8
| 96
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
StringBuilder sb = new StringBuilder();
while (true) {
int n = int.Parse(Console.ReadLine());
if (n == 0)
break;
int[] memo = new int[n];
memo[0] = int.Parse(Console.ReadLine());
int sum = memo[0];
int max = int.MinValue / 2;
for (int i = 1; i < n; i++) {
memo[i] = int.Parse(Console.ReadLine());
sum = Math.Max(sum + memo[i], memo[i]);
max = Math.Max(max, sum);
}
sb.AppendLine(max.ToString());
}
Console.Write(sb);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
StringBuilder sb = new StringBuilder();
while (true) {
int n = int.Parse(Console.ReadLine());
if (n == 0)
break;
int[] memo = new int[n];
memo[0] = int.Parse(Console.ReadLine());
int sum = memo[0];
int max = memo[0];
for (int i = 1; i < n; i++) {
memo[i] = int.Parse(Console.ReadLine());
sum = Math.Max(sum + memo[i], memo[i]);
max = Math.Max(max, sum);
}
sb.AppendLine(max.ToString());
}
Console.Write(sb);
}
}
}
|
[["-", 0, 200, 0, 212, 0, 16, 31, 214, 205, 199], ["-", 0, 200, 0, 212, 0, 16, 31, 214, 0, 131], ["-", 0, 200, 0, 212, 0, 16, 31, 214, 141, 22], ["-", 0, 198, 0, 200, 0, 212, 0, 16, 17, 85], ["-", 0, 198, 0, 200, 0, 212, 0, 16, 12, 203], ["+", 0, 198, 0, 200, 0, 212, 0, 204, 205, 22], ["+", 0, 200, 0, 212, 0, 204, 206, 207, 0, 70], ["+", 0, 212, 0, 204, 206, 207, 0, 28, 0, 203], ["+", 0, 200, 0, 212, 0, 204, 206, 207, 0, 73]]
| 8
| 199
| 9
|
using System;
class Program {
static void Main() {
string s = Console.ReadLine();
int n;
while ((n = int.Parse(s)) != 0) {
int max = -100001;
int sum = 0;
while (n-- > 0) {
int m = int.Parse(Console.ReadLine());
sum += m;
if (sum > max)
max = sum;
if (sum < 0)
sum = 0;
}
Console.WriteLine(sum);
s = Console.ReadLine();
}
}
}
|
using System;
class Program {
static void Main() {
string s = Console.ReadLine();
int n;
while ((n = int.Parse(s)) != 0) {
int max = -100001;
int sum = 0;
while (n-- > 0) {
int m = int.Parse(Console.ReadLine());
sum += m;
if (sum > max)
max = sum;
if (sum < 0)
sum = 0;
}
Console.WriteLine(max);
s = Console.ReadLine();
}
}
}
|
[["-", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22], ["+", 0, 1, 0, 213, 3, 4, 0, 28, 0, 22]]
| 8
| 116
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mondai0022 {
class Program {
static void Main(string[] args) {
while (true) {
var n = int.Parse(Console.ReadLine());
if (n == 0) {
break;
}
var a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = long.Parse(Console.ReadLine());
}
var max = a[0];
for (int i = 0; i < n - 1; i++) {
long sum = 0;
for (int j = i; j < n; j++) {
sum += a[j];
if (sum > max) {
max = sum;
}
}
}
Console.WriteLine(max);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mondai0022 {
class Program {
static void Main(string[] args) {
while (true) {
var n = int.Parse(Console.ReadLine());
if (n == 0) {
break;
}
var a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = long.Parse(Console.ReadLine());
}
var max = long.MinValue;
for (int i = 0; i < n; i++) {
long sum = 0;
for (int j = i; j < n; j++) {
sum += a[j];
if (sum > max) {
max = sum;
}
}
}
Console.WriteLine(max);
}
}
}
}
|
[["-", 0, 198, 0, 200, 0, 212, 0, 204, 205, 22], ["-", 0, 200, 0, 212, 0, 204, 206, 207, 0, 70], ["-", 0, 212, 0, 204, 206, 207, 0, 28, 0, 203], ["-", 0, 200, 0, 212, 0, 204, 206, 207, 0, 73], ["+", 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, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 203]]
| 8
| 183
| 9
|
using System;
namespace AOJ0023 {
class Program {
static void Main(string[] args) {
string input = Console.ReadLine();
int N = int.Parse(input);
int output;
for (int i = 0; i < N; i++) {
input = Console.ReadLine();
string[] num = input.Split(' ');
Circle A = new Circle(num[0], num[1], num[2]);
Circle B = new Circle(num[3], num[4], num[5]);
output = A.Cross(B);
Console.WriteLine(output);
}
}
}
public struct Circle {
decimal X, Y, R;
public Circle(string k, string l, string m) {
this.X = decimal.Parse(k);
this.Y = decimal.Parse(l);
this.R = decimal.Parse(m);
}
public int Cross(Circle A) {
int z;
decimal dis =
(A.X - this.X) * (A.X - this.X) + (A.Y - this.Y) * (A.Y - this.Y);
if (A.R > this.R) {
if (dis > A.R * A.R + 2 * A.R * this.R + this.R * this.R) {
z = 0;
} else if (dis < A.R * A.R - 2 * A.R * this.R + this.R * this.R) {
z = 2;
} else {
z = 1;
}
} else if (A.R < this.R) {
if (dis > A.R * A.R + 2 * A.R * this.R + this.R * this.R) {
z = 0;
} else if (dis < A.R * A.R - 2 * A.R * this.R + this.R * this.R) {
z = -2;
} else {
z = 1;
}
} else {
if (dis > A.R * A.R + 2 * A.R * this.R + this.R * this.R) {
z = 0;
} else {
z = 1;
}
}
return z;
}
}
}
|
using System;
namespace AOJ0023 {
class Program {
static void Main(string[] args) {
string input = Console.ReadLine();
int N = int.Parse(input);
int output;
for (int i = 0; i < N; i++) {
input = Console.ReadLine();
string[] num = input.Split(' ');
Circle A = new Circle(num[0], num[1], num[2]);
Circle B = new Circle(num[3], num[4], num[5]);
output = A.Cross(B);
Console.WriteLine(output);
}
}
}
public struct Circle {
decimal X, Y, R;
public Circle(string k, string l, string m) {
this.X = decimal.Parse(k);
this.Y = decimal.Parse(l);
this.R = decimal.Parse(m);
}
public int Cross(Circle A) {
int z;
decimal dis =
(A.X - this.X) * (A.X - this.X) + (A.Y - this.Y) * (A.Y - this.Y);
if (A.R > this.R) {
if (dis > A.R * A.R + 2 * A.R * this.R + this.R * this.R) {
z = 0;
} else if (dis < A.R * A.R - 2 * A.R * this.R + this.R * this.R) {
z = -2;
} else {
z = 1;
}
} else if (A.R < this.R) {
if (dis > A.R * A.R + 2 * A.R * this.R + this.R * this.R) {
z = 0;
} else if (dis < A.R * A.R - 2 * A.R * this.R + this.R * this.R) {
z = 2;
} else {
z = 1;
}
} else {
if (dis > A.R * A.R + 2 * A.R * this.R + this.R * this.R) {
z = 0;
} else {
z = 1;
}
}
return z;
}
}
}
|
[["+", 64, 196, 0, 1, 0, 11, 12, 241, 0, 33], ["-", 64, 196, 0, 1, 0, 11, 12, 241, 0, 33]]
| 8
| 491
| 2
|
using System;
class A {
public static void Main() {
int n = int.Parse(Console.ReadLine());
for (int i = 0; i < n; i++) {
string[] s = Console.ReadLine().Split(' ');
double xa = double.Parse(s[0]);
double ya = double.Parse(s[1]);
double ra = double.Parse(s[2]);
double xb = double.Parse(s[3]);
double yb = double.Parse(s[4]);
double rb = double.Parse(s[5]);
double distance = Math.Pow(xb - xa, 2) + Math.Pow(yb - ya, 2);
if (distance > ra + rb) {
Console.WriteLine("0");
} else if (distance + rb < ra) {
Console.WriteLine("2");
} else if (distance + ra < rb) {
Console.WriteLine("-2");
} else {
Console.WriteLine("1");
}
}
}
}
|
using System;
class A {
public static void Main() {
int n = int.Parse(Console.ReadLine());
for (int i = 0; i < n; i++) {
string[] s = Console.ReadLine().Split(' ');
double xa = double.Parse(s[0]);
double ya = double.Parse(s[1]);
double ra = double.Parse(s[2]);
double xb = double.Parse(s[3]);
double yb = double.Parse(s[4]);
double rb = double.Parse(s[5]);
double distance = Math.Sqrt(Math.Pow(xb - xa, 2) + Math.Pow(yb - ya, 2));
if (distance > ra + rb) {
Console.WriteLine("0");
} else if (distance + rb < ra) {
Console.WriteLine("2");
} else if (distance + ra < rb) {
Console.WriteLine("-2");
} else {
Console.WriteLine("1");
}
}
}
}
|
[["+", 0, 200, 0, 212, 0, 213, 63, 214, 141, 22], ["+", 0, 200, 0, 212, 0, 213, 3, 4, 0, 24], ["+", 0, 28, 0, 16, 31, 213, 63, 214, 205, 22], ["+", 0, 28, 0, 16, 31, 213, 63, 214, 0, 131], ["+", 0, 28, 0, 16, 12, 213, 3, 4, 0, 25]]
| 8
| 237
| 5
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Vol0_24 {
class Program {
static void Main(string[] args) {
string sInput = "";
// ??\??????????????????
do {
sInput = Console.ReadLine();
if (sInput != null && sInput != "") {
double dSpeed = double.Parse(sInput);
int N = getN(getY(getTime(dSpeed)));
Console.WriteLine("{0}", N);
}
} while (sInput != null && sInput != "");
}
// ??????????????§????§???°????±?????????????
static double getTime(double dSpeed) {
double t = dSpeed / 9.8;
return t;
}
// ?????¢????±?????????????
static double getY(double t) {
double y = 4.9 * t * t; // ?????¨?????\
return y;
}
// ?????¢???????????°???????????????
static int getN(double y) {
int N = 0;
N = (int)((y + 5) / 5 + 0.5);
return N;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Vol0_24 {
class Program {
static void Main(string[] args) {
string sInput = "";
// ??\??????????????????
do {
sInput = Console.ReadLine();
if (sInput != null && sInput != "") {
double dSpeed = double.Parse(sInput);
int N = getN(getY(getTime(dSpeed)));
Console.WriteLine("{0}", N);
}
} while (sInput != null && sInput != "");
}
// ??????????????§????§???°????±?????????????
static double getTime(double dSpeed) {
double t = dSpeed / 9.8;
return t;
}
// ?????¢????±?????????????
static double getY(double t) {
double y = 4.9 * t * t; // ?????¨?????\
return y;
}
// ?????¢???????????°???????????????
static int getN(double y) {
int N = 0;
N = (int)((y + 5) / 5 + 1);
return N;
}
}
}
|
[["-", 0, 11, 12, 74, 51, 23, 0, 16, 12, 250], ["+", 0, 11, 12, 74, 51, 23, 0, 16, 12, 203]]
| 8
| 195
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace test {
class Program {
static void Main(string[] args) {
List<double> resultList = new List<double>();
string input;
while ((input = Console.ReadLine()) != null) {
double minV = double.Parse(input);
double minT = minV / 9.8;
double minY = 4.9 * Math.Pow(minT, 2);
int minFloor;
if (minY == 0) {
minFloor = 1;
} else {
minFloor = (int)Math.Ceiling(minY) / 5 + 2;
}
resultList.Add(minFloor);
}
foreach (int a in resultList) {
Console.WriteLine(a);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace test {
class Program {
static void Main(string[] args) {
List<double> resultList = new List<double>();
string input;
while ((input = Console.ReadLine()) != null) {
double minV = double.Parse(input);
double minT = minV / 9.8;
double minY = 4.9 * Math.Pow(minT, 2);
int minFloor;
if (minY == 0) {
minFloor = 1;
} else {
minFloor = (int)Math.Floor(minY) / 5 + 2;
}
resultList.Add(minFloor);
}
foreach (int a in resultList) {
Console.WriteLine(a);
}
}
}
}
|
[["-", 31, 16, 31, 74, 51, 213, 63, 214, 141, 22], ["+", 31, 16, 31, 74, 51, 213, 63, 214, 141, 22]]
| 8
| 160
| 2
|
using System;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
int[] a = new int[4];
int[] b = new int[4];
string str;
while ((str = Console.ReadLine()) != null) {
int hit = 0;
int blow = 0;
string[] s = str.Split();
for (int i = 0; i < 4; i++) {
a[i] = int.Parse(s[i]);
}
s = str.Split();
for (int i = 0; i < 4; i++) {
b[i] = int.Parse(s[i]);
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (a[i] == b[j]) {
if (i == j) {
hit++;
} else {
blow++;
}
}
}
}
Console.WriteLine(hit + " " + blow);
}
}
}
}
|
using System;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
int[] a = new int[4];
int[] b = new int[4];
string str;
while ((str = Console.ReadLine()) != null) {
int hit = 0;
int blow = 0;
string[] s = str.Split();
for (int i = 0; i < 4; i++) {
a[i] = int.Parse(s[i]);
}
s = Console.ReadLine().Split();
for (int i = 0; i < 4; i++) {
b[i] = int.Parse(s[i]);
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (a[i] == b[j]) {
if (i == j) {
hit++;
} else {
blow++;
}
}
}
}
Console.WriteLine(hit + " " + blow);
}
}
}
}
|
[["-", 0, 1, 0, 11, 12, 213, 63, 214, 205, 22], ["+", 12, 213, 63, 214, 205, 213, 63, 214, 205, 22], ["+", 12, 213, 63, 214, 205, 213, 63, 214, 0, 131], ["+", 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
| 230
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication33 {
class Program {
static void Main() {
while (true) {
int x = 0, y = 0;
string a = Console.ReadLine();
if (a == null)
break;
string[] b = a.Split();
string c = Console.ReadLine();
if (c == null)
break;
string[] d = c.Split();
for (int e = 0; e < 4; e++) {
if (b[e] == d[e]) {
x++;
for (int u = e; u < 4; u++) {
try {
b[u] = b[u + 1];
} catch {
b[u] = "b";
}
try {
d[u] = d[u + 1];
} catch {
d[u] = "a";
}
}
}
}
string[] k = new string[4 - x];
for (int r = 0; r < 4 - x; r++) {
k[r] = b[r];
}
string[] q = new string[4 - x];
for (int o = 0; o < 4 - x; o++) {
q[o] = d[o];
}
for (int h = 0; h < 4 - x; h++) {
for (int w = 0; w < 4 - x; w++) {
if (k[h] == q[w])
y++;
}
}
Console.WriteLine(x + " " + y);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication33 {
class Program {
static void Main() {
while (true) {
int x = 0, y = 0;
string a = Console.ReadLine();
if (a == null)
break;
string[] b = a.Split();
string c = Console.ReadLine();
if (c == null)
break;
string[] d = c.Split();
for (int e = 0; e < 4; e++) {
if (b[e] == d[e]) {
x++;
for (int u = e; u < 4; u++) {
try {
b[u] = b[u + 1];
} catch {
b[u] = "b";
}
try {
d[u] = d[u + 1];
} catch {
d[u] = "a";
}
}
e = -1;
}
}
string[] k = new string[4 - x];
for (int r = 0; r < 4 - x; r++) {
k[r] = b[r];
}
string[] q = new string[4 - x];
for (int o = 0; o < 4 - x; o++) {
q[o] = d[o];
}
for (int h = 0; h < 4 - x; h++) {
for (int w = 0; w < 4 - x; w++) {
if (k[h] == q[w])
y++;
}
}
Console.WriteLine(x + " " + y);
}
}
}
}
|
[["+", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["+", 64, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["+", 64, 196, 0, 1, 0, 11, 12, 241, 0, 33], ["+", 64, 196, 0, 1, 0, 11, 12, 241, 0, 203], ["+", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35]]
| 8
| 355
| 5
|
using System;
namespace AOJ.Volume0 {
public class DroppingInk {
public static void Main() {
// 紙を初期化
int[,] paper = new int[10, 10];
// 入力がなくなるまで処理
while (true) {
string input = Console.ReadLine();
if (string.IsNullOrEmpty(input)) {
break;
}
var data = input.Split(',');
int x = int.Parse(data[0]);
int y = int.Parse(data[1]);
int vol = int.Parse(data[2]);
// インクの滲み処理
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
switch (vol) {
case 1:
// 小の場合(x, y)からの距離が1以下の位置に滲む
if (Math.Abs(x - i) + Math.Abs(y - j) <= 1) {
paper[i, j]++;
}
break;
case 2:
// 中の場合(x, y)のx方向の距離が1またはy方向の距離が1の位置に滲む
if (Math.Abs(x - i) <= 1 || Math.Abs(y - j) <= 1) {
paper[i, j]++;
}
break;
case 3:
// 大の場合(x, y)からの距離が2以下の位置に滲む
if (Math.Abs(x - i) + Math.Abs(y - j) <= 2) {
paper[i, j]++;
}
break;
}
}
}
}
// 回答
int white = 0;
int max = 0;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
if (paper[i, j] == 0) {
white++;
}
max = Math.Max(max, paper[i, j]);
}
}
Console.WriteLine(white);
Console.WriteLine(max);
}
}
}
|
using System;
namespace AOJ.Volume0 {
public class DroppingInk {
public static void Main() {
// 紙を初期化
int[,] paper = new int[10, 10];
// 入力がなくなるまで処理
while (true) {
string input = Console.ReadLine();
if (string.IsNullOrEmpty(input)) {
break;
}
var data = input.Split(',');
int x = int.Parse(data[0]);
int y = int.Parse(data[1]);
int vol = int.Parse(data[2]);
// インクの滲み処理
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
switch (vol) {
case 1:
// 小の場合(x, y)からの距離が1以下の位置に滲む
if (Math.Abs(x - i) + Math.Abs(y - j) <= 1) {
paper[i, j]++;
}
break;
case 2:
// 中の場合(x,
// y)のx方向の距離が1以下かつy方向の距離が1以下の位置に滲む
if (Math.Abs(x - i) <= 1 && Math.Abs(y - j) <= 1) {
paper[i, j]++;
}
break;
case 3:
// 大の場合(x, y)からの距離が2以下の位置に滲む
if (Math.Abs(x - i) + Math.Abs(y - j) <= 2) {
paper[i, j]++;
}
break;
}
}
}
}
// 回答
int white = 0;
int max = 0;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
if (paper[i, j] == 0) {
white++;
}
max = Math.Max(max, paper[i, j]);
}
}
Console.WriteLine(white);
Console.WriteLine(max);
}
}
}
|
[["-", 8, 254, 0, 239, 0, 57, 15, 16, 17, 106], ["+", 8, 254, 0, 239, 0, 57, 15, 16, 17, 98]]
| 8
| 361
| 2
|
using System;
namespace AOJ0026 {
class Program {
static void Main(string[] args) {
string input;
int[,] plain = new int[14, 14];
while (true) {
input = Console.ReadLine();
if (string.IsNullOrEmpty(input) == true) {
break;
}
string[] num = input.Split(',');
int x = int.Parse(num[0]);
int y = int.Parse(num[1]);
int size = int.Parse(num[2]);
switch (size) {
case 1:
plain[x + 2, y + 1]++;
plain[x + 1, y + 2]++;
plain[x + 2, y + 2]++;
plain[x + 3, y + 2]++;
plain[x + 2, y + 3]++;
break;
case 2:
plain[x + 1, y + 1]++;
plain[x + 2, y + 1]++;
plain[x + 3, y + 1]++;
plain[x + 1, y + 2]++;
plain[x + 2, y + 2]++;
plain[x + 3, y + 2]++;
plain[x + 1, y + 3]++;
plain[x + 2, y + 3]++;
plain[x + 3, y + 3]++;
break;
case 3:
plain[x + 2, y]++;
plain[x + 1, y + 1]++;
plain[x + 2, y + 1]++;
plain[x + 3, y + 1]++;
plain[x, y + 1]++;
plain[x + 1, y + 2]++;
plain[x + 2, y + 2]++;
plain[x + 3, y + 2]++;
plain[x + 4, y + 2]++;
plain[x + 1, y + 3]++;
plain[x + 2, y + 3]++;
plain[x + 3, y + 3]++;
plain[x + 2, y + 4]++;
break;
}
}
int count = 0;
int highest = 0;
for (int i = 2; i < 12; i++) {
for (int j = 2; j < 12; j++) {
if (plain[i, j] == 0) {
count++;
} else if (plain[i, j] > highest) {
highest = plain[i, j];
}
}
}
Console.WriteLine(count);
Console.WriteLine(highest);
}
}
}
|
using System;
namespace AOJ0026 {
class Program {
static void Main(string[] args) {
string input;
int[,] plain = new int[14, 14];
while (true) {
input = Console.ReadLine();
if (string.IsNullOrEmpty(input) == true) {
break;
}
string[] num = input.Split(',');
int x = int.Parse(num[0]);
int y = int.Parse(num[1]);
int size = int.Parse(num[2]);
switch (size) {
case 1:
plain[x + 2, y + 1]++;
plain[x + 1, y + 2]++;
plain[x + 2, y + 2]++;
plain[x + 3, y + 2]++;
plain[x + 2, y + 3]++;
break;
case 2:
plain[x + 1, y + 1]++;
plain[x + 2, y + 1]++;
plain[x + 3, y + 1]++;
plain[x + 1, y + 2]++;
plain[x + 2, y + 2]++;
plain[x + 3, y + 2]++;
plain[x + 1, y + 3]++;
plain[x + 2, y + 3]++;
plain[x + 3, y + 3]++;
break;
case 3:
plain[x + 2, y]++;
plain[x + 1, y + 1]++;
plain[x + 2, y + 1]++;
plain[x + 3, y + 1]++;
plain[x, y + 2]++;
plain[x + 1, y + 2]++;
plain[x + 2, y + 2]++;
plain[x + 3, y + 2]++;
plain[x + 4, y + 2]++;
plain[x + 1, y + 3]++;
plain[x + 2, y + 3]++;
plain[x + 3, y + 3]++;
plain[x + 2, y + 4]++;
break;
}
}
int count = 0;
int highest = 0;
for (int i = 2; i < 12; i++) {
for (int j = 2; j < 12; j++) {
if (plain[i, j] == 0) {
count++;
} else if (plain[i, j] > highest) {
highest = plain[i, j];
}
}
}
Console.WriteLine(count);
Console.WriteLine(highest);
}
}
}
|
[["-", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203], ["+", 0, 204, 206, 207, 0, 28, 0, 16, 12, 203]]
| 8
| 557
| 2
|
using System;
class Program {
static int[,] table = new int[10, 10];
static void Main() {
String s;
while ((s = Console.ReadLine()) != null) {
int[] a = Array.ConvertAll(s.Split(' '), int.Parse);
switch (a[2]) {
case 1:
inkS(a[0], a[1]);
break;
case 2:
inkM(a[0], a[1]);
break;
case 3:
inkL(a[0], a[1]);
break;
}
}
int max = 0;
int zeros = 0;
foreach (int n in table) {
if (n == 0)
zeros++;
if (n > max)
max = n;
}
Console.WriteLine(zeros);
Console.WriteLine(max);
}
static void ink(int x, int y) {
if (0 <= x && x < 10 && 0 <= y && y < 10)
table[x, y]++;
}
static void inkS(int x, int y) {
ink(x, y);
ink(x + 1, y);
ink(x - 1, y);
ink(x, y + 1);
ink(x, y - 1);
}
static void inkM(int x, int y) {
inkS(x, y);
ink(x + 1, y + 1);
ink(x + 1, y - 1);
ink(x - 1, y + 1);
ink(x - 1, y - 1);
}
static void inkL(int x, int y) {
inkM(x, y);
ink(x + 2, y);
ink(x - 2, y);
ink(x, y + 2);
ink(x, y - 2);
}
}
|
using System;
class Program {
static int[,] table = new int[10, 10];
static void Main() {
String s;
while ((s = Console.ReadLine()) != null) {
int[] a = Array.ConvertAll(s.Split(','), int.Parse);
switch (a[2]) {
case 1:
inkS(a[0], a[1]);
break;
case 2:
inkM(a[0], a[1]);
break;
case 3:
inkL(a[0], a[1]);
break;
}
}
int max = 0;
int zeros = 0;
foreach (int n in table) {
if (n == 0)
zeros++;
if (n > max)
max = n;
}
Console.WriteLine(zeros);
Console.WriteLine(max);
}
static void ink(int x, int y) {
if (0 <= x && x < 10 && 0 <= y && y < 10)
table[x, y]++;
}
static void inkS(int x, int y) {
ink(x, y);
ink(x + 1, y);
ink(x - 1, y);
ink(x, y + 1);
ink(x, y - 1);
}
static void inkM(int x, int y) {
inkS(x, y);
ink(x + 1, y + 1);
ink(x + 1, y - 1);
ink(x - 1, y + 1);
ink(x - 1, y - 1);
}
static void inkL(int x, int y) {
inkM(x, y);
ink(x + 2, y);
ink(x - 2, y);
ink(x, y + 2);
ink(x, y - 2);
}
}
|
[["-", 0, 213, 3, 4, 0, 28, 0, 252, 0, 253], ["+", 0, 213, 3, 4, 0, 28, 0, 252, 0, 253]]
| 8
| 397
| 2
|
using System;
using System.Linq;
namespace Volume0_0026 {
class Program {
static void Main(string[] args) {
int[,] paper = new int[10, 10];
string input;
while ((input = Console.ReadLine()) != "") {
int[] inkData =
input.Split(',').Select(s => Convert.ToInt32(s)).ToArray();
InkBase ink;
switch (inkData[2]) {
case 1:
ink = new InkSmall(paper);
break;
case 2:
ink = new InkMedium(paper);
break;
case 3:
ink = new InkLarge(paper);
break;
default:
throw new Exception();
}
ink.Apply(new Point(inkData[0], inkData[1]));
}
var result = paper.Cast<int>().ToList();
Console.WriteLine(result.Where(i => i == 0).Count());
Console.WriteLine(result.Max());
}
}
public abstract class InkBase {
protected int[,] Paper;
protected int[,] Data { get; set; }
public InkBase(int[,] paper) { Paper = paper; }
public virtual void Apply(Point center) {
int offsetX = center.X - Data.GetLength(1) / 2 < 0
? Data.GetLength(1) / 2 - center.X
: 0;
int offsetY = center.Y - Data.GetLength(0) / 2 < 0
? Data.GetLength(0) / 2 - center.Y
: 0;
int startX = Math.Max(center.X - Data.GetLength(1) / 2, 0);
int endX =
Math.Min(center.X + Data.GetLength(1) / 2 + 1, Paper.GetLength(1));
int startY = Math.Max(center.Y - Data.GetLength(0) / 2, 0);
int endY =
Math.Min(center.Y + Data.GetLength(0) / 2 + 1, Paper.GetLength(0));
for (int y = startY; y < endY; y++) {
for (int x = startX; x < endX; x++) {
Paper[y, x] += Data[y - startY + offsetY, x - startX + offsetX];
}
}
}
}
public class InkSmall : InkBase {
public InkSmall(int[,] paper) : base(paper) {
Data = new int[3, 3] { { 0, 1, 0 }, { 1, 1, 1 }, { 0, 1, 0 } };
}
}
public class InkMedium : InkBase {
public InkMedium(int[,] paper) : base(paper) {
Data = new int[3, 3] { { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 } };
}
}
public class InkLarge : InkBase {
public InkLarge(int[,] paper) : base(paper) {
Data = new int[5, 5] { { 0, 0, 1, 0, 0 },
{ 0, 1, 1, 1, 0 },
{ 1, 1, 1, 1, 1 },
{ 0, 1, 1, 1, 0 },
{ 0, 0, 1, 0, 0 } };
}
}
public class Point {
public int X { get; set; }
public int Y { get; set; }
public Point(int x, int y) {
X = x;
Y = y;
}
}
}
|
using System;
using System.Linq;
namespace Volume0_0026 {
class Program {
static void Main(string[] args) {
int[,] paper = new int[10, 10];
string input;
while ((input = Console.ReadLine()) != null) {
int[] inkData =
input.Split(',').Select(s => Convert.ToInt32(s)).ToArray();
InkBase ink;
switch (inkData[2]) {
case 1:
ink = new InkSmall(paper);
break;
case 2:
ink = new InkMedium(paper);
break;
case 3:
ink = new InkLarge(paper);
break;
default:
throw new Exception();
}
ink.Apply(new Point(inkData[0], inkData[1]));
}
var result = paper.Cast<int>().ToList();
Console.WriteLine(result.Where(i => i == 0).Count());
Console.WriteLine(result.Max());
}
}
public abstract class InkBase {
protected int[,] Paper;
protected int[,] Data { get; set; }
public InkBase(int[,] paper) { Paper = paper; }
public virtual void Apply(Point center) {
int offsetX = center.X - Data.GetLength(1) / 2 < 0
? Data.GetLength(1) / 2 - center.X
: 0;
int offsetY = center.Y - Data.GetLength(0) / 2 < 0
? Data.GetLength(0) / 2 - center.Y
: 0;
int startX = Math.Max(center.X - Data.GetLength(1) / 2, 0);
int endX =
Math.Min(center.X + Data.GetLength(1) / 2 + 1, Paper.GetLength(1));
int startY = Math.Max(center.Y - Data.GetLength(0) / 2, 0);
int endY =
Math.Min(center.Y + Data.GetLength(0) / 2 + 1, Paper.GetLength(0));
for (int y = startY; y < endY; y++) {
for (int x = startX; x < endX; x++) {
Paper[y, x] += Data[y - startY + offsetY, x - startX + offsetX];
}
}
}
}
public class InkSmall : InkBase {
public InkSmall(int[,] paper) : base(paper) {
Data = new int[3, 3] { { 0, 1, 0 }, { 1, 1, 1 }, { 0, 1, 0 } };
}
}
public class InkMedium : InkBase {
public InkMedium(int[,] paper) : base(paper) {
Data = new int[3, 3] { { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 } };
}
}
public class InkLarge : InkBase {
public InkLarge(int[,] paper) : base(paper) {
Data = new int[5, 5] { { 0, 0, 1, 0, 0 },
{ 0, 1, 1, 1, 0 },
{ 1, 1, 1, 1, 1 },
{ 0, 1, 1, 1, 0 },
{ 0, 0, 1, 0, 0 } };
}
}
public class Point {
public int X { get; set; }
public int Y { get; set; }
public Point(int x, int y) {
X = x;
Y = y;
}
}
}
|
[["-", 8, 196, 0, 52, 15, 16, 12, 5, 0, 62], ["+", 0, 195, 8, 196, 0, 52, 15, 16, 12, 215]]
| 8
| 744
| 3
|
using System;
namespace AOJ0027 {
class Program {
static void Main(string[] args) {
int[] DoM = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
while (true) {
string input = Console.ReadLine();
string[] num = input.Split(' ');
int count = 0;
string output = "";
if (int.Parse(num[0]) == 0) {
break;
}
for (int i = 0; i < int.Parse(num[0]) - 1; i++) {
count += DoM[i];
}
count += int.Parse(num[1]);
switch (count % 7) {
case 1:
output = "Thursday";
break;
case 2:
output = "Friday";
break;
case 3:
output = "Saturday";
break;
case 4:
output = "Sunday";
break;
case 5:
output = "Monday";
break;
case 6:
output = "Tuesday";
break;
case 7:
output = "Wednesday";
break;
}
Console.WriteLine(output);
}
}
}
}
|
using System;
namespace AOJ0027 {
class Program {
static void Main(string[] args) {
int[] DoM = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
while (true) {
string input = Console.ReadLine();
string[] num = input.Split(' ');
int count = 0;
string output = "";
if (int.Parse(num[0]) == 0) {
break;
}
for (int i = 0; i < int.Parse(num[0]) - 1; i++) {
count += DoM[i];
}
count += int.Parse(num[1]);
switch (count % 7) {
case 1:
output = "Thursday";
break;
case 2:
output = "Friday";
break;
case 3:
output = "Saturday";
break;
case 4:
output = "Sunday";
break;
case 5:
output = "Monday";
break;
case 6:
output = "Tuesday";
break;
case 0:
output = "Wednesday";
break;
}
Console.WriteLine(output);
}
}
}
}
|
[["-", 0, 99, 8, 254, 0, 239, 0, 264, 0, 203], ["+", 0, 99, 8, 254, 0, 239, 0, 264, 0, 203]]
| 8
| 248
| 2
|
using System;
class aoj {
static void Main() {
string[] a = new string[50];
int f = 0;
while (true) {
string[] b = Console.ReadLine().Split(' ');
if (b[0] == "0") {
break;
}
int[] c = new int[2];
c[0] = int.Parse(b[0]);
c[1] = int.Parse(b[1]);
DateTime d = new DateTime(2004, c[0], c[1]);
DayOfWeek e = d.DayOfWeek;
int g = (int)e;
switch (g) {
case 0:
a[f] = "Sunday";
break;
case 1:
a[f] = "Monday";
break;
case 2:
a[f] = "Tuesday";
break;
case 3:
a[f] = "Wednesday";
break;
case 4:
a[f] = "Thursday";
break;
case 5:
a[f] = "Friday";
break;
case 6:
a[f] = "Suturday";
break;
}
f++;
}
for (int i = 0; i < f; i++) {
Console.WriteLine(a[i]);
}
}
}
|
using System;
class aoj {
static void Main() {
string[] a = new string[50];
int f = 0;
while (true) {
string[] b = Console.ReadLine().Split(' ');
if (b[0] == "0") {
break;
}
int[] c = new int[2];
c[0] = int.Parse(b[0]);
c[1] = int.Parse(b[1]);
DateTime d = new DateTime(2004, c[0], c[1]);
DayOfWeek e = d.DayOfWeek;
int g = (int)e;
switch (g) {
case 0:
a[f] = "Sunday";
break;
case 1:
a[f] = "Monday";
break;
case 2:
a[f] = "Tuesday";
break;
case 3:
a[f] = "Wednesday";
break;
case 4:
a[f] = "Thursday";
break;
case 5:
a[f] = "Friday";
break;
case 6:
a[f] = "Saturday";
break;
}
f++;
}
for (int i = 0; i < f; i++) {
Console.WriteLine(a[i]);
}
}
}
|
[["-", 0, 239, 0, 1, 0, 11, 12, 5, 0, 222], ["+", 0, 239, 0, 1, 0, 11, 12, 5, 0, 222]]
| 8
| 277
| 2
|
using System;
using System.Linq;
namespace _0027 {
class Program {
static void Main(string[] args) {
while (true) {
int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
if (a[0] == a[1] && a[1] == 0) {
break;
}
int[] m = new int[13];
m[1] = 31;
m[2] = 29;
m[3] = 31;
m[4] = 30;
m[5] = 31;
m[6] = 30;
m[7] = 31;
m[8] = 31;
m[9] = 30;
m[10] = 31;
m[11] = 30;
m[12] = 31;
for (int i = 1; i <= a[0]; i++) {
a[1] += m[i];
}
int y = a[1] % 7;
if (y == 0) {
Console.WriteLine("Wednesday");
}
if (y == 1) {
Console.WriteLine("Thursday");
}
if (y == 2) {
Console.WriteLine("Friday");
}
if (y == 3) {
Console.WriteLine("Saturday");
}
if (y == 4) {
Console.WriteLine("Sunday");
}
if (y == 5) {
Console.WriteLine("Monday");
}
if (y == 6) {
Console.WriteLine("Tuesday");
}
}
}
}
}
|
using System;
using System.Linq;
namespace _0027 {
class Program {
static void Main(string[] args) {
while (true) {
int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
if (a[0] == a[1] && a[1] == 0) {
break;
}
int[] m = new int[13];
m[1] = 31;
m[2] = 29;
m[3] = 31;
m[4] = 30;
m[5] = 31;
m[6] = 30;
m[7] = 31;
m[8] = 31;
m[9] = 30;
m[10] = 31;
m[11] = 30;
m[12] = 31;
for (int i = 1; i < a[0]; i++) {
a[1] += m[i];
}
int y = a[1] % 7;
if (y == 0) {
Console.WriteLine("Wednesday");
}
if (y == 1) {
Console.WriteLine("Thursday");
}
if (y == 2) {
Console.WriteLine("Friday");
}
if (y == 3) {
Console.WriteLine("Saturday");
}
if (y == 4) {
Console.WriteLine("Sunday");
}
if (y == 5) {
Console.WriteLine("Monday");
}
if (y == 6) {
Console.WriteLine("Tuesday");
}
}
}
}
}
|
[["-", 0, 52, 8, 196, 0, 7, 15, 16, 17, 19], ["+", 0, 52, 8, 196, 0, 7, 15, 16, 17, 18]]
| 8
| 335
| 2
|
using System;
class _0027 {
public static void Main() {
string[] SD = { "Wednesday", "Thursday", "Friday", "Satruday",
"Sunday", "Monday", "Tuesday" };
int[] days = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30 };
string str = Console.ReadLine();
int count, m, d;
while (str != "0 0") {
count = 0;
m = int.Parse(str.Split()[0]);
d = int.Parse(str.Split()[1]);
for (int i = 0; i < m - 1; i++)
count += days[i];
for (int i = 0; i < d; i++)
count++;
Console.WriteLine(SD[count % 7]);
str = Console.ReadLine();
}
}
}
|
using System;
class _0027 {
public static void Main() {
string[] SD = { "Wednesday", "Thursday", "Friday", "Saturday",
"Sunday", "Monday", "Tuesday" };
int[] days = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30 };
string str = Console.ReadLine();
int count, m, d;
while (str != "0 0") {
count = 0;
m = int.Parse(str.Split()[0]);
d = int.Parse(str.Split()[1]);
for (int i = 0; i < m - 1; i++)
count += days[i];
for (int i = 0; i < d; i++)
count++;
Console.WriteLine(SD[count % 7]);
str = Console.ReadLine();
}
}
}
|
[["-", 0, 200, 0, 212, 0, 229, 0, 5, 0, 222], ["+", 0, 200, 0, 212, 0, 229, 0, 5, 0, 222]]
| 8
| 201
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication27 {
class Program {
static void Main() {
List<int> s = new List<int>();
int x = 0;
int y = 0;
List<int> z = new List<int>();
while (true) {
string a = Console.ReadLine();
if (a == null)
break; //????????????
int b = int.Parse(a);
s.Add(b);
}
s.Sort();
for (int c = 1; c < s[s.Count - 1] + 1; c++) {
int b;
for (b = 0; b < s.Count; b++) {
if (s[b] == c)
x++; //?????§??°??????????????????
}
if (x > y) {
for (int f = 0; f < z.Count; f++) {
z[f] =
-1; //??????????????§???????????°??¨????????????????????????????°?????¶????????????????
}
z.Add(c);
y = x;
x = 0;
} else if (x == y) {
z.Add(c);
x = 0;
} //????????????????°?????¶????
}
for (int t = 0; t < z.Count; t++) {
if (z[t] != -1)
Console.WriteLine(z[t]);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication27 {
class Program {
static void Main() {
List<int> s = new List<int>();
int x = 0;
int y = 0;
List<int> z = new List<int>();
while (true) {
string a = Console.ReadLine();
if (a == null)
break; //????????????
int b = int.Parse(a);
s.Add(b);
}
s.Sort();
for (int c = 1; c < s[s.Count - 1] + 1; c++) {
int b;
for (b = 0; b < s.Count; b++) {
if (s[b] == c)
x++; //?????§??°??????????????????
}
if (x > y) {
for (int f = 0; f < z.Count; f++) {
z[f] =
-1; //??????????????§???????????°??¨????????????????????????????°?????¶????????????????
}
z.Add(c);
y = x;
} else if (x == y) {
z.Add(c);
} //????????????????°?????¶????
x = 0;
}
for (int t = 0; t < z.Count; t++) {
if (z[t] != -1)
Console.WriteLine(z[t]);
}
}
}
}
|
[["-", 0, 57, 64, 196, 0, 1, 0, 11, 31, 22], ["-", 64, 196, 0, 1, 0, 11, 0, 202, 0, 32], ["-", 0, 57, 64, 196, 0, 1, 0, 11, 12, 203], ["-", 8, 196, 0, 57, 64, 196, 0, 1, 0, 35], ["+", 8, 196, 0, 57, 75, 57, 64, 196, 0, 46], ["-", 8, 196, 0, 57, 75, 57, 64, 196, 0, 46]]
| 8
| 287
| 6
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Library {
public class Miscelleneous {
public static void print(object j) { Console.WriteLine(j.ToString()); }
public static void print(string s) { Console.WriteLine(s); }
public static int cin() { return int.Parse(Console.ReadLine()); }
public static int[] cins() {
string[] ss = Console.ReadLine().Split(' ');
var res = new int[ss.Length];
for (int i = 0; i < ss.Length; i++)
res[i] = int.Parse(ss[i]);
return res;
}
public static void Main() {
int[] ss;
int[] N1 = new int[1024];
int[] S1 = new int[1024];
int c1, v;
for (int i = 0; i < 1024; i++) {
c1 = Enumerable.Range(0, 10)
.Select(k => ((i >> k) & 1) == 1)
.Where(k => k)
.Count();
v = Enumerable.Range(0, 10)
.Select(k => ((i >> k) & 1) == 1 ? k : 0)
.Sum();
N1[i] = c1;
S1[v] = v;
}
int Res;
while (true) {
ss = cins();
Res = 0;
if (ss[0] == 0 && ss[1] == 0)
break;
for (int i = 0; i < 1024; i++) {
if (N1[i] == ss[0] && S1[i] == ss[1])
Res++;
}
print(Res);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace Library {
public class Miscelleneous {
public static void print(object j) { Console.WriteLine(j.ToString()); }
public static void print(string s) { Console.WriteLine(s); }
public static int cin() { return int.Parse(Console.ReadLine()); }
public static int[] cins() {
string[] ss = Console.ReadLine().Split(' ');
var res = new int[ss.Length];
for (int i = 0; i < ss.Length; i++)
res[i] = int.Parse(ss[i]);
return res;
}
public static void Main() {
int[] ss;
int[] N1 = new int[1024];
int[] S1 = new int[1024];
int c1, v;
for (int i = 0; i < 1024; i++) {
c1 = Enumerable.Range(0, 10)
.Select(k => ((i >> k) & 1) == 1)
.Where(k => k)
.Count();
v = Enumerable.Range(0, 10)
.Select(k => ((i >> k) & 1) == 1 ? k : 0)
.Sum();
N1[i] = c1;
S1[i] = v;
}
int Res;
while (true) {
ss = cins();
Res = 0;
if (ss[0] == 0 && ss[1] == 0)
break;
for (int i = 0; i < 1024; i++) {
if (N1[i] == ss[0] && S1[i] == ss[1])
Res++;
}
print(Res);
}
}
}
}
|
[["-", 0, 11, 31, 204, 206, 207, 0, 28, 0, 22], ["+", 0, 11, 31, 204, 206, 207, 0, 28, 0, 22]]
| 8
| 383
| 2
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Programminng {
class AOJ_Volume0031 {
public static void Main(string[] args) {
int[] value = new int[10];
List<int> v = new List<int>();
for (int i = 0; i < 10; i++) {
value[i] = (int)Math.Pow(2, i);
}
Array.Reverse(value);
while (true) {
string s = Console.ReadLine();
if (string.IsNullOrEmpty(s))
break;
int w = int.Parse(s);
v.Clear();
for (int i = 0; i < 10; i++) {
if (value[i] <= w) {
w -= value[i];
v.Add(value[i]);
}
}
for (int i = v.Count - 1; i >= 0; i--) {
if (i == 0) {
Console.WriteLine(v[i]);
} else {
Console.WriteLine(v[i] + " ");
}
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Programminng {
class AOJ_Volume0031 {
public static void Main(string[] args) {
int[] value = new int[10];
List<int> v = new List<int>();
for (int i = 0; i < 10; i++) {
value[i] = (int)Math.Pow(2, i);
}
Array.Reverse(value);
while (true) {
string s = Console.ReadLine();
if (string.IsNullOrEmpty(s))
break;
int w = int.Parse(s);
v.Clear();
for (int i = 0; i < 10; i++) {
if (value[i] <= w) {
w -= value[i];
v.Add(value[i]);
}
}
for (int i = v.Count - 1; i >= 0; i--) {
if (i == 0) {
Console.WriteLine(v[i]);
} else {
Console.Write(v[i] + " ");
}
}
}
}
}
}
|
[["-", 75, 196, 0, 1, 0, 213, 63, 214, 141, 22], ["+", 75, 196, 0, 1, 0, 213, 63, 214, 141, 22]]
| 8
| 246
| 2
|
using System;
namespace AOJ.Volume0 {
public class Weight {
public static void Main() {
while (true) {
string input = Console.ReadLine();
if (string.IsNullOrEmpty(input)) {
break;
}
int weight = int.Parse(input);
var binary = Convert.ToString(weight, 2);
string output = "";
for (int i = binary.Length - 1; i >= 0; i--) {
if (binary.Substring(i, 1) == "1") {
output += Math.Pow(2, binary.Length - i) + " ";
}
}
output = output.Trim();
Console.WriteLine(output);
}
}
}
}
|
using System;
namespace AOJ.Volume0 {
public class Weight {
public static void Main() {
while (true) {
string input = Console.ReadLine();
if (string.IsNullOrEmpty(input)) {
break;
}
int weight = int.Parse(input);
var binary = Convert.ToString(weight, 2);
string output = "";
for (int i = binary.Length - 1; i >= 0; i--) {
if (binary.Substring(i, 1) == "1") {
output += Math.Pow(2, binary.Length - i - 1) + " ";
}
}
output = output.Trim();
Console.WriteLine(output);
}
}
}
}
|
[["+", 31, 213, 3, 4, 0, 28, 0, 16, 17, 33], ["+", 31, 213, 3, 4, 0, 28, 0, 16, 12, 203]]
| 8
| 149
| 2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.