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

我菜鳥時在UVA水過的code!我自己再看也不明白了!

Posted by ytlau9 at 2010-09-05 00:54:43 on Problem 2590
#include<stdio.h>

int main(){
        long long l,h,d,sum;
        int k,i=1,j=1;
        scanf("%d", &k);
        while(k--){
                sum = 0;
                scanf("%lld %lld", &l, &h);
                d = h-l;
                for(i=1,j=1; sum<d ;j++){
                        sum+=i;
                        if(j%2==0) i++;
                }
                printf("%d\n", j-1);
        }
        return 0;
}

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