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
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { List<Integer> list = new ArrayList<Integer>(); String s; while ((s = br.readLine()) != null || list.size() <= 200) { String[] num = s.split(" "); if (0 <= Integer.parseInt(num[0]) && Integer.parseInt(num[1]) <= 1000000) { int sum = Integer.parseInt(num[0]) + Integer.parseInt(num[1]); list.add(Integer.toString(sum).length()); } else { break; } } for (int keta : list) { System.out.println(keta); } } finally { br.close(); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { List<Integer> list = new ArrayList<Integer>(); String s; while ((s = br.readLine()) != null && list.size() <= 200) { String[] num = s.split(" "); if (0 <= Integer.parseInt(num[0]) && Integer.parseInt(num[1]) <= 1000000) { int sum = Integer.parseInt(num[0]) + Integer.parseInt(num[1]); list.add(Integer.toString(sum).length()); } else { break; } } for (int keta : list) { System.out.println(keta); } } finally { br.close(); } } }
[["-", 8, 196, 0, 52, 15, 15, 0, 16, 17, 106], ["+", 8, 196, 0, 52, 15, 15, 0, 16, 17, 98]]
3
225
2
// Digit Number import java.util.Scanner; class Main { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); int digit[] = new int[200]; int i = 0; for (; sc.hasNextInt(); i++) { int a = sc.nextInt(); int b = sc.nextInt(); int sub = a + b; digit[i] = String.valueOf(sub).length(); } for (int j = 0; i < j; j++) { System.out.println(digit[j]); } } }
// Digit Number import java.util.Scanner; class Main { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); int digit[] = new int[200]; int i = 0; for (; sc.hasNextInt(); i++) { int a = sc.nextInt(); int b = sc.nextInt(); int sub = a + b; digit[i] = String.valueOf(sub).length(); // System.out.println("digit="+digit[i]); } // System.out.println("i="+i); for (int j = 0; j < i; j++) { System.out.println(digit[j]); } } }
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 31, 22], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 22]]
3
141
4
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] arg) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int a, b; String line, str; String[] splitedLine; while ((line = br.readLine()) != null) { splitedLine = line.split(" "); a = Integer.parseInt(splitedLine[0]); b = Integer.parseInt(splitedLine[1]); str = String.valueOf(a + b); System.out.println(str); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] arg) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int a, b; String line, str; String[] splitedLine; while ((line = br.readLine()) != null) { splitedLine = line.split(" "); a = Integer.parseInt(splitedLine[0]); b = Integer.parseInt(splitedLine[1]); str = String.valueOf(a + b); System.out.println(str.length()); } } }
[["+", 0, 1, 0, 492, 3, 4, 0, 492, 0, 131], ["+", 0, 1, 0, 492, 3, 4, 0, 492, 141, 22], ["+", 0, 492, 3, 4, 0, 492, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 492, 3, 4, 0, 25]]
3
142
4
import java.util.*; class Main { public static void main(String[] args) { int a; int b; Scanner sc = new Scanner(System.in); while (sc.hasNextInt()) { a = sc.nextInt(); b = sc.nextInt(); int d = (int)Math.log10(a + b); System.out.println(d); } } }
import java.util.*; class Main { public static void main(String[] args) { int a; int b; Scanner sc = new Scanner(System.in); while (sc.hasNextInt()) { a = sc.nextInt(); b = sc.nextInt(); int d = (int)Math.log10(a + b) + 1; System.out.println(d); } } }
[["+", 8, 196, 0, 503, 49, 200, 51, 16, 17, 72], ["+", 8, 196, 0, 503, 49, 200, 51, 16, 12, 499]]
3
90
2
import static java.util.Arrays.sort; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Comparator; public class Main { public static void main(String[] args) throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); PrintWriter out = new PrintWriter(System.out); int i = 0; String line; String[] numList = new String[2]; try { while ((line = br.readLine()) != null) { numList = line.split(" "); int num0 = Integer.parseInt(numList[0]); int num1 = Integer.parseInt(numList[1]); int sum = num0 + num1; System.out.println((int)Math.log10(sum)); } } catch (Exception e) { System.exit(0); } } }
import static java.util.Arrays.sort; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Comparator; public class Main { public static void main(String[] args) throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); PrintWriter out = new PrintWriter(System.out); int i = 0; String line; String[] numList = new String[2]; try { while ((line = br.readLine()) != null) { numList = line.split(" "); int num0 = Integer.parseInt(numList[0]); int num1 = Integer.parseInt(numList[1]); int sum = num0 + num1; System.out.println((int)Math.log10(sum) + 1); } } catch (Exception e) { System.exit(0); } } }
[["+", 0, 1, 0, 492, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 492, 3, 4, 0, 16, 12, 499]]
3
224
2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); String[] datasetstr = new String[2]; int[] datasetint = new int[2]; while (str != null) { datasetstr = str.split(" ", 2); datasetint[0] = Integer.parseInt(datasetstr[0]); datasetint[1] = Integer.parseInt(datasetstr[1]); System.out.println( Math.round(Math.ceil(Math.log10(datasetint[0] + datasetint[1])))); str = br.readLine(); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); String[] datasetstr = new String[2]; int[] datasetint = new int[2]; while (str != null) { datasetstr = str.split(" ", 2); datasetint[0] = Integer.parseInt(datasetstr[0]); datasetint[1] = Integer.parseInt(datasetstr[1]); System.out.println( Math.round(Math.ceil(Math.log10(datasetint[0] + datasetint[1] + 1)))); str = br.readLine(); } } }
[["+", 3, 4, 0, 492, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 492, 3, 4, 0, 16, 12, 499]]
3
177
2
(1..9).each do |i| (1..9).each do |j| equation = i * j puts "#{i}??#{j}=#{equation}" end end
(1..9).each do |i| (1..9).each do |j| equation = i * j puts "#{i}x#{j}=#{equation}" end end
[["-", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6]]
4
43
2
a = 1..9 # a.each do |i| puts(i) end # a.each {|i| puts(i)} a.each do |i| a.each do |j| puts("#{i}*#{j}=#{i * j}") end end
a = 1..9 # a.each do |i| puts(i) end # a.each {|i| puts(i)} a.each do |i| a.each do |j| puts("#{i}x#{j}=#{i * j}") end end
[["-", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6]]
4
41
2
a = 1 b = 1 while a <= 9 b = 1 while b <= 9 x = a * b puts "#{a}×#{b}=#{x}" b += 1 end a += 1 end
a = 1 b = 1 while a <= 9 b = 1 while b <= 9 c = a * b puts "#{a}x#{b}=#{c}" b += 1 end a += 1 end
[["-", 8, 170, 0, 89, 8, 170, 0, 662, 31, 22], ["+", 8, 170, 0, 89, 8, 170, 0, 662, 31, 22], ["-", 8, 170, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 8, 170, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 652, 3, 4, 0, 557, 0, 284, 0, 22], ["+", 0, 652, 3, 4, 0, 557, 0, 284, 0, 22]]
4
44
6
i = i.to_i j = j.to_i (1...10).each do |i| (1...10).each do |j| puts '%dx%d=%d', i, j, i * j end end
i = i.to_i j = j.to_i (1...10).each do |i| (1...10).each do |j| printf "%dx%d=%d\n", i, j, i * j end end
[["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["-", 8, 736, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["+", 8, 736, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 8, 736, 0, 652, 3, 4, 0, 557, 0, 44]]
4
46
7
#!/usr/local/bin/ruby (1..9).each do |i| (1..9).each do |j| ans = i * j puts "#{i}×#{j}=#{ans}" end end
#!/usr/local/bin/ruby (1..9).each do |i| (1..9).each do |j| ans = i * j puts "#{i}x#{j}=#{ans}" end end
[["-", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6]]
4
44
2
(1..9).each do |num| (1..9).each do |num2| print(num, 'x', num2, '=', num * num2, "\n") end end print('end')
(1..9).each do |num| (1..9).each do |num2| print(num, 'x', num2, '=', num * num2, "\n") end end
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 24], ["-", 0, 493, 0, 652, 3, 4, 0, 557, 0, 62], ["-", 0, 493, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 25]]
4
52
6
(1..9).each do |i| (1..9).each do |k| puts "#{i}×#{k}=#{i * k}" end end
(1..9).each do |i| (1..9).each do |k| puts "#{i}x#{k}=#{i * k}" end end
[["-", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6]]
4
40
2
def multi(): for i in range(1, 10): for j in range(1, 10): print(str(i) + "×" + str(j) + "=" + str(i * j)) if __name__ == '__main__': multi()
def multi(): for i in range(1, 10): for j in range(1, 10): print(str(i) + "x" + str(j) + "=" + str(i * j)) if __name__ == '__main__': multi()
[["-", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6], ["+", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6]]
5
62
2
for i in range(1,9): for j in range(1,9): print(i,"x",j,"=",i*j,sep="")
for i in range(1,10): for j in range(1,10): print(i,"x",j,"=",i*j,sep="")
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
43
4
def __main(): x = 1; while x <= 9 : y = 1; while y <= 9 : z = x * y; print((str(x) + " x " + str(y) + " = " + str(z) )) y = y + 1 x = x + 1 __main()
def __main(): x = 1; while x <= 9 : y = 1; while y <= 9 : z = x * y; print((str(x) + "x" + str(y) + "=" + str(z) )) y = y + 1 x = x + 1 __main()
[["-", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6], ["+", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6], ["-", 0, 23, 0, 657, 31, 657, 12, 557, 0, 6], ["+", 0, 23, 0, 657, 31, 657, 12, 557, 0, 6]]
5
69
4
for i in range(9): for j in range(9): print("{}*{}={}".format(i+1,j+1,(i+1)*(j+1)))
for i in range(9): for j in range(9): print("{}x{}={}".format(i+1,j+1,(i+1)*(j+1)))
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
45
2
def output(i,j): print(str(i) + 'x' + str(j) + '=' + str(i+j)) for i in range(1,10): for j in range(1,10): output(i,j)
def output(i,j): print(str(i) + 'x' + str(j) + '=' + str(i*j)) for i in range(1,10): for j in range(1,10): output(i,j)
[["-", 0, 657, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 657, 12, 652, 3, 4, 0, 657, 17, 48]]
5
61
2
#!/usr/bin/env python3 #coding: utf-8 for x in range(1,10): for y in range(1,10): print("{0}×{1}={2}".format(x, y, x*y))
#!/usr/bin/env python3 #coding: utf-8 for x in range(1,10): for y in range(1,10): print("{0}x{1}={2}".format(x, y, x*y))
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
39
2
max = 9 for x in range(1, max): for y in range(1, max): print("%dx%d=%d" % (x, y, x * y))
max = 10 for x in range(1, max): for y in range(1, max): print("%dx%d=%d" % (x, y, x * y))
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
39
2
# coding: UTF-8 for i in range(1,9): for j in range(1,9): print(str(i) + "x" + str(j) + "=" + str(i*j))
#coding UTF-8 for i in range(1,10): for j in range(1,10): print(str(i)+"x"+str(j)+"="+str(i*j))
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
48
4
for i in range(1, 11): for j in range(1, 11): string = str(i) + "x" + str(j) + "=" + str(j*i) print(string)
for i in range(1, 10): for j in range(1, 10): string = str(i) + "x" + str(j) + "=" + str(j*i) print(string)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
50
4
#!/usr/bin/env python # -*- coding: utf-8 -*- for i in range(10): for j in range(10): print(str(i) + "x" + str(j) + "=" + str(i*j))
#!/usr/bin/env python # -*- coding: utf-8 -*- for i in range(1, 10): for j in range(1, 10): print(str(i) + "x" + str(j) + "=" + str(i*j))
[["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
45
4
for i in range(0, 10): for j in range(0, 10): print(("%dx%d=%d"%(i, j, i*j)))
for i in range(1, 10): for j in range(1, 10): print(("%dx%d=%d"%(i, j, i*j)))
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
38
4
# encoding:utf-8 for x in range(1,9): for y in range(1,9): text = "x".join(map(str, (x, y))) text = "=".join(map(str, (text, x*y))) print(text)
# encoding:utf-8 for x in range(1, 10): for y in range(1, 10): text = "x".join(map(str, (x, y))) text = "=".join(map(str, (text, x*y))) print(text)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
65
4
# -*- coding: utf-8 -*- temp = 0 for i in range(1,10): for k in range(1,10): temp = i * k print("%d x %d = %d" % (i, k, temp))
# -*- coding: utf-8 -*- temp = 0 for i in range(1,10): for k in range(1,10): temp = i * k print("%dx%d=%d" % (i, k, temp))
[["-", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6]]
5
43
2
for i in range(0,9): for j in range(0,9): print("{0}*{1}={2}".format(i+1,j+1,(i+1)*(j+1)))
for i in range(0,9): for j in range(0,9): print("{0}x{1}={2}".format(i+1,j+1,(i+1)*(j+1)))
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
49
2
import math for i in range(1, 10): for j in range(1, 10): print(str(i) + "X" + str(j) + "=" + str(i*j))
import math for i in range(1, 10): for j in range(1, 10): print(str(i) + "x" + str(j) + "=" + str(i*j))
[["-", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6], ["+", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6]]
5
49
2
for ii in range(1,10): for jj in range(1,10): # print(str(ii) + "x" + str(jj) + "=" + str(ii * jj)) data = (ii, jj, ii * jj, ) print(("%d+%d=%d" % data))
for ii in range(1,10): for jj in range(1,10): # print(str(ii) + "x" + str(jj) + "=" + str(ii * jj)) data = (ii, jj, ii * jj, ) print(("%dx%d=%d" % data))
[["-", 3, 4, 0, 23, 0, 657, 31, 557, 0, 6], ["+", 3, 4, 0, 23, 0, 657, 31, 557, 0, 6]]
5
43
2
for n in range(1,10): for i in range(1, 10): print('{} x {} = {}'.format(n, i, eval('{}*{}'.format(n, i))))
for n in range(1,10): for i in range(1, 10): print('{}x{}={}'.format(n, i, eval('{}*{}'.format(n, i))))
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
47
2
#coding:utf-8 for i in range(1, 10): for n in range(1, 10): print(("{0} x {1} = {2}". format(i, n, i * n)))
#coding:utf-8 for i in range(1, 10): for n in range(1, 10): print(("{0}x{1}={2}". format(i, n, i * n)))
[["-", 0, 23, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 0, 23, 0, 652, 63, 319, 500, 557, 0, 6]]
5
40
2
#QQ for i in range(1,10): for n in range(1, 10): print("%d x %d = %d" % (i, n, i * n))
#QQ for i in range(1,10): for n in range(1, 10): print("%dx%d=%d" % (i, n, i * n))
[["-", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6]]
5
37
2
#encoding=utf-8 for i in range(9): for j in range(9): ans = (i + 1)*(j + 1) print(str(i + 1) + "??" + str(j + 1) + "=" + str((i + 1)*(j + 1)))
#encoding=utf-8 for i in range(9): for j in range(9): ans = (i + 1)*(j + 1) print(str(i + 1) + "x" + str(j + 1) + "=" + str((i + 1)*(j + 1)))
[["-", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6], ["+", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6]]
5
69
2
for i in range(1,10): for ii in range(10): print((str(i)+"x"+str(ii)+"="+str(i*ii)))
for i in range(1,10): for ii in range(1,10): print((str(i)+"x"+str(ii)+"="+str(i*ii)))
[["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
47
2
for a in [1,2,3,4,5,6,7,8,9]: for b in [1,2,3,4,5,6,7,8,9]: print ("{0}*{1}={2}".format(a,b,a*b))
for a in [1,2,3,4,5,6,7,8,9]: for b in [1,2,3,4,5,6,7,8,9]: print ("{0}x{1}={2}".format(a,b,a*b))
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
63
2
for i in range(1,9): for j in range(1,9): ans = "%dx%d=%d"%(i,j,i*j) print(ans)
for i in range(1,10): for j in range(1,10): ans = "%dx%d=%d"%(i,j,i*j) print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
39
4
for i in range(1,10): for j in range(1,10): print("%d x %d = %d" % (i,j,(i*j)))
for i in range(1,10): for j in range(1,10): print("%dx%d=%d" % (i,j,(i*j)))
[["-", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6]]
5
38
2
a=1; b=1; c=0 while a<10: while b<10: c=a*b print("%dx%d=%d" %(a,b,c)) b+=1 a+=1;b=0
a=1; b=1; c=0 while a<10: while b<10: c=a*b print("%dx%d=%d" %(a,b,c)) b+=1 a+=1;b=1
[["-", 0, 52, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 12, 612]]
5
50
2
for i in range(1,10): for j in range(1,10): print(str(i)+"*"+str(j)+"="+str(i*j))
for i in range(1,10): for j in range(1,10): print((str(i)+"x"+str(j)+"="+str(i*j)))
[["+", 0, 1, 0, 652, 3, 4, 0, 23, 0, 24], ["-", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6], ["+", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6], ["+", 0, 23, 0, 657, 12, 652, 3, 4, 0, 25]]
5
47
4
for i in [1,2,3,4,5,6,7,8,9]: for j in [1,2,3,4,5,6,7,8,9]: print('%sx%s=%s' % (i,j,i))
for i in [1,2,3,4,5,6,7,8,9]: for j in [1,2,3,4,5,6,7,8,9]: print('%sx%s=%s' % (i,j,i*j))
[["+", 3, 4, 0, 657, 12, 660, 0, 657, 17, 48], ["+", 3, 4, 0, 657, 12, 660, 0, 657, 12, 22]]
5
60
2
for i in range(1, 10): for j in range(1, i + 1): print(str(i) + 'x' + str(j) + '=' + str(i * j))
for i in range(1, 10): for j in range(1, 10): print(str(i) + 'x' + str(j) + '=' + str(i * j))
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
49
4
for i in range(1,10): for j in range(1,10): ans = i * j print('%dx%d=%d' % (i,j,k))
for i in range(1,10): for j in range(1,10): ans = i * j print('%dx%d=%d' % (i,j,ans))
[["-", 0, 652, 3, 4, 0, 657, 12, 660, 0, 22], ["+", 0, 652, 3, 4, 0, 657, 12, 660, 0, 22]]
5
39
2
for i in range(1,10): for j in range(1,10): print("{0}+{1}={2}".format(i,j,i*j))
for i in range(1,10): for j in range(1,10): print(("{0}x{1}={2}".format(i,j,i*j)))
[["+", 0, 1, 0, 652, 3, 4, 0, 23, 0, 24], ["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 0, 23, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 23, 0, 652, 3, 4, 0, 25]]
5
37
4
kuku=[i+1 for i in range(9)] for i in kuku: for e in kuku: print("%i??%i=%i"%(i,e,i*e))
kukuo=[i+1 for i in range(9)] for i in kukuo: for e in kukuo: print("%ix%i=%i"%(i,e,i*e))
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 12, 22], ["-", 0, 656, 0, 7, 8, 196, 0, 7, 12, 22], ["+", 0, 656, 0, 7, 8, 196, 0, 7, 12, 22], ["-", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6]]
5
40
8
for i in range(1, 10): for j in range(1, 10): print('%d*%d=%d'%(i,j,i*j))
for i in range(1, 10): for j in range(1, 10): print('%dx%d=%d'%(i,j,i*j))
[["-", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 657, 31, 557, 0, 6]]
5
36
2
for j in range(1,10): for i in range(1,10): k=i*j print((str(j)+"??"+str(i)+"="+str(k)))
for j in range(1,10): for i in range(1,10): k=i*j print((str(j)+"x"+str(i)+"="+str(k)))
[["-", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6], ["+", 31, 657, 31, 657, 31, 657, 12, 557, 0, 6]]
5
52
2
for i in range(10): for ii in range(10): print("{}x{}={}".format(i,ii,i*ii))
for i in range(1,10): for ii in range(1,10): print("{}x{}={}".format(i,ii,i*ii))
[["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
33
4
for x in range(10): for y in range(x, 9): print("%dx%d=%d" % (x + 1, y + 1, (x + 1) * (y + 1)))
for x in range(9): for y in range(9): print("%dx%d=%d" % (x+1,y+1,(x+1)*(y+1)))
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
46
4
import java.io.*; class aoj { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { String[] str = br.readLine().split("\\s"); if (str == null) throw new Exception(); int a = Integer.parseInt(str[0]) + Integer.parseInt(str[1]); String b = "" + a; System.out.print(b.length()); } } catch (Exception e) { } } }
import java.io.*; class Main { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { String[] str = br.readLine().split("\\s"); if (str == null) throw new Exception(); int a = Integer.parseInt(str[0]) + Integer.parseInt(str[1]); String b = "" + a; System.out.println(b.length()); } } catch (Exception e) { } } }
[["-", 36, 36, 36, 36, 0, 493, 0, 235, 141, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 235, 141, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 492, 141, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 492, 141, 22]]
3
129
4
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int a = scanner.nextInt(); int b = scanner.nextInt(); int i = 0; int digit = 1; while (a + b > digit) { i++; digit *= 10; } System.out.println(i); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int a = scanner.nextInt(); int b = scanner.nextInt(); int i = 0; int digit = 1; while (a + b >= digit) { i++; digit *= 10; } System.out.println(i); } } }
[["-", 8, 196, 0, 52, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 52, 15, 15, 0, 16, 17, 20]]
3
99
2
import java.lang.*; import java.math.*; import java.util.*; class Main { Scanner sc = new Scanner(System.in); void run() { int x; while (sc.hasNext()) { x = sc.nextInt() + sc.nextInt(); int count = 0; do { x /= 10; count++; } while (x != 0); System.out.println(count); return; } } public static void main(String[] args) { new Main().run(); } }
import java.lang.*; import java.math.*; import java.util.*; class Main { Scanner sc = new Scanner(System.in); void run() { int x; while (sc.hasNextInt()) { x = sc.nextInt() + sc.nextInt(); int count = 0; do { x /= 10; count++; } while (x != 0); System.out.println(count); } return; } public static void main(String[] args) { new Main().run(); } }
[["-", 8, 196, 0, 52, 15, 15, 0, 492, 141, 22], ["+", 8, 196, 0, 52, 15, 15, 0, 492, 141, 22], ["+", 0, 195, 8, 196, 0, 52, 8, 196, 0, 46], ["-", 0, 195, 8, 196, 0, 52, 8, 196, 0, 46]]
3
123
4
import java.io.*; import java.util.Scanner; public class Main { static int digit(int a, int b) { int x = a + b; int d = 0; while (x > 0) { d++; x /= 10; } return d; } public static void main(String[] args) throws IOException { Scanner stdIn = null; final int NUM = 1000; int[][] p = new int[NUM][2]; try { stdIn = new Scanner(new BufferedReader(new FileReader("in1.txt"))); int i = 0; while (stdIn.hasNext()) { if (stdIn.hasNextInt()) { p[i][0] = stdIn.nextInt(); p[i][1] = stdIn.nextInt(); } else { stdIn.next(); } i++; } for (int j = 0; j < i; j++) { System.out.println(digit(p[j][0], p[j][1])); } } finally { if (stdIn != null) { stdIn.close(); } } } }
import java.io.*; import java.util.Scanner; public class Main { static int digit(int a, int b) { int x = a + b; int d = 0; while (x > 0) { d++; x /= 10; } return d; } public static void main(String[] args) throws IOException { Scanner stdIn = null; final int NUM = 1000; int[][] p = new int[NUM][2]; try { stdIn = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int i = 0; while (stdIn.hasNext()) { if (stdIn.hasNextInt()) { p[i][0] = stdIn.nextInt(); p[i][1] = stdIn.nextInt(); } else { stdIn.next(); } i++; } for (int j = 0; j < i; j++) { System.out.println(digit(p[j][0], p[j][1])); } } finally { if (stdIn != null) { stdIn.close(); } } } }
[["-", 3, 4, 0, 230, 3, 4, 0, 230, 39, 78], ["+", 3, 4, 0, 230, 3, 4, 0, 230, 39, 78], ["-", 3, 4, 0, 230, 3, 4, 0, 5, 0, 62], ["-", 3, 4, 0, 230, 3, 4, 0, 5, 0, 491], ["+", 3, 4, 0, 230, 3, 4, 0, 509, 500, 22], ["+", 3, 4, 0, 230, 3, 4, 0, 509, 0, 131], ["+", 3, 4, 0, 230, 3, 4, 0, 509, 119, 22]]
3
247
8
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] a) { String str; BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); try { while (null != (str = bf.readLine())) { String[] arr = str.split(" "); int number = Integer.parseInt(arr[0]) + Integer.parseInt(arr[1]); int count = 0; while (number == 0) { number /= 10; count++; } System.out.println(count); } } catch (IOException e) { e.printStackTrace(); } finally { try { bf.close(); } catch (IOException e) { } } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] a) { String str; BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); try { while (null != (str = bf.readLine())) { String[] arr = str.split(" "); int number = Integer.parseInt(arr[0]) + Integer.parseInt(arr[1]); int count = 0; while (number != 0) { number /= 10; count++; } System.out.println(count); } } catch (IOException e) { e.printStackTrace(); } finally { try { bf.close(); } catch (IOException e) { } } } }
[["-", 8, 196, 0, 52, 15, 15, 0, 16, 17, 60], ["+", 8, 196, 0, 52, 15, 15, 0, 16, 17, 79]]
3
173
2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String read = null; ArrayList<String> output = new ArrayList<String>(); while (!(read = reader.readLine()).equals("")) { String[] parts = read.split(" "); int[] nums = new int[2]; int c = 0; for (String part : parts) { nums[c] = Integer.parseInt(part); c++; } int result = nums[0] + nums[1]; String resultStr = String.valueOf(String.valueOf(result).length()); output.add(resultStr); } for (String str : output) { System.out.println(str); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String read = null; ArrayList<String> output = new ArrayList<String>(); while ((read = reader.readLine()) != null) { String[] parts = read.split(" "); int[] nums = new int[2]; int c = 0; for (String part : parts) { nums[c] = Integer.parseInt(part); c++; } int result = nums[0] + nums[1]; String resultStr = String.valueOf(String.valueOf(result).length()); output.add(resultStr); } for (String str : output) { System.out.println(str); } } }
[["-", 8, 196, 0, 52, 15, 15, 0, 91, 17, 111], ["-", 0, 52, 15, 15, 0, 91, 439, 492, 0, 131], ["-", 0, 52, 15, 15, 0, 91, 439, 492, 141, 22], ["-", 15, 15, 0, 91, 439, 492, 3, 4, 0, 24], ["-", 0, 91, 439, 492, 3, 4, 0, 5, 0, 62], ["-", 15, 15, 0, 91, 439, 492, 3, 4, 0, 25], ["+", 8, 196, 0, 52, 15, 15, 0, 16, 17, 79], ["+", 8, 196, 0, 52, 15, 15, 0, 16, 12, 215]]
3
213
9
import java.io.IOException; public class Main { public static void main(String[] a) throws IOException { int s1 = 0, s2 = 0, i = 0; String[] Set = new String[5]; String[] stock = new String[5]; String Input = null; java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); try { while ((Input = in.readLine()) != null) { stock = Input.split(" "); s1 = Integer.parseInt(stock[0]); s2 = Integer.parseInt(stock[1]); Set[i] = String.valueOf(s1 + s2); System.out.println(Set[i].length()); i++; } } catch (Exception e) { } } }
import java.io.IOException; public class Main { public static void main(String[] a) throws IOException { int s1 = 0, s2 = 0, i = 0; String[] Set = new String[5]; String[] stock = new String[5]; String Input = null; java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); try { while ((Input = in.readLine()) != null) { stock = Input.split(" "); s1 = Integer.parseInt(stock[0]); s2 = Integer.parseInt(stock[1]); Set[0] = String.valueOf(s1 + s2); System.out.println(Set[0].length()); } } catch (Exception e) { } } }
[["-", 8, 196, 0, 1, 0, 11, 31, 504, 71, 22], ["+", 8, 196, 0, 1, 0, 11, 31, 504, 71, 499], ["-", 0, 492, 3, 4, 0, 492, 500, 504, 71, 22], ["+", 0, 492, 3, 4, 0, 492, 500, 504, 71, 499], ["-", 8, 196, 0, 52, 8, 196, 0, 1, 0, 35], ["-", 0, 52, 8, 196, 0, 1, 0, 27, 0, 22], ["-", 0, 52, 8, 196, 0, 1, 0, 27, 0, 29]]
3
187
19
import java.util.*; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a, b; double log; while (s.hasNextInt()) { a = s.nextInt(); b = s.nextInt(); log = Math.log10(a + b); System.out.printf("%.0f\n", Math.ceil(log)); } } }
import java.util.*; class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a, b; double log; while (s.hasNextInt()) { a = s.nextInt(); b = s.nextInt(); log = Math.log10(a + b + 1); System.out.printf("%.0f\n", Math.ceil(log)); } } }
[["+", 0, 11, 12, 492, 3, 4, 0, 16, 17, 72], ["+", 0, 11, 12, 492, 3, 4, 0, 16, 12, 499]]
3
98
2
import java.lang.Math; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { int a = in.nextInt(); int b = in.nextInt(); System.out.println(Math.ceil(Math.log10(a + b))); } } }
import java.lang.Math; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { int a = in.nextInt(); int b = in.nextInt(); System.out.println((int)Math.floor(Math.log10(a + b) + 1)); } } }
[["+", 0, 1, 0, 492, 3, 4, 0, 74, 0, 24], ["+", 0, 492, 3, 4, 0, 74, 39, 506, 0, 507], ["+", 0, 1, 0, 492, 3, 4, 0, 74, 0, 25], ["-", 0, 1, 0, 492, 3, 4, 0, 492, 141, 22], ["+", 0, 492, 3, 4, 0, 74, 51, 492, 141, 22], ["+", 0, 74, 51, 492, 3, 4, 0, 16, 17, 72], ["+", 0, 74, 51, 492, 3, 4, 0, 16, 12, 499]]
3
91
7
import java.util.Scanner; public class Main { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); while (sc.nextLine() != null) { String[] s = sc.nextLine().split("[\\s]+"); int value = Integer.parseInt(s[0]); int value_2 = Integer.parseInt(s[1]); int sum = value + value_2; int count = 1; while (sum / 10 != 0) { sum /= 10; count++; } System.out.println(count); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String[] s = sc.nextLine().split("[\\s]+"); int value = Integer.parseInt(s[0]); int value_2 = Integer.parseInt(s[1]); int sum = value + value_2; int count = 1; while (sum / 10 != 0) { sum /= 10; count++; } System.out.println(count); } } }
[["-", 0, 52, 15, 15, 0, 16, 31, 492, 141, 22], ["+", 8, 196, 0, 52, 15, 15, 0, 492, 141, 22], ["-", 8, 196, 0, 52, 15, 15, 0, 16, 17, 79], ["-", 8, 196, 0, 52, 15, 15, 0, 16, 12, 215]]
3
138
4
#include <stdio.h> // using namespace std; int main() { long int a, b, c, n, co = 0; while (scanf("%ld%ld", &a, &b) != EOF) { c = a + b; while (c > 0) { c = c / 10; co++; } printf("%ld\n", co); } return 0; }
#include <stdio.h> int main() { long int a, b, c, co = 0; while (scanf("%ld%ld", &a, &b) != EOF) { c = a + b; co = 0; while (c > 0) { c = c / 10; co++; } printf("%ld\n", co); } return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
0
78
6
#include <stdio.h> int digitNumber(int n) { int c = 1; while (n / 10 > 0) { c++; n /= 10; } return c; } int main(void) { int a, b; while (scanf("%d %d", &a, &b) != EOF) { printf("%d\n", digitNumber(a) + digitNumber(b)); } return 0; }
#include <stdio.h> int digitNumber(int n) { int c = 1; while (n / 10 > 0) { c++; n /= 10; } return c; } int main(void) { int a, b; while (scanf("%d %d", &a, &b) != EOF) { printf("%d\n", digitNumber(a + b)); } return 0; }
[["-", 3, 4, 0, 16, 31, 2, 3, 4, 0, 25], ["-", 0, 2, 3, 4, 0, 16, 12, 2, 63, 22], ["-", 3, 4, 0, 16, 12, 2, 3, 4, 0, 24]]
0
87
3
#include <stdio.h> int main() { int a, i = 0, u = 0, e = 0, o, yama[100]; while (scanf("%d %d", &a, &i) != EOF) { o = a + i; for (u = 0; o != 0; u++) { o /= 10; } yama[e] = o; e++; } for (u = 0; u < e; u++) { printf("%d\n", yama[u]); } return 0; }
#include <stdio.h> int main() { int a, i = 0, u = 0, e = 0, o, yama[201]; while (scanf("%d %d", &a, &i) != EOF) { o = a + i; for (u = 0; o != 0; u++) { o /= 10; } yama[e] = u; e++; } for (u = 0; u < e; u++) { printf("%d\n", yama[u]); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 22]]
0
115
4
#include <math.h> #include <stdio.h> int main() { int i, j; while (scanf("%d %d", &i, &j) != EOF) { printf("%d\n", floor(log10(i + j) + 1)); } return 0; }
#include <math.h> #include <stdio.h> int main() { int i, j; while (scanf("%d %d", &i, &j) != EOF) { printf("%d\n", (int)floor(log10(i + j) + 1)); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 74, 0, 24], ["+", 0, 2, 3, 4, 0, 74, 39, 77, 39, 40], ["+", 0, 1, 0, 2, 3, 4, 0, 74, 0, 25]]
0
57
3
#include <stdio.h> int main() { int a, b, i, sum; while (scanf("%d %d", &a, &b) != -1) { sum = a + b; for (i = 0; sum != 0; i++) { sum = sum / 10; } printf("%d", i); } return 0; }
#include <stdio.h> int main() { int a, b, i, sum; while (scanf("%d %d", &a, &b) != EOF) { sum = a + b; for (i = 0; sum != 0; i++) { sum = sum / 10; } printf("%d\n", i); } return 0; }
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
75
3
#include <stdio.h> int main() { int a, b, n, k[256], i = 0; while (scanf("%d %d", &a, &b) != EOF) { n = a + b; for (;;) { n /= 10; k[i]++; if (n == 0) break; } i++; } for (n = 0; n < i; n++) printf("%d\n", k[n]); return 0; }
#include <stdio.h> int main() { int a, b, n, k[256] = {0}, i = 0; while (scanf("%d %d", &a, &b) != EOF) { n = a + b; for (;;) { n /= 10; k[i]++; if (n == 0) break; } i++; } for (n = 0; n < i; n++) printf("%d\n", k[n]); return 0; }
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
0
106
4
#include <stdio.h> #include <stdlib.h> #include <string.h> #define FOR(a, b) for (a = 0; a < b; a++) int main() { int a, b; char buf[200][5]; int cnt = 0; while (scanf("%d %d", &a, &b) != EOF) { sprintf(buf[cnt++], "%d", a + b); } FOR(a, cnt) printf("%d\n", strlen(buf[a])); return 0; }
#include <stdio.h> #include <stdlib.h> #include <string.h> #define FOR(a, b) for (a = 0; a < b; a++) int main() { int a, b; char buf[200][20]; int cnt = 0; while (scanf("%d %d", &a, &b) != EOF) { sprintf(buf[cnt++], "%d", a + b); } FOR(a, cnt) printf("%d\n", strlen(buf[a])); return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
101
2
#include <stdio.h> int nDigits(int); int main(void) { int i, a[200], b[200], nData = 0; while (scanf("%d %d", a + i, b + i) == 2) i++; for (i = 0; i < nData; i++) printf("%d\n", nDigits(a[i] + b[i])); return 0; } int nDigits(int x) { int d = 1; while ((x /= 10) > 0) d++; return d; }
#include <stdio.h> int nDigits(int); int main(void) { int i, a[200], b[200], nData = 0; while (scanf("%d %d", a + nData, b + nData) == 2) nData++; for (i = 0; i < nData; i++) printf("%d\n", nDigits(a[i] + b[i])); return 0; } int nDigits(int x) { int d = 1; while ((x /= 10) > 0) d++; return d; }
[["-", 0, 16, 31, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 12, 22], ["-", 8, 9, 0, 52, 8, 1, 0, 27, 28, 22], ["+", 8, 9, 0, 52, 8, 1, 0, 27, 28, 22]]
0
120
6
// j;main(i){for(;9/i;i+=!(j%=9))printf("%dx%d=%d\n",i,j,++j*i);} // a,k;main(b){for(;k=~scanf("%d%d",&a,&b);printf("%.f\n",log10(a+b)+1));} // k;main(a,b){for(;k=~scanf("%d%d",&a,&b);printf("%.f\n",a+b?log10(a+b)+1:1.));} k; main(a, b) { for (; k = ~scanf("%d%d", &a, &b); printf("%.f\n", a + b ? log10(a + b) : 1.)) ; } // #include <stdio.h> // int main( void ) { // int a, b, d, tmp; // for ( ; scanf( "%d %d", &a, &b ) == 2; printf( "%d\n", d ) ) { // tmp = a + b; // for ( d = 1; tmp /= 10; d++ ) ; // } // return 0; // } // main(i,a,t,p,j){for(;~scanf("%d",&t)?i++<4?t<p?p=t:1:t<j?j=t:1:!printf("%d\n",p+j-50););} // double // a,b,c,d;i;main(){scanf("%lf%lf%lf%lf",&a,&b,&c,&d);i=!printf("%f\n",hypot(a-c,b-d));} // double // c[4];i;main(){for(;~scanf("%lf",c+i++););i=!printf("%f\n",hypot(*c-c[2],c[1]-c[3]));} // double // c[4],*p=c;i;main(){for(;~scanf("%lf",p++););i=!printf("%f\n",hypot(*c-c[2],c[1]-c[3]));} // double // c[],*p=c;main(){for(;~scanf("%lf",p++););p=!printf("%f\n",hypot(*c-c[2],c[1]-c[3]));} // double // a,b,c,d,*p=&d;main(){for(;~scanf("%lf",p++););p=!printf("%f\n",hypot(d-c,b-a));} // s,n,i;main(x,y){for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,.5+1.*n/i);i++)n+=y;} // L;main(A,B,C,D){scanf("%d%d%d%d%d",&L,&A,&B,&C,&D);L=!printf("%.f\n",L-fmax(--A/C,--B/D)-1);} // a,b,c,d,e,*p=&d;main(){for(;~scanf("%d",p++););p=!printf("%.f\n",d-fmax(--b/c,--e/a)-1);} // char // c[];p;main(t){for(;gets(c)**c;p=!puts(strncat(c,c,p%=strlen(c))+p))for(gets(&t);scanf("%d // ",&t);p+=t);}
// j;main(i){for(;9/i;i+=!(j%=9))printf("%dx%d=%d\n",i,j,++j*i);} // k;main(a,b){for(;k=~scanf("%d%d",&a,&b);printf("%.f\n",a+b?log10(a+b)+1:1.));} k; main(a, b) { for (; k = ~scanf("%d%d", &a, &b); printf("%.f\n", a + b ? floor(log10(a + b)) + 1 : 1.)) ; } // k;main(a,b){for(;k=~scanf("%d%d",&a,&b);printf("%d\n",a+b?(int)log10(a+b)+1:1));} // #include <stdio.h> // int main( void ) { // int a, b, d, tmp; // for ( ; scanf( "%d %d", &a, &b ) == 2; printf( "%d\n", d ) ) { // tmp = a + b; // for ( d = 1; tmp /= 10; d++ ) ; // } // return 0; // } // main(i,a,t,p,j){for(;~scanf("%d",&t)?i++<4?t<p?p=t:1:t<j?j=t:1:!printf("%d\n",p+j-50););} // double // a,b,c,d;i;main(){scanf("%lf%lf%lf%lf",&a,&b,&c,&d);i=!printf("%f\n",hypot(a-c,b-d));} // double // c[4];i;main(){for(;~scanf("%lf",c+i++););i=!printf("%f\n",hypot(*c-c[2],c[1]-c[3]));} // double // c[4],*p=c;i;main(){for(;~scanf("%lf",p++););i=!printf("%f\n",hypot(*c-c[2],c[1]-c[3]));} // double // c[],*p=c;main(){for(;~scanf("%lf",p++););p=!printf("%f\n",hypot(*c-c[2],c[1]-c[3]));} // double // a,b,c,d,*p=&d;main(){for(;~scanf("%lf",p++););p=!printf("%f\n",hypot(d-c,b-a));} // s,n,i;main(x,y){for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,.5+1.*n/i);i++)n+=y;} // L;main(A,B,C,D){scanf("%d%d%d%d%d",&L,&A,&B,&C,&D);L=!printf("%.f\n",L-fmax(--A/C,--B/D)-1);} // a,b,c,d,e,*p=&d;main(){for(;~scanf("%d",p++););p=!printf("%.f\n",d-fmax(--b/c,--e/a)-1);} // char // c[];p;main(t){for(;gets(c)**c;p=!puts(strncat(c,c,p%=strlen(c))+p))for(gets(&t);scanf("%d // ",&t);p+=t);}
[["+", 3, 4, 0, 41, 64, 16, 31, 2, 63, 22], ["+", 0, 41, 64, 16, 31, 2, 3, 4, 0, 24], ["+", 0, 41, 64, 16, 31, 2, 3, 4, 0, 25], ["+", 26, 2, 3, 4, 0, 41, 64, 16, 17, 72], ["+", 26, 2, 3, 4, 0, 41, 64, 16, 12, 13]]
0
81
9
#include <stdio.h> int keta(int num) { int cnt = 0; while (num > 1) { num /= 10; cnt++; } return cnt; } int main(void) { int a; int b; while (scanf("%d %d", &a, &b) != EOF) { printf("%d\n", keta(a + b)); } return 0; }
#include <stdio.h> int keta(int num) { int cnt = 0; while (num > 0) { num /= 10; cnt++; } return cnt; } int main(void) { int a; int b; while (scanf("%d %d", &a, &b) != EOF) { printf("%d\n", keta(a + b)); } return 0; }
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13]]
0
83
12
#include <stdio.h> int main(void) { int i, a, b, c; while (scanf("%d %d", &a, &b) != -1) { c = a + b; for (i = 1; c > 10; i++) { c = c / 10; } printf("%d\n", i); } return (0); }
#include <stdio.h> int main(void) { int i, a, b, c; while (scanf("%d %d", &a, &b) != EOF) { c = a + b; for (i = 0; c != 0; i++) { c = c / 10; } printf("%d\n", i); } return (0); }
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 22], ["-", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 10, 11, 12, 13], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 17, 47], ["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 17, 79], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13]]
0
79
10
#include <stdio.h> #include <string.h> int main() { int a, b; char n[10]; while (scanf("%d %d", &a, &b) != EOF) { sprintf(n, "%d", a + b); printf("%d", strlen(n)); } return 0; }
#include <stdio.h> #include <string.h> int main() { int a, b; char n[10]; while (scanf("%d %d", &a, &b) != EOF) { sprintf(n, "%d", a + b); printf("%d\n", strlen(n)); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
68
1
#include <stdio.h> int main(void) { int a, b, c, d; while (scanf("%d %d", &a, &b) != EOF) { c = a + b; d = 0; while (c > 0) { c = c / 10; d++; } printf("%d", d); } return 0; }
#include <stdio.h> int main(void) { int a, b, c, d; while (scanf("%d %d", &a, &b) != EOF) { c = a + b; d = 0; while (c > 0) { c = c / 10; d++; } printf("%d\n", d); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
76
1
#include <stdio.h> int main(void) { int indat1, indat2; int sum; int cnt; while (scanf("%d %d", &indat1, &indat2) != EOF) { sum = indat1 + indat2; cnt = 0; while (sum != 0) { sum /= 10; cnt++; } printf("%d", cnt); } return 0; }
#include <stdio.h> int main(void) { int indat1, indat2; int sum; int cnt; while (scanf("%d %d", &indat1, &indat2) != EOF) { sum = indat1 + indat2; cnt = 0; while (sum != 0) { sum /= 10; cnt++; } printf("%d\n", cnt); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
76
1
#include <stdio.h> int digit(int i) { if (i == 0) return 0; int sum = 1; while (i / 10 != 0) { i = i / 10; sum++; } return sum; } int main() { int a, b; while (scanf("%d %d", &a, &b) != EOF) { printf("%d", digit(a + b)); } return 0; }
#include <stdio.h> int digit(int i) { if (i == 0) return 0; int sum = 1; while (i / 10 != 0) { i = i / 10; sum++; } return sum; } int main() { int a, b; while (scanf("%d %d", &a, &b) != EOF) { printf("%d\n", digit(a + b)); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
93
1
#include <math.h> #include <stdio.h> int main(void) { int a, b, c, d, i; while (scanf("%d %d", &a, &b) != -1) { puts(""); c = a + b; d = log10(c); printf("%d\n", d + 1); } return 0; }
#include <math.h> #include <stdio.h> int main(void) { int a, b, c, d, i; while (scanf("%d %d", &a, &b) != -1) { c = a + b; d = log10(c); printf("%d\n", d + 1); } return 0; }
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 62], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
75
6
#include <stdio.h> int main(void) { int a, b, sum, keta; while (scanf("%d %d", &a, &b) == EOF) { sum = a + b; keta = 0; while ((sum /= 10) > 0) keta++; printf("%d\n", keta); } return 0; }
#include <stdio.h> int main(void) { int a, b, sum, keta; while (scanf("%d %d", &a, &b) != EOF) { sum = a + b; keta = 1; while ((sum /= 10) > 0) keta++; printf("%d\n", keta); } return 0; }
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 60], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 79], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
0
73
4
#include <stdio.h> int main(void) { int a, b, keta; while (scanf("%d %d", &a, &b) != EOF) { a += b; keta = 0; while ((a /= 10) != 0) keta++; printf("%d\n", keta); } return 0; }
#include <stdio.h> int main(void) { int a, b, keta; while (scanf("%d %d", &a, &b) != EOF) { a += b; keta = 1; while ((a /= 10) != 0) keta++; printf("%d\n", keta); } return 0; }
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
0
69
2
#include <stdio.h> #include <string.h> int main(void) { int a, b; char ch[16]; while (scanf("%d %d", &a, &b) != EOF) { sprintf(ch, "%d", a + b); printf("%d", strlen(ch)); } return 0; }
#include <stdio.h> #include <string.h> int main(void) { int a, b; char ch[16]; while (scanf("%d %d", &a, &b) != EOF) { sprintf(ch, "%d", a + b); printf("%d\n", strlen(ch)); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
69
1
#include <stdio.h> #include <string.h> int main() { char *tmp; int a, b = 0; while ((fscanf(stdin, "%d %d", &a, &b)) != EOF) { sprintf(tmp, "%d", (a + b)); printf("%lu\n", strlen(tmp)); } return 0; }
#include <stdio.h> #include <string.h> int main() { char tmp[10]; int a, b = 0; while ((fscanf(stdin, "%d %d", &a, &b)) != EOF) { sprintf(tmp, "%d", (a + b)); printf("%d\n", strlen(tmp)); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 84, 0, 48], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 0, 70], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 0, 73], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
75
6
#include <stdio.h> int main() { int a, b; int i = 0; int sum; int keta = 1; while (i <= 200) { if (scanf("%d", &a) == EOF) { break; } scanf("%d", &b); sum = a + b; while (sum >= 10) { sum /= 10; keta++; } printf("%d\n", keta); i++; } return (0); }
#include <stdio.h> int main() { int a, b; int i = 0; int sum; int keta = 1; while (i <= 200) { if (scanf("%d", &a) == EOF) { break; } scanf("%d", &b); sum = a + b; while (sum >= 10) { sum /= 10; keta++; } printf("%d\n", keta); i++; keta = 1; } return (0); }
[["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
101
4
#include <stdio.h> int main(void) { int a, b, sum, c; while (scanf("%d %d", &a, &b) != EOF) { sum = a + b; c = 0; while (c > 0) { c /= 10; sum++; } printf("%d\n", sum); } return 0; }
#include <stdio.h> int main(void) { int a, b, sum, c; while (scanf("%d %d", &a, &b) != EOF) { sum = a + b; c = 0; while (sum > 0) { sum /= 10; c++; } printf("%d\n", c); } return 0; }
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 31, 22], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 27, 28, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
0
75
8
h = [] (0..9).each do |i| h[i] = gets.to_i end puts (h.sort.reverse)[0..2].join(',')
h = [] (0..9).each do |i| h[i] = gets.to_i end puts (h.sort.reverse)[0..2].join("\n")
[["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62], ["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 44]]
4
44
6
# encoding:utf-8 No.0001 require 'English' list_of_height = [] list_of_height.push $LAST_READ_LINE while gets puts list_of_height.sort.reverse[0..2]
# encoding:utf-8 No.0001 require 'English' list_of_height = [] list_of_height.push $LAST_READ_LINE.to_i while gets puts list_of_height.sort.reverse[0..2]
[["+", 0, 740, 8, 652, 3, 4, 0, 652, 17, 131], ["+", 0, 740, 8, 652, 3, 4, 0, 652, 735, 22]]
4
26
2
p = [] (0...10).each do |i| p[i] = gets.to_i end p.sort! (0...3).each do |i| print(p[i], "\n") end
p = [] (0...10).each do |i| p[i] = gets.to_i end p.sort! p.reverse! (0...3).each do |i| print(p[i], "\n") end
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 486, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 17, 131], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
50
3
require 'English' p $DEFAULT_INPUT.map(&:to_i).sort.reverse[0, 3]
require 'English' p(*$DEFAULT_INPUT.map(&:to_i).sort.reverse[0, 3])
[["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 24], ["+", 0, 493, 0, 652, 3, 4, 0, 741, 0, 48], ["+", 36, 36, 0, 493, 0, 652, 3, 4, 0, 25]]
4
21
3
um = [] (0..9).each do |i| num[i] = gets.to_i end num.sort! num.reverse! (0..2).each do |i| puts num[i] end
num = [] (0..9).each do |i| num[i] = gets.to_i end num.sort! num.reverse! (0..2).each do |i| puts num[i] end
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22]]
4
47
2
a = [] while c = gets a << c.to_i end a.sort!.reverse! 3.times { puts a }
a = [] while c = gets a << c.to_i end a.sort! 3.times { puts a.pop }
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 17, 131], ["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 8, 734, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 8, 734, 0, 652, 3, 4, 0, 652, 735, 22]]
4
26
4
arr = [] 10.times do arr << gets.to_i end arr.sort! puts (arr[7]).to_s puts (arr[8]).to_s puts (arr[9]).to_s
arr = [] 10.times do arr << gets.to_i end arr.sort! puts (arr[9]).to_s puts (arr[8]).to_s puts (arr[7]).to_s
[["-", 3, 4, 0, 652, 486, 739, 0, 742, 0, 612], ["+", 3, 4, 0, 652, 486, 739, 0, 742, 0, 612]]
4
44
4
val = [] (0..9).each do |_i| val.push(gets.to_i) end val.sort! val.reverse! (0..9).each do |i| puts val[i].to_s end
val = [] (0..9).each do |_i| val.push(gets.to_i) end val.sort! val.reverse! (0..2).each do |i| puts val[i].to_s end
[["-", 0, 493, 0, 652, 486, 739, 0, 475, 444, 612], ["+", 0, 493, 0, 652, 486, 739, 0, 475, 444, 612]]
4
49
2
a = [] 10.times { a << gets.to_i } a.sort 3.times { puts a.pop }
a = [] 10.times { a << gets.to_i } a.sort! 3.times { puts a.pop }
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
26
2
yama = $stdin.read.split("\n").map(&:to_i) 3.times do puts yama.pop end
yama = $stdin.read.split("\n").map(&:to_i) yama = yama.sort 3.times do puts yama.pop end
[["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 486, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22]]
4
27
5
list = [] list << gets.chomp.to_i list.sort.reverse.each_with_index do |x, i| break if i >= 3 puts x end
list = [] 10.times { list << gets.chomp.to_i } list.sort.reverse.each_with_index do |x, i| break if i >= 3 puts x end
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 486, 612], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 17, 131], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 652, 196, 196, 0, 45], ["+", 36, 36, 0, 493, 0, 652, 196, 196, 0, 46]]
4
32
5
a = [] 10.times do |i| n_i = gets.chomp.to_i a[i] = n_i end a.sort! { |x, y| y <=> x } puts a[0] puts a[1] puts a[2][EOF]
a = [] 10.times do |i| n_i = gets.chomp.to_i a[i] = n_i end a.sort! { |x, y| y <=> x } puts a[0] puts a[1] puts a[2]
[["-", 0, 493, 0, 652, 3, 4, 0, 742, 0, 70], ["-", 0, 493, 0, 652, 3, 4, 0, 742, 0, 743], ["-", 0, 493, 0, 652, 3, 4, 0, 742, 0, 73]]
4
56
3
nums = [] 10.times do nums << gets.to_i end puts nums.sort.reverse.slice(0, 3).join("?\n")
nums = [] 10.times do nums << gets.to_i end puts nums.sort.reverse.slice(0, 3).join("\n")
[["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 6]]
4
35
1
heights = [] while line = ARGF.gets heights << line.to_i end heights.sort[0..2].each { |h| puts h }
heights = [] while line = ARGF.gets heights << line.to_i end heights.sort.reverse[0..2].each { |h| puts h }
[["+", 0, 493, 0, 652, 486, 742, 500, 652, 17, 131], ["+", 0, 493, 0, 652, 486, 742, 500, 652, 735, 22]]
4
33
2
array = [] loop do array << gets.to_i counts += 1 # ?????°???????¨??????????????????£??????????????????????????????????????? break if counts > 10 end array.sort! do |a, b| b <=> a end puts array[0] puts array[1] puts array[2]
counts = 1 array = [] loop do array << gets.to_i counts += 1 break if counts > 10 end array.sort! do |a, b| b <=> a end puts array[0] puts array[1] puts array[2]
[["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 12, 612]]
4
49
3
arr = [] 10.times do arr.push(gets.chomp.to_i) end arr.sort! p arr 3.times do |i| puts arr[-1 * (i + 1)] end
arr = [] 10.times do arr.push(gets.chomp.to_i) end arr.sort! 3.times do |i| puts arr[-1 * (i + 1)] end
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]]
4
44
2
data = [] 10.times do data << gets.to_i end puts data.sort.reverse.take(3).join('\n')
data = [] 10.times do data << gets.to_i end puts data.sort.reverse.take(3).join("\n")
[["-", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62], ["+", 3, 4, 0, 652, 3, 4, 0, 557, 0, 62]]
4
32
4
arry = [] (1..10).each do |_i| arry << gets.chomp.to_i end arry.sort! arry.reverse! puts arry.drop(6)
# your code goes here arry = [] (1..10).each do |_i| arry << gets.chomp.to_i end arry.sort! arry.reverse! puts arry.take(3)
[["-", 0, 493, 0, 652, 3, 4, 0, 652, 735, 22], ["+", 0, 493, 0, 652, 3, 4, 0, 652, 735, 22], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
4
36
4
#!/usr/bin/ruby # Volume0-0001 class Main def initialize f = [] 0.upto(9) do |_i| f.push(fh.gets.to_i) end puts f.sort { |a, b| b <=> a }.take(3).map(&:to_s) end end Main.new if $PROGRAM_NAME == __FILE__
#!/usr/bin/ruby # Volume0-0001 class Main def initialize fh = $stdin f = [] 0.upto(9) do |_i| f.push(fh.gets.to_i) end puts f.sort { |a, b| b <=> a }.take(3).map(&:to_s) end end Main.new if $PROGRAM_NAME == __FILE__
[["+", 8, 736, 0, 735, 8, 736, 0, 662, 31, 22], ["+", 8, 736, 0, 735, 8, 736, 0, 662, 0, 32], ["+", 8, 736, 0, 735, 8, 736, 0, 662, 12, 744]]
4
65
3
10.times { |_n| m_list << gets.to_i } m_list.sort! { |a, b| b <=> a } 3.times { |i| p m_list[i] }
m_list = [] 10.times { |_n| m_list << gets.to_i } m_list.sort! { |a, b| b <=> a } 3.times { |i| p m_list[i] }
[["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 36, 36, 0, 493, 0, 662, 12, 516, 0, 70], ["+", 36, 36, 0, 493, 0, 662, 12, 516, 0, 73]]
4
39
4