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
ary = [] 10.times { ary << gets } ary.sort! puts ary[9] puts ary[8] puts ary[7]
ary = [] 10.times { ary << gets.to_i } ary.sort! puts ary[9] puts ary[8] puts ary[7]
[["+", 196, 196, 8, 734, 0, 738, 12, 652, 17, 131], ["+", 196, 196, 8, 734, 0, 738, 12, 652, 735, 22]]
4
30
2
mountains = [] 10.times do mountain = gets.to_i (mountains).push(mountain) end mountains.sort { |a, b| b <=> a } puts mountains[0..2]
mountains = [] 10.times do mountain = gets.to_i (mountains).push(mountain) end mountains = mountains.sort { |a, b| b <=> a } puts mountains[0..2]
[["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 486, 22]]
4
42
2
mountains = [] 10.times do mountain = gets.to_i (mountains).push(mountain) end mountains.sort { |a, b| b <=> a } puts mountains[0..2]
mountains = [] 10.times do mountain = gets.to_i (mountains).push(mountain) end mountains.sort! { |a, b| b <=> a } puts mountains[0..2]
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
42
2
top3 = [0, 0, 0] 10.times do n = gets.chomp.to_i next unless n > top3[0] top3[0] = n top3.sort! p top3 end top3.sort { |a, b| b <=> a }.each do |n| puts(n) end
top3 = [0, 0, 0] 10.times do n = gets.chomp.to_i if n > top3[0] top3[0] = n top3.sort! end end top3.sort { |a, b| b <=> a }.each do |n| puts(n) end
[["-", 196, 737, 8, 736, 0, 745, 8, 746, 0, 746], ["-", 0, 652, 196, 737, 8, 736, 0, 745, 0, 747], ["+", 0, 652, 196, 737, 8, 736, 0, 121, 0, 121], ["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["-", 196, 737, 8, 736, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 121, 0, 444]]
4
64
6
heights = [] while height = $stdin.gets heights.push(height.chomp) end heights.sort! 3.times do puts heights.pop end
heights = [] while height = $stdin.gets heights.push(height.chomp.to_i) end heights.sort! 3.times do puts heights.pop end
[["+", 8, 170, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 8, 170, 0, 652, 3, 4, 0, 652, 735, 22]]
4
31
2
mountains = [] 10.times { |i| mountains[i] = gets.chomp.to_i } mountains.reverse! 3.times { |i| puts mountains[i] }
mountains = [] 10.times { |i| mountains[i] = gets.chomp.to_i } mountains.sort!.reverse! 3.times { |i| puts mountains[i] }
[["+", 36, 36, 0, 493, 0, 652, 486, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 17, 131]]
4
38
2
height_mountain = [] while line = gets height_mountain.push(line.to_i) end height_mountain.sort! 3.times do |idx| puts height_mountain[idx] end
height_mountain = [] while line = gets height_mountain.push(line.to_i) end height_mountain.sort!.reverse! 3.times do |idx| puts height_mountain[idx] end
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 17, 131], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
33
2
arr = [] while input = gets arr.putsh(input.to_i) end arr.sort! { |a, b| b <=> a } puts arr[0], arr[1], arr[2]
arr = [] while input = gets arr.push(input.to_i) end arr.sort! { |a, b| b <=> a } puts arr[0], arr[1], arr[2]
[["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22]]
4
45
2
mt = [] 10.times do mt.push($stdin.gets.to_i) end mt.sort! puts mt[-3] puts mt[-2] puts mt[-1]
mt = [] 10.times do mt.push($stdin.gets.to_i) end mt.sort! puts mt[-1] puts mt[-2] puts mt[-3]
[["-", 0, 652, 3, 4, 0, 742, 0, 748, 439, 612], ["+", 0, 652, 3, 4, 0, 742, 0, 748, 439, 612]]
4
40
4
num = [] i = 0 while i < 10 num[i] = gets.to_i i += 1 end num.sort! { |a, b| -1 * (a <=> b) } puts 'result' (0..2).each do |n| puts (num[n]).to_s end
num = [] i = 0 while i < 10 num[i] = gets.to_i i += 1 end num.sort! { |a, b| -1 * (a <=> b) } (0..2).each do |n| puts (num[n]).to_s end
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 0, 493, 0, 652, 3, 4, 0, 557, 0, 62], ["-", 0, 493, 0, 652, 3, 4, 0, 557, 0, 6]]
4
66
4
line = [] while l = gets line << l.to_i end line = line.sort p line puts line[9] puts line[8] puts line[7]
line = [] while l = gets line << l.to_i end line = line.sort puts line[9] puts line[8] puts line[7]
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]]
4
36
2
# 配列の生成 height = [] 10.times do # 標準入力を整数に変換して配列に格納 height.push($stdin.get.to_i) end # 配列の並び替え height.sort! puts height[-1] puts height[-2] puts height[-3]
#! ruby -Ks # 配列の生成 height = [] 10.times do # 標準入力を整数に変換して配列に格納 height.push($stdin.gets.to_i) end # 配列の並び替え height.sort! p height[-1] p height[-2] p height[-3]
[["-", 0, 652, 3, 4, 0, 652, 486, 652, 735, 22], ["+", 0, 652, 3, 4, 0, 652, 486, 652, 735, 22], ["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
43
8
#! ruby -Ks # 配列の生成 height = [] 10.times do # 標準入力を整数に変換して配列に格納 height.push($stdin.get.to_i) end # 配列の並び替え height.sort! puts height[-1] puts height[-2] puts height[-3]
#! ruby -Ks # 配列の生成 height = [] 10.times do # 標準入力を整数に変換して配列に格納 height.push($stdin.gets.to_i) end # 配列の並び替え height.sort! # height[height.size()-1]の省略と考えると分かり易い p height[-1] p height[-2] p height[-3]
[["-", 0, 652, 3, 4, 0, 652, 486, 652, 735, 22], ["+", 0, 652, 3, 4, 0, 652, 486, 652, 735, 22], ["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
44
8
arr = [] (0...10).each do |_cnt| arr.push(gets.chomp) end arr.sort!.reverse! (0...3).each do |cnt| puts(arr[cnt]) end
arr = [] (0...10).each do |_cnt| arr.push(gets.chomp.to_i) end arr.sort!.reverse! (0...3).each do |cnt| puts(arr[cnt]) end
[["+", 8, 736, 0, 652, 3, 4, 0, 652, 17, 131], ["+", 8, 736, 0, 652, 3, 4, 0, 652, 735, 22]]
4
48
2
a = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (0..9).each do |num| a[num] = gets.chomp end n = a.size - 1 (0..n).each do |i| (0..n - i - 1).each do |j| next unless a[j] > a[j + 1] tmp = a[j] a[j] = a[j + 1] a[j + 1] = tmp end end puts a[9] puts a[8] puts a[7]
a = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (0..9).each do |num| a[num] = gets.to_i end n = a.size - 1 (0..n).each do |i| (0..n - i - 1).each do |j| next unless a[j] > a[j + 1] tmp = a[j] a[j] = a[j + 1] a[j + 1] = tmp end end puts a[9] puts a[8] puts a[7]
[["-", 196, 737, 8, 736, 0, 662, 12, 652, 735, 22], ["+", 196, 737, 8, 736, 0, 662, 12, 652, 735, 22]]
4
131
2
num = [int(input()) for i in range(10)] num.sort(reverse=True) for i in range[0:3]: print(num[i])
num = [int(input()) for i in range(10)] num.sort(reverse=True) for i in range(3): print(num[i])
[["-", 36, 36, 0, 656, 0, 7, 12, 206, 0, 70], ["-", 0, 656, 0, 7, 12, 206, 206, 663, 0, 612], ["-", 0, 656, 0, 7, 12, 206, 206, 663, 0, 102], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["-", 36, 36, 0, 656, 0, 7, 12, 206, 0, 73], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25]]
5
42
6
mountains = [] for i in range(10): m = int(input()) mountains.append(m) mountains.sort() for i in range(3): print(mountains[i])
mountains = [] for i in range(10): m = int(input()) mountains.append(m) mountains.sort(reverse=True) for i in range(3): print(mountains[i])
[["+", 0, 1, 0, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 0, 32], ["+", 0, 1, 0, 652, 3, 4, 0, 653, 51, 146]]
5
46
3
import sys #list = sys.stdin.readlines() i=0 list = [] for line in sys.stdin.readlines(): list.append(int(line.strip("\n"))) print(soted(list, reverse=True)[0]) print(soted(list, reverse=True)[1]) print(soted(list, reverse=True)[2])
import sys #list = sys.stdin.readlines() i=0 list = [] for line in sys.stdin.readlines(): list.append(int(line.strip("\n"))) print(sorted(list, reverse=True)[0]) print(sorted(list, reverse=True)[1]) print(sorted(list, reverse=True)[2])
[["-", 0, 652, 3, 4, 0, 206, 51, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 206, 51, 652, 63, 22]]
5
79
6
#!/usr/bin/env python3 #coding: utf-8 # Volume0 - 0001 (http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0001) li = [] for x in range(10): s = input() int(s) li.append(s) li.sort() li.reverse() for y in range(3): print(li[y])
#!/usr/bin/env python3 #coding: utf-8 # Volume0 - 0001 (http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0001) li = [] for x in range(10): s = input() s = int(s) li.append(s) li.sort() li.reverse() for y in range(3): print(li[y])
[["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32]]
5
55
2
import sys mt_heigts = list(map(int, sys.stdin.readlines())) mt_heigts.sort(reverse=True) for height in mt_heights[:3]: print(height)
import sys mt_heights = list(map(int, sys.stdin.readlines())) mt_heights.sort(reverse=True) for height in mt_heights[:3]: print(height)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 1, 0, 652, 63, 319, 500, 22]]
5
40
4
lis=[]; for i in range(10): h=int(input()); lis.append(h); for i in range(10): for j in range(10): if lis[i]<lis[j]: a=lis[i]; lis[i]=lis[j]; lis[j]=a; for i in range(3): print(lis[i]);
lis=[]; for i in range(10): h=int(input()); lis.append(h); for i in range(10): for j in range(i+1,10): if lis[i]<lis[j]: a=lis[i]; lis[i]=lis[j]; lis[j]=a; for i in range(3): print(lis[i]);
[["+", 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, 21]]
5
96
4
m=[input() for i in range(10)] m.sort() m.reverse() print("{0}\n{1}\n{2}".format(m[0],m[1],m[2]))
#! /usr/bin/python3 m=[int(input()) for i in range(10)] m.sort() m.reverse() print("{0}\n{1}\n{2}".format(m[0], m[1], m[2]))
[["+", 0, 1, 0, 662, 12, 658, 8, 652, 63, 22], ["+", 0, 662, 12, 658, 8, 652, 3, 4, 0, 24], ["+", 8, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
52
3
if __name__ == "__main__": a = [] for i in range(0,10): val = input() a.append(int(val)) a.sort() a.reverse() for i in range(0,3): print(a[i]) print(a)
if __name__ == "__main__": a = [] for i in range(0,10): val = input() a.append(int(val)) a.sort() a.reverse() for i in range(0,3): print(a[i])
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
66
4
# -*- coding:utf-8 -*- def main(): List=[] for i in range(10): a=input() List.append(a) List.sort(reverse=True) print(List[0]) print(List[1]) print(List[2]) if __name__ == '__main__': main()
# -*- coding:utf-8 -*- def main(): List=[] for i in range(10): a=int(input()) List.append(a) List.sort(reverse=True) print(List[0]) print(List[1]) print(List[2]) if __name__ == '__main__': main()
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
68
3
s=[int(input(x)) for x in range(10)] print(sorted(s)[-1]) print(sorted(s)[-2]) print(sorted(s)[-3])
s=[int(input()) for x in range(10)] print(sorted(s)[-1]) print(sorted(s)[-2]) print(sorted(s)[-3])
[["-", 8, 652, 3, 4, 0, 652, 3, 4, 0, 22]]
5
51
1
#include <stdio.h> int main(void) { long int A, B, total; int count; while (scanf("%d %d", &A, &B) != EOF) { total = A + B; for (count = 0; total != 0; total /= 10, count++) ; printf("%d\n", count); } return 0; }
#include <stdio.h> int main(void) { long int A, B, total; int count; while (scanf("%ld %ld", &A, &B) != EOF) { total = A + B; for (count = 0; total != 0; total /= 10, count++) ; printf("%d\n", count); } return 0; }
[["-", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6]]
0
76
2
#include <stdio.h> int main(void) { int i, a, b, sum; while (scanf("%d%d", &a, &b) != EOF) { sum = a + b; for (i = 0; sum != 0; i++) { sum /= 10; } printf("%d", i); } return 0; }
#include <stdio.h> int main(void) { int i, a, b, sum; while (scanf("%d%d", &a, &b) != EOF) { sum = a + b; for (i = 0; sum != 0; i++) { sum /= 10; } printf("%d\n", i); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
74
1
#include <stdio.h> int main(void) { int num1, num2; int count; while (1) { num1 = -1; scanf("%d %d", &num1, &num2); if (num1 < 0) break; num1 += num2; while (num1 != 0) { num1 /= 10; ++count; } printf("%d\n", count); num1 = 0; num2 = 0; } return 0; }
#include <stdio.h> int main(void) { int num1, num2; int count; while (1) { num1 = -1; scanf("%d %d", &num1, &num2); if (num1 < 0) break; num1 += num2; while (num1 != 0) { num1 /= 10; ++count; } printf("%d\n", count); num1 = 0; num2 = 0; count = 0; } 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
88
4
#include <stdio.h> int main() { int a, b, sum, i; while (scanf("%d %d", a, b) != -1) { sum = a + b; for (i = 0; sum != 0; i++) { sum = sum / 10; } printf("%d\n", i); } return 0; }
#include <stdio.h> int main() { int a, b, sum, i; while (scanf("%d %d", &a, &b) != -1) { sum = a + b; for (i = 0; sum != 0; i++) { sum = (int)sum / 10; } printf("%d\n", i); } return 0; }
[["+", 0, 16, 31, 2, 3, 4, 0, 66, 17, 67], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 0, 24], ["+", 0, 11, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 0, 25]]
0
74
5
#include <stdio.h> int main(void) { int a, b, i, sum; while (scanf("%d %d", &a, &b) != EOF) { i = 0; sum = a + b; while ((sum / 10) != 0) { i++; sum /= 10; } printf("%d\n", i); } return 0; }
#include <stdio.h> int main(void) { int a, b, i, sum; while (scanf("%d %d", &a, &b) != EOF) { i = 0; sum = a + b; while (sum != 0) { i++; sum /= 10; } printf("%d\n", i); } return 0; }
[["-", 0, 52, 15, 23, 0, 16, 31, 23, 0, 24], ["-", 15, 23, 0, 16, 31, 23, 0, 16, 17, 85], ["-", 15, 23, 0, 16, 31, 23, 0, 16, 12, 13], ["-", 0, 52, 15, 23, 0, 16, 31, 23, 0, 25]]
0
79
4
#include <stdio.h> int digit(int x) { int i; for (i = 1; x /= 10; i++) return i; } int main() { int a, b; while (scanf("%d %d", &a, &b) != EOF) printf("%d\n", digit(a + b)); return 0; }
#include <stdio.h> int digit(int x) { int i; for (i = 1; x /= 10; i++) ; return i; } int main() { int a, b; while (scanf("%d %d", &a, &b) != EOF) printf("%d\n", digit(a + b)); return 0; }
[["+", 0, 14, 8, 9, 0, 7, 8, 1, 0, 35]]
0
75
1
#include <stdio.h> int main(void) { int a, b, sum, c; while (scanf("%d", &a) != EOF) { scanf("%d", &b); sum = a + b; c = 0; while (sum >= 10) { sum = sum / 10; c += 1; } printf("%d\n", c); } return 0; }
#include <stdio.h> int main(void) { int a, b, sum, c; while (scanf("%d", &a) != EOF) { scanf("%d", &b); sum = a + b; c = 1; while (sum >= 10) { sum = sum / 10; c += 1; } printf("%d\n", c); } return 0; }
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
0
85
2
#include <math.h> #include <stdio.h> int main(void) { int a, b; while (scanf("%d %d", &a, &b) != EOF) { printf("%d\n", (int)log10(a * b) + 1); } return 0; }
#include <math.h> #include <stdio.h> int main(void) { int a, b; while (scanf("%d %d", &a, &b) != EOF) { printf("%d\n", (int)log10(a + b) + 1); } return 0; }
[["-", 31, 74, 51, 2, 3, 4, 0, 16, 17, 48], ["+", 31, 74, 51, 2, 3, 4, 0, 16, 17, 72]]
0
58
2
#include <stdio.h> int main(void) { int a[200], b[200], sum[200], n, i = 0, j; while (scanf("%d %d", &a[i], &b[i]) != EOF) { sum[i] = a[i] + b[i]; i++; } for (j = 0; j <= i; j++) { n = 1; while (sum[j] >= 10) { n++; sum[j] = sum[j] / 10; } printf("%d\n", n); } return 0; }
#include <stdio.h> int main(void) { int a[200], b[200], sum[200], n, i = 0, j; while (scanf("%d %d", &a[i], &b[i]) != EOF) { sum[i] = a[i] + b[i]; i++; } for (j = 0; j < i; j++) { n = 1; while (sum[j] >= 10) { n++; sum[j] = sum[j] / 10; } printf("%d\n", n); } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
0
134
2
#include <stdio.h> int main(void) { // Here your code ! int a, b; int work; int cnt = 0; int i; for (i = 0; i < 200; i++) { cnt = 0; if (scanf("%d %d", &a, &b) == EOF) break; work = (a + b) / 10; while (work) { cnt++; work = work / 10; } printf("%d\n", cnt); } return 0; }
#include <stdio.h> int main(void) { // Here your code ! unsigned int a, b; unsigned int work; unsigned int cnt = 0; int i; for (i = 0; i < 200; i++) { cnt = 1; if (scanf("%d %d", &a, &b) == EOF) break; work = (a + b) / 10; while (work) { cnt++; work = work / 10; } printf("%d\n", cnt); } return 0; }
[["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 87], ["-", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 13]]
0
102
5
#include <stdio.h> int main() { int i, j, k; while (scanf("%d %d", &i, &j) != EOF) { k = i + j; int l = 0; while (k >= 10) { k = k / 10; l = l + 1; } printf("%d\n", l); } return 0; }
#include <stdio.h> int main() { int i, j, k; while (scanf("%d %d", &i, &j) != EOF) { k = i + j; int l = 0; while (k > 0) { k = k / 10; l = l + 1; } printf("%d\n", l); } return 0; }
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 20], ["-", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13]]
0
78
4
#include <stdio.h> int main(void) { int a, b, c, keta = 0; while (scanf("%d%d", &a, &b) != EOF) { c = a + b; while (1) { c = c / 10; keta++; if (c == 0) { break; } } printf("%d", keta); keta = 0; } }
#include <stdio.h> int main(void) { int a, b, c, keta = 0; while (scanf("%d%d", &a, &b) != EOF) { c = a + b; while (1) { c = c / 10; keta++; if (c == 0) { break; } } printf("%d\n", keta); keta = 0; } }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
83
1
#include <stdio.h> int main(void) { int i = 0; int tmp1, tmp2, tmp, count; while (scanf("%d%d", &tmp1, &tmp2) != EOF) { tmp = tmp1 + tmp2; count = 0; while (tmp > 1) { count++; tmp = tmp / 10; } printf("%d\n", count); } return 0; }
#include <stdio.h> int main(void) { int i = 0; int tmp1, tmp2, tmp, count; while (scanf("%d%d", &tmp1, &tmp2) != EOF) { tmp = tmp1 + tmp2; count = 0; while (tmp > 0) { count++; tmp = tmp / 10; } printf("%d\n", count); } return 0; }
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13]]
0
82
2
#include <math.h> #include <stdio.h> int main() { int a, b; while (scanf("%f %f", &a, &b) == 2) { printf("%d\n", (int)log10(a + b) + 1); } return 0; }
#include <math.h> #include <stdio.h> int main() { int a, b; while (scanf("%d %d", &a, &b) != EOF) { printf("%d\n", (int)log10(a + b) + 1); } return 0; }
[["-", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 60], ["-", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 79], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 22]]
0
57
6
#include <stdio.h> int main() { int a[200], b[200], c[200], t, i, j; for (i = 0; i < 200; i++) { if (scanf("%d %d", &a[i], &b[i]) == EOF) { break; } else { c[i] = a[i] + b[i]; } } for (j = 0; j <= i; j++) { t = 1; while (c[j] >= 10) { c[j] = c[j] / 10; t++; } printf("%d\n", t); } return 0; }
#include <stdio.h> int main() { int a[200], b[200], c[200], t, i, j; for (i = 0; i < 200; i++) { if (scanf("%d %d", &a[i], &b[i]) == EOF) { break; } else { c[i] = a[i] + b[i]; } } for (j = 0; j < i; j++) { t = 1; while (c[j] >= 10) { c[j] = c[j] / 10; t++; } printf("%d\n", t); } return 0; }
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
0
148
2
b; main(a) { while (scanf("%d%d", &a, &b) - 2) { a += b; b = 0; while (a > 0) a /= 10, b++; printf("%d\n", b); } exit(0); }
b; main(a) { while (scanf("%d%d", &a, &b) > 0) { a += b; b = 0; while (a > 0) a /= 10, b++; printf("%d\n", b); } exit(0); }
[["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 33], ["-", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13]]
0
63
4
b; main(a) { for (; scanf("%d%d", &a, &b) > 0; a += b) { for (b = 0; a > 0; b++) a /= 10; printf("%d\n", b); } exit(0); }
b; main(a) { while (scanf("%d%d", &a, &b) > 0) { a += b; for (b = 0; a > 0; b++) a /= 10; printf("%d\n", b); } exit(0); }
[["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 88], ["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 23, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["-", 0, 30, 0, 14, 8, 9, 0, 7, 0, 25], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 45], ["+", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
0
64
8
#include <math.h> #include <stdio.h> int main(void) { int a, b; while (scanf("%d", &a) != EOF) { scanf("%d", &b); printf("%d\n", (int)(log10(a * b) + 1)); } return 0; }
#include <math.h> #include <stdio.h> int main(void) { int a, b; while (scanf("%d", &a) != EOF) { scanf("%d", &b); printf("%d\n", (int)(log10(a + b) + 1)); } return 0; }
[["-", 0, 16, 31, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 16, 31, 2, 3, 4, 0, 16, 17, 72]]
0
67
2
#include <stdio.h> #include <stdlib.h> #include <string.h> int i, j, a, b, c, ans = 0; int main() { while (scanf("%d %d", &a, &b) != EOF) { c = a + b; while (c != 0) c = c / 10, ans++; printf("%d", ans); } return 0; }
#include <stdio.h> #include <stdlib.h> #include <string.h> int i, j, a, b, c, ans = 0; int main() { while (scanf("%d %d", &a, &b) != EOF) { c = a + b; while (c != 0) c = c / 10, ans++; printf("%d\n", ans); ans = 0; } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 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
79
5
#include <stdio.h> main() { int a, b, i, sum; while (scanf("%d %d", &a, &b) != EOF) { sum = a + b; for (i = 1; sum > 1; i++) sum = sum / 10; printf("%d\n", i); } return (0); }
#include <stdio.h> main() { int a, b, i, sum; while (scanf("%d %d", &a, &b) != EOF) { sum = a + b; for (i = 1; sum > 9; i++) sum /= 10; printf("%d\n", i); } return (0); }
[["-", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 52, 8, 9, 0, 7, 15, 16, 12, 13], ["-", 8, 9, 0, 7, 8, 1, 0, 11, 31, 22], ["-", 8, 9, 0, 7, 8, 1, 0, 11, 17, 32], ["-", 0, 7, 8, 1, 0, 11, 12, 16, 17, 85], ["+", 8, 9, 0, 7, 8, 1, 0, 11, 17, 90]]
0
76
6
c[]; main(a, b) { for (; ~scanf("%d%d", &a, &b); printf("%d", sprintf(c, "%d", a + b))) ; }
c[]; main(a, b) { for (; ~scanf("%d%d", &a, &b); printf("%d\n", sprintf(c, "%d", a + b))) ; }
[["+", 0, 7, 26, 2, 3, 4, 0, 5, 0, 44]]
0
52
10
a; main(b) { for (; ~scanf("%d%d", &a, &b); printf("%d\n", log10(a + b) + 1)) ; }
a; main(b) { for (; ~scanf("%d%d", &a, &b); printf("%d\n", a = 1 + log10(a + b))) ; }
[["+", 0, 7, 26, 2, 3, 4, 0, 11, 31, 22], ["+", 0, 7, 26, 2, 3, 4, 0, 11, 17, 32], ["+", 26, 2, 3, 4, 0, 11, 12, 16, 31, 13], ["+", 26, 2, 3, 4, 0, 11, 12, 16, 17, 72], ["-", 0, 7, 26, 2, 3, 4, 0, 16, 17, 72], ["-", 0, 7, 26, 2, 3, 4, 0, 16, 12, 13]]
0
43
6
#include <stdio.h> main() { int a, b, ans = 0; int i = 0; while (scanf("%d%d", &a, &b) == 2) { ans = a + b; while (1) { if (ans == 0) break; i++; ans /= 10; } printf("%d", i); i = 0; } return 0; }
#include <stdio.h> main() { int a, b, ans = 0; int i = 0; while (scanf("%d%d", &a, &b) == 2) { ans = a + b; while (1) { if (ans == 0) break; i++; ans /= 10; } printf("%d\n", i); i = 0; } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
84
1
#include <math.h> #include <stdio.h> int main(void) { int a, b; while (scanf("%d %d", &a, &b) == 2) printf("%d", (int)log10(a + b) + 1); return 0; }
#include <math.h> #include <stdio.h> int main(void) { int a, b; while (scanf("%d %d", &a, &b) == 2) printf("%d\n", (int)log10(a + b) + 1); return 0; }
[["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
55
4
#include <math.h> #include <stdio.h> int main(void) { int a, b; while (scanf("%d %d", &a, &b) == 2) printf("%d", (int)log10(a + b) + 1); return 0; }
#include <math.h> #include <stdio.h> int main(void) { int a, b; while (~scanf("%d %d", &a, &b)) printf("%d\n", (int)log10(a + b) + 1); return 0; }
[["+", 8, 9, 0, 52, 15, 23, 0, 91, 17, 92], ["-", 8, 9, 0, 52, 15, 23, 0, 16, 17, 60], ["-", 8, 9, 0, 52, 15, 23, 0, 16, 12, 13], ["+", 8, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
55
4
#include <stdio.h> int main() { int a, b, i, s; while (scanf("%d %d", &a, &b) != EOF) { s = a + b; for (i = 0; s != 0; i++) { s /= 10; } printf("%d", i); } return 0; }
#include <stdio.h> int main() { int a, b, i, s; while (scanf("%d %d", &a, &b) != EOF) { s = a + b; for (i = 0; s != 0; i++) { s /= 10; } printf("%d\n", i); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
73
1
#include <stdio.h> int main(void) { int a, b, c, i; while (1) { if (scanf("%d%d", &a, &b) == EOF) break; c = a + b; i = 1; while (1) { if ((c / 10) < 1) break; else { i++; c /= 10; } } printf("%d¥n", i); } return 0; }
#include <stdio.h> int main(void) { int a, b, c, i; while (1) { if (scanf("%d%d", &a, &b) == EOF) break; c = a + b; i = 1; while (1) { if ((c / 10) < 1) break; else { i++; c /= 10; } } printf("%d\n", i); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
93
3
#include <stdio.h> int main() { int a[50], i = 0, n, b = 1, c = 1, code, aa = 0; while (1) { scanf("%d %d", &b, &c); if (getchar() == EOF) break; a[i] = b + c; aa++; i++; } for (i = 0; i < aa; i++) { n = 0; while (1) { a[i] = a[i] / 10; n++; if (a[i] < 1) break; } printf("%d\n", n); } return 0; }
#include <stdio.h> int main() { int a[500], i = 0, n, b = 1, c = 1, code, aa = 0; while (1) { scanf("%d %d", &b, &c); if (getchar() == EOF) break; a[i] = b + c; aa++; i++; } for (i = 0; i < aa; i++) { n = 0; while (1) { a[i] = a[i] / 10; n++; if (a[i] < 1) break; } printf("%d\n", n); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
142
2
#include <stdio.h> int main() { int a, b, c, i; for (;;) { if (scanf("%d %d", &a, &b) == EOF) break; c = a + b; for (i = 1;; i++) { if (c < 10) { break; } else { c = (c - (c % 10)) / 10; } } printf("%d\n", i); break; } return 0; }
#include <stdio.h> int main() { int a, b, c, i; for (;;) { if (scanf("%d %d", &a, &b) == EOF) break; c = a + b; for (i = 1;; i++) { if (c < 10) { break; } else { c = (c - (c % 10)) / 10; } } printf("%d\n", i); } return 0; }
[["-", 8, 9, 0, 7, 8, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 7, 8, 9, 0, 93, 0, 35]]
0
103
2
#include <math.h> #include <stdio.h> int main() { int a, b, ans; while (scanf("%d %d", &a, &b) != EOF) { ans = (int)log10(a + b) + 1; printf("%d", ans); }; return 0; }
#include <math.h> #include <stdio.h> int main() { int a, b, ans; while (scanf("%d %d", &a, &b) != EOF) { ans = (int)log10(a + b) + 1; printf("%d\n", ans); }; return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
63
1
#include <stdio.h> int main() { int a, b, i = 0; /* printf("2つの正の整数a,bを入力してください\n"); printf("a b ="); */ while (scanf("%d%d", &a, &b) != EOF) { a = a + b; while (a >= 1) { a /= 10; i++; } /*printf("aとbの和の桁数は%dです\n",i);*/ printf("%d\n", i); } return 0; }
#include <stdio.h> int main() { int a, b, i = 0; /* printf("2つの正の整数a,bを入力してください\n"); printf("a b ="); */ while (scanf("%d%d", &a, &b) != EOF) { a = a + b; while (a >= 1) { a /= 10; i++; } /*printf("aとbの和の桁数は%dです\n",i);*/ printf("%d\n", i); i = 0; } 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
72
4
#include <math.h> #include <stdio.h> int main() { int a, b; while (~scanf("%d%d", &a, &b)) ; printf("%d\n", 1 + (int)log10(a + b)); return 0; }
#include <math.h> #include <stdio.h> int main() { int a, b; while (~scanf("%d%d", &a, &b)) { printf("%d\n", 1 + (int)log10(a + b)); } return 0; }
[["-", 0, 14, 8, 9, 0, 52, 8, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
0
55
3
#include <math.h> #include <stdio.h> int main(void) { int a, b, c; while (scanf("%d %d", &a, &b) != EOF) { c = 1; c = c + log10(a + b); printf("%d", c); } return 0; }
#include <math.h> #include <stdio.h> int main(void) { int a, b, c; while (scanf("%d %d", &a, &b) != EOF) { c = 1; c = c + log10(a + b); printf("%d\n", c); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
64
1
#include <stdio.h> int main() { int a, b, n, m, c; while ((scanf("%d %d", &a, &b)) != EOF) ; m = a + b; n = 1; c = 0; while (1) { if (m % n == m) break; c++; n = n * 10; } printf("%d\n", c); return 0; }
#include <stdio.h> int main() { int a, b, n, m, c; while ((scanf("%d %d", &a, &b)) != EOF) { m = a + b; n = 1; c = 0; while (1) { if (m % n == m) break; c++; n = n * 10; } printf("%d\n", c); } return 0; }
[["-", 0, 14, 8, 9, 0, 52, 8, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
0
91
3
#include <stdio.h> #include <string.h> int main() { int a, b, num, i, j; while (scanf("%d %d", &a, &b) != EOF) { num = a + b; for (j = 0; num != 0; j++) { num = num / 10; } printf("%d", j); } return 0; }
#include <stdio.h> #include <string.h> int main() { int a, b, num, i, j; while (scanf("%d %d", &a, &b) != EOF) { num = a + b; for (j = 0; num != 0; j++) { num = num / 10; } printf("%d\n", j); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
79
1
#include <stdio.h> int main() { double a, b, keta, sum; while (scanf("%lf %lf", &a, &b) != EOF) { keta = 1; sum = a + b; while (sum > 9) { sum /= 10; keta++; } printf("%.0lf\n", keta); } return (0); }
#include <stdio.h> int main() { int a, b, keta, sum; while (scanf("%d %d", &a, &b) != EOF) { keta = 1; sum = a + b; while (sum > 9) { sum /= 10; keta++; } printf("%d\n", keta); } return (0); }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
76
6
#include <stdio.h> int main(void) { unsigned long a, b, sum; while (scanf("%lu %lu", &a, &b) != EOF) { int i; int count = 0; sum = a + b; while (sum > 0) { sum /= 10; count++; } printf("%d", count); } return 0; }
#include <stdio.h> int main(void) { unsigned long a, b, sum; while (scanf("%lu %lu", &a, &b) != EOF) { int i; int count = 0; sum = a + b; while (sum > 0) { sum /= 10; count++; } printf("%d\n", count); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
77
1
#include <stdio.h> int main(void) { int a, b; while (scanf("%d%d"), &a, &b) { a += b; b = 1; while (a >= 10) { a /= 10; b++; } printf("%d\n", b); } return 0; }
#include <stdio.h> int main(void) { int a, b; while (scanf("%d%d", &a, &b) != EOF) { a += b; b = 1; while (a >= 10) { a /= 10; b++; } printf("%d\n", b); } return 0; }
[["-", 15, 23, 0, 34, 31, 2, 3, 4, 0, 25], ["+", 15, 23, 0, 16, 31, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 17, 79], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 22]]
0
67
4
#include <stdio.h> int keta(int n); int main(void) { int a, b; while (scanf("%d %d", &a, &b) != EOF) { printf("%d", keta(a + b)); } return 0; } int keta(int n) { int s = 0, k = 1; while (n / k > 0) { s++; k *= 10; } }
#include <stdio.h> int keta(int n); int main(void) { int a, b; while (scanf("%d %d", &a, &b) != EOF) { printf("%d\n", keta(a + b)); } return 0; } int keta(int n) { int s = 0, k = 1; while (n / k > 0) { s++; k *= 10; } return s; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
0
91
4
#include <stdio.h> int main(void) { int x, y, i, ans; while (scanf("%d %d", &x, &y) != EOF) { i = 0; ans = x + y; while (ans > 0) { ans /= 10; i++; } printf("%d", i); } return (0); }
#include <stdio.h> int main(void) { int x, y, i, ans; while (scanf("%d %d", &x, &y) != EOF) { i = 0; ans = x + y; while (ans > 0) { ans /= 10; i++; } printf("%d\n", i); } return (0); }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
76
1
#include <stdio.h> int main(void) { int a, b; while (scanf("%d %d", &a, &b) != EOF) { a = log10(a + b); printf("%d\n", a); } return 0; }
#include <stdio.h> int main(void) { int a, b; while (scanf("%d %d", &a, &b) != EOF) { a = log10(a + b); printf("%d\n", a + 1); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
0
55
2
#include <cstdio> using namespace std; int main() { int a, b; while (scanf("%d", &a) != EOF) { scanf("%d", &b); int total = a + b, ans = 1; while ((total / 1) > 10) { total /= 10; ++ans; } printf("%d\n", ans); } return 0; }
#include <cstdio> using namespace std; int main() { int a, b; while (scanf("%d", &a) != EOF) { scanf("%d", &b); int total = a + b, ans = 1; while ((total / 1) >= 10) { total /= 10; ++ans; } printf("%d\n", ans); } return 0; }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20]]
1
86
2
#include <iostream> using namespace std; int main(void) { int a, b; cin >> a >> b; for (a += b, b = 0; a > 0; b++, a /= 10) ; cout << b << endl; }
#include <iostream> using namespace std; int main(void) { int a, b; while (cin >> a >> b) { for (a += b, b = 0; a > 0; b++, a /= 10) ; cout << b << endl; } }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
52
6
#include <cstdio> #include <string> int main() { int a, b; scanf("%d %d", &a, &b); printf("%ld\n", std::to_string(a + b).size()); }
#include <cstdio> #include <string> int main() { int a, b; while (~scanf("%d %d", &a, &b)) printf("%ld\n", std::to_string(a + b).size()); }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["+", 8, 9, 0, 52, 15, 339, 51, 91, 17, 92], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25]]
1
49
5
#include <iostream> using namespace std; int main() { int a, b, x = 1, count = 0; while (cin >> a >> b, !cin.eof()) { x = 1; count = 0; while (a + b > x) { x *= 10; count++; } cout << count << endl; } }
#include <iostream> using namespace std; int main() { int a, b, x = 1, count = 0; while (cin >> a >> b, !cin.eof()) { x = 1; count = 0; while (a + b >= x) { x *= 10; count++; } cout << count << endl; } }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20]]
1
73
2
#include <iostream> #include <string> using namespace std; int main() { int a, b; cin >> a >> b; string s(to_string(a + b)); cout << s.size() << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main() { int a, b; while (cin >> a >> b) { string s(to_string(a + b)); cout << s.size() << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
49
6
#include <stdio.h> int main() { long a, b; while (scanf("%d %d", &a, &b) != -1) { a += b; b = 0; while (a > 0) { a /= 10; b++; } printf("%d\n", b); } return 0; }
#include <stdio.h> int main() { int a, b; while (scanf("%d %d", &a, &b) != -1) { a += b; b = 0; while (a > 0) { a /= 10; b++; } printf("%d\n", b); } return 0; }
[["-", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
68
2
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iostream> #include <iterator> #include <math.h> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; #define rep(I, N) for (int I = 0; I < (int)(N); I++) #define FIN(V) cout << V << endl #define pb push_back #define INF (1 << 30) typedef pair<int, int> P; typedef long long ll; typedef priority_queue<int> pq; int main(void) { int a; while (cin >> a) { int b; cin >> a; int c = a + b; stringstream ss; string s; ss << c; s = ss.str(); cout << s.size() << endl; } return 0; }
#include <algorithm> #include <cstdio> #include <cstdlib> #include <iostream> #include <iterator> #include <math.h> #include <queue> #include <sstream> #include <string> #include <vector> using namespace std; #define rep(I, N) for (int I = 0; I < (int)(N); I++) #define FIN(V) cout << V << endl #define pb push_back #define INF (1 << 30) typedef pair<int, int> P; typedef long long ll; typedef priority_queue<int> pq; int main(void) { int a; while (cin >> a) { int b; cin >> b; int c = a + b; stringstream ss; string s; ss << c; s = ss.str(); cout << s.size() << endl; } return 0; }
[["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22]]
1
128
2
#define _USE_MATH_DEFINES #include <algorithm> #include <functional> #include <iostream> #include <math.h> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; //??°?????????????????° void function() { //??¢??° } int main() { int a, b; cin >> a >> b; int sum = a + b; int cnt = 1; while (true) { sum /= 10; if (sum == 0) { break; } cnt++; } cout << cnt << endl; return 0; }
#define _USE_MATH_DEFINES #include <algorithm> #include <functional> #include <iostream> #include <math.h> #include <stack> #include <stdio.h> #include <string.h> #include <string> #include <vector> using namespace std; //??°?????????????????° void function() { //??¢??° } int main() { int a, b; while (cin >> a >> b) { int sum = a + b; int cnt = 1; while (true) { sum /= 10; if (sum == 0) { break; } cnt++; } cout << cnt << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
93
6
#include <iostream> using namespace std; int main() { int i; int a, b, sum, figure; cin >> a >> b; sum = a + b; figure = 1; while (sum / 10 != 0) { sum = sum / 10; figure++; } cout << figure << "\n"; return 0; }
#include <iostream> using namespace std; int main() { int i; int a, b, sum, figure; while (cin >> a >> b) { sum = a + b; figure = 1; while (sum / 10 != 0) { sum = sum / 10; figure++; } cout << figure << "\n"; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
70
6
#include <iostream> using namespace std; int main() { int a; int b; int c; int n; int d; while (cin >> a >> b) { c = a + b; d = 1; n = 0; while (1) { if (d < c) { break; } d = d * 10; n = n + 1; } cout << n << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a; int b; int c; int n; int d; while (cin >> a >> b) { c = a + b; d = 1; n = 0; while (1) { if (d > c) { break; } d = d * 10; n = n + 1; } cout << n << endl; } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
88
2
#include <algorithm> #include <iostream> #include <vector> #define rep(x, to) for (x = 0; x < to; x++) #define rep2(x, from, to) for (x = from; x < to; x++) using namespace std; int main(void) { int a, b, c; cin >> a >> b; c = a + b; int k = 0; while (c > 0) { k++; c /= 10; } if (k == 0) k = 1; cout << k << endl; return 0; }
#include <algorithm> #include <iostream> #include <vector> #define rep(x, to) for (x = 0; x < to; x++) #define rep2(x, from, to) for (x = from; x < to; x++) using namespace std; int main(void) { int a, b, c; while (cin >> a >> b) { c = a + b; int k = 0; while (c > 0) { k++; c /= 10; } if (k == 0) k = 1; cout << k << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
93
6
#include <cstdio> #include <iostream> using namespace std; int main() { int a, b, c; char str[16]; cin >> a >> b; c = sprintf(str, "%d", a + b); cout << c << endl; return 0; }
#include <cstdio> #include <iostream> using namespace std; int main() { int a, b, c; char str[16]; while (cin >> a >> b) { c = sprintf(str, "%d", a + b); cout << c << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
57
6
#include <iostream> int main() { int a, b; std::cin >> a >> b; int sum = a + b; int i = 0; do { sum /= 10; i++; } while (sum > 0); std::cout << i << std::endl; return 0; }
#include <iostream> int main() { int a, b; while (std::cin >> a >> b) { int sum = a + b; int i = 0; do { sum /= 10; i++; } while (sum > 0); std::cout << i << std::endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
63
6
#include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int d, sum = 0; sum = a + b; for (d = 1; sum >= 10; ++d) { sum /= 10; } if (sum) cout << endl; else cout << 0 << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int d, sum = 0; sum = a + b; for (d = 1; sum >= 10; ++d) { sum /= 10; } if (sum) cout << d << endl; else cout << 0 << endl; } return 0; }
[["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 16, 17, 151]]
1
77
2
#include <iostream> #include <sstream> #include <string> using namespace std; int main() { int a, b, n; cin >> a >> b; n = a + b; int ans = 1; while (n >= 10) { n /= 10; ans++; } cout << ans << endl; return 0; }
#include <iostream> #include <sstream> #include <string> using namespace std; int main() { int a, b, n; while (cin >> a >> b) { n = a + b; int ans = 1; while (n >= 10) { n /= 10; ans++; } cout << ans << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
64
6
#include <cmath> #include <cstdio> using namespace std; int main() { int a, b, c; while (scanf("%d %d", &a, &b) != EOF) { c = (int)log10(a + b); printf("%d\n", c); } return 0; }
#include <cmath> #include <cstdio> using namespace std; int main() { int a, b, c; while (scanf("%d %d", &a, &b) != EOF) { c = (int)log10(a + b) + 1; printf("%d\n", c); } return 0; }
[["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 72], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
65
2
#include <iostream> int main(void) { int array[2]; std::cin >> array[0] >> array[1]; array[0] += array[1]; array[1] = 0; do { array[0] /= 10; ++array[1]; } while (array[0]); std::cout << array[1] << std::endl; return 0; }
#include <iostream> int main(void) { int array[2]; while (std::cin >> array[0] >> array[1]) { array[0] += array[1]; array[1] = 0; do { array[0] /= 10; ++array[1]; } while (array[0]); std::cout << array[1] << std::endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
86
6
#include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { a = a + b; b = 1; while (a > 1) { a /= 10; b++; } cout << b << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { a = a + b; b = 1; while (a >= 10) { a /= 10; b++; } cout << b << endl; } return 0; }
[["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 47], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
61
4
#include <iostream> #include <math.h> using namespace std; int main() { int a, b; cin >> a >> b; int c = log10((double)a + b) + 1; cout << c << endl; return (0); }
#include <iostream> #include <math.h> using namespace std; int main() { int a, b; while (cin >> a >> b) { int c = log10((double)a + b) + 1; cout << c << endl; } return (0); }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
51
6
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main(void) { int a, b, c; char dummy[8]; cin >> a >> b; if (cin.eof()) return 0; c = a + b; cout << sprintf(dummy, "%d", c) << endl; return 0; }
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main(void) { int a, b, c; char dummy[8]; while (1) { cin >> a >> b; if (cin.eof()) return 0; c = a + b; cout << sprintf(dummy, "%d", c) << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 51, 13], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
71
6
#include <iostream> #include <math.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << (int)log10(a + b) + 1 << endl; return 0; }
#include <iostream> #include <math.h> using namespace std; int main() { int a, b; while (cin >> a >> b) { cout << (int)log10(a + b) + 1 << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
44
6
#include <cstdio> char s[9]; int main() { for (int a, b; ~scanf("%d %d", a, b); printf("%d\n", sprintf(s, "%s", a + b))) ; }
#include <cstdio> char d[9]; int main() { for (int a, b; ~scanf("%d %d", &a, &b); printf("%d\n", sprintf(d, "%d", a + b))) ; }
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 49, 22], ["+", 15, 91, 28, 2, 3, 4, 0, 66, 17, 67], ["-", 26, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["+", 26, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["-", 3, 4, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 3, 4, 0, 2, 3, 4, 0, 5, 0, 6]]
1
55
8
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace ::std; int main(void) { int a, b; cin >> a >> b; int ab = a + b; char c_num[64]; sprintf(c_num, "%d", ab); string s_num = (string)c_num; cout << s_num.size() << endl; return 0; }
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <string> #include <vector> using namespace ::std; int main(void) { int a, b; while (cin >> a >> b) { int ab = a + b; char c_num[64]; sprintf(c_num, "%d", ab); string s_num = (string)c_num; cout << s_num.size() << endl; } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
82
6
#include <iostream> #include <stdio.h> int main() { int cnt, a, b; while (scanf("%d %d", &a, &b) != EOF) { cnt = 0; for (int i = 10;; i *= 10) { if ((a + b) / i == 0) { std::cout << cnt << '\n'; break; } cnt++; } } return 0; }
#include <iostream> #include <stdio.h> int main() { int cnt, a, b; while (scanf("%d %d", &a, &b) != EOF) { cnt = 1; for (int i = 10;; i *= 10) { if ((a + b) / i == 0) { std::cout << cnt << '\n'; break; } cnt++; } } return 0; }
[["-", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 52, 8, 9, 0, 1, 0, 11, 12, 13]]
1
86
2
#include <iostream> using namespace std; int main() { int a, b, c; while (cin >> a >> b) { int ans = 1; c = a + b; while (c > 10) { ans = ans + 1; c = c / 10; } cout << ans << endl; } return 0; }
#include <iostream> using namespace std; int main() { int a, b, c; while (cin >> a >> b) { int ans = 0; c = a + b; while (c > 0) { ans = ans + 1; c = c / 10; } cout << ans << endl; } return 0; }
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 13]]
1
69
4
#include <iostream> #include <math.h> using namespace std; int main() { int a, b, c; while (cin >> a >> b) { c = a + b; int d; for (int i = 0; i < 8; i++) { if (pow(10, i) <= c && c < pow(10, i + 1)) { d = i + 1; } cout << d << endl; } } return 0; }
#include <iostream> #include <math.h> using namespace std; int main() { int a, b, c; while (cin >> a >> b) { c = a + b; int d; for (int i = 0; i < 8; i++) { if (pow(10, i) <= c && c < pow(10, i + 1)) { d = i + 1; } } cout << d << endl; } return 0; }
[["+", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 52, 8, 9, 0, 7, 8, 9, 0, 46]]
1
95
2
#include <cmath> #include <iostream> using namespace std; int main() { int out[200]; int n, m; int count = 0; while (cin >> n >> m) { for (int i = 0; i < 100; i++) { if (pow(10.0, i) <= n + m) { out[count] = i; break; } } count++; } for (int i = 0; i < count; i++) { cout << out[i] << endl; } }
#include <cmath> #include <iostream> using namespace std; int main() { int out[200]; int n, m; int count = 0; while (cin >> n >> m) { for (int i = 0; i < 100; i++) { if (pow(10.0, i) > n + m) { out[count] = i; break; } } count++; } for (int i = 0; i < count; i++) { cout << out[i] << endl; } }
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
108
2
#include <iostream> using namespace std; int main() { int i, j; while (cin >> i >> j) { i += j; int count; while (i > 0) { i = i / 10; count++; } cout << count << endl; } return 0; }
#include <iostream> using namespace std; int main() { int i, j; while (cin >> i >> j) { i += j; int count = 0; while (i > 0) { i = i / 10; count++; } cout << count << endl; } return 0; }
[["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13]]
1
60
6
#include <iostream> using namespace std; int main() { int i, j; while (cin >> i >> j) { i += j; int count; while (i > 0) { i = i / 10; count++; } cout << count << endl; } return 0; }
#include <iostream> using namespace std; int main() { int i, j; while (cin >> i >> j) { i += j; int count = 0; while (i > 0) { i = i / 10; count++; } cout << count << "\n"; } return 0; }
[["+", 0, 52, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 62], ["+", 8, 9, 0, 1, 0, 16, 12, 5, 0, 44]]
1
60
6
#include <cstdio> #include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int x = 1; int ans = 1; while (x >= a + b) { x = x * 10; ans++; } printf("%d\n", ans); } return 0; }
#include <cstdio> #include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { int x = 1; int ans = 0; while (x <= a + b) { x = x * 10; ans++; } printf("%d\n", ans); } return 0; }
[["-", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 52, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 19]]
1
71
4
#include <cmath> #include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { cout << (int)(log((double)a + b) - 1) << endl; } return 0; }
#include <cmath> #include <iostream> using namespace std; int main() { int a, b; while (cin >> a >> b) { cout << (int)log10((double)a + b) + 1 << endl; } return 0; }
[["-", 0, 16, 31, 16, 12, 74, 51, 23, 0, 24], ["-", 12, 74, 51, 23, 0, 16, 31, 2, 63, 22], ["+", 31, 16, 12, 16, 31, 74, 51, 2, 63, 22], ["-", 31, 16, 12, 74, 51, 23, 0, 16, 17, 33], ["+", 0, 1, 0, 16, 31, 16, 12, 16, 17, 72], ["-", 0, 16, 31, 16, 12, 74, 51, 23, 0, 25]]
1
53
6
#include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { int a[200], b; int i = 0; while (scanf("%d %d", &a[i], &b) != EOF) { a[i] = a[i] + b; i++; } for (int j = 0; j < i; j++) { int n = 1; int nCount = 0; while (a[i] / n >= 1) { n *= 10; nCount++; } printf("%d\n", nCount); } return 0; }
#include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { int a[200], b; int i = 0; while (scanf("%d %d", &a[i], &b) != EOF) { a[i] = a[i] + b; i++; } for (int j = 0; j < i; j++) { int n = 1; int nCount = 0; while (a[j] / n >= 1) { n *= 10; nCount++; } printf("%d\n", nCount); } return 0; }
[["-", 51, 16, 31, 16, 31, 69, 341, 342, 0, 22], ["+", 51, 16, 31, 16, 31, 69, 341, 342, 0, 22]]
1
122
2
def cntDigits(num) digit = 1 while num > 10 digit += 1 num /= 10.0 end digit end while line = gets nums = line.split puts cntDigits(nums[0].to_i + nums[1].to_i) end
def cntDigits(num) digit = 1 while num >= 10 digit += 1 num /= 10.0 end digit end while line = gets nums = line.split puts cntDigits(nums[0].to_i + nums[1].to_i) end
[["-", 0, 735, 8, 736, 0, 89, 15, 738, 17, 47], ["+", 0, 735, 8, 736, 0, 89, 15, 738, 17, 20]]
4
48
2
// c++11 #include <iostream> #include <string> #include <vector> using namespace std; int main() { long int x, y; int ans; vector<long int> vx, vy; while (cin >> x >> y) { vx.push_back(x); vy.push_back(y); } for (int i = 0; i < vx.size(); i++) { long int div = 1, sum = vx[i] + vy[i]; for (int j = 1;; j++) { if (sum % div < 1) { ans = j; break; } else { div *= 10; } } cout << ans << endl; } }
// c++11 #include <iostream> #include <string> #include <vector> using namespace std; int main() { long int x, y; int ans; vector<long int> vx, vy; while (cin >> x >> y) { vx.push_back(x); vy.push_back(y); } for (int i = 0; i < vx.size(); i++) { long int div = 1, sum = vx[i] + vy[i]; for (int j = 0;; j++) { if (sum / div < 1) { ans = j; break; } else { div *= 10; } } cout << ans << endl; } }
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 109], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 17, 85]]
1
139
4