| ||||||||||
| 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:就计算一个求和,一个乘法一个减法,竟TLE了,帮我看看!In Reply To:就计算一个求和,一个乘法一个减法,竟TLE了,帮我看看! Posted by:ngn999 at 2008-07-23 18:51:17 控制循环的不是n而是t,
再有就是测试数据里有
3 0
adsf 0
asfsa 0
sfa 0
这样的测试数据!
> #include <stdio.h>
> int main(){
> int t, n, i;
> char name[21];
> long sum;
> int score;
> scanf("%d%d", &t,&n);
> while( t!=0 && n!= 0){
> sum = 3*n;
> for(i = 1; i <= n; i++){
> scanf("%s%d", name,&score);
> sum =sum - score;
> }
> printf("%d\n",sum);
> scanf("%d%d", &t,&n);
> }
> return 0;
> }
>
>
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator