1 条题解
-
0
C :
#include<stdio.h> #include<stdlib.h> int main() { int j; int n; scanf("%d", &n); int *a = (int *)malloc(n*sizeof(int)); int *b = (int *)malloc(n*sizeof(int)); int *ans = (int *)malloc(n*sizeof(int)); for(j = 0; j < n; j++) { scanf("%d%d", &a[j], &b[j]); ans[j] = 0; } for(j = 0; j < n; j++) { int c = 0; for(int i = 9; i >= 0; i--) { c = (a[j]%10 + b[j]%10 + c) > 9 ? 1 : 0; ans[j] += c; a[j] /= 10; b[j] /= 10; } } for(j = 0; j < n; j++) { printf("%d\n", ans[j]); } free(a); free(b); free(ans); return 0; }
- 1
信息
- ID
- 1582
- 时间
- 1000ms
- 内存
- 2MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者