Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

满足了我强迫症的代码=C+0ms+没多余大括号+短+易读

Posted by 416221843 at 2016-08-12 17:06:50 on Problem 1503
#include <stdio.h>
#include <string.h>
char b[105];
int a[105],i,j,n;
int main() {
while (scanf("%s", b)&& strcmp(b, "0")&&(n = strlen(b))) 	 
	for (i = 0;i<n;i++)
	 a[i] += b[n - 1 - i] - '0';
for (i = 0; i < 104; i++)
 if (a[i]>9)   a[i + 1] += a[i] / 10, a[i] %= 10;
    while (!a[--i]);
	while (i >= 0) printf("%d", a[i--]);
	puts("\n");
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator