| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:满足了我强迫症的代码=C+0ms+没多余大括号+短+易读In Reply To:满足了我强迫症的代码=C+0ms+没多余大括号+短+易读 Posted by:416221843 at 2016-08-12 17:06:50 > #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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator