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 |
急 求救:哪位大虾能帮小弟的忙啊 !!#include<stdio.h> int f(int n) { int sum=0; if(n>=0&&n<=9) return n; do{ sum+=n%10; n=n/10; }while(n>0); return f(sum); } void main() { int n; scanf("%d",&n); while(n!=0) { printf("%d\n",f(n)); scanf("%d",&n); } } 为什么总是超时跟超出内存限制啊 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator